[Gambas-user] A few questions.

Oliver Stieber oliver_stieber at ...370...
Wed Dec 22 00:53:09 CET 2004


Hi, 
I'm a bit of an old-skool vb progammer, I've used VB
since version 2 and even the dos version! and I've
been trying to get to grips with Gambas with the hopes
of porting some of my old work.


Anyhow, I've been having a few teething problems.

1: How do I create a type safe array of object and
pass it as a parameter to a function e.g.

public sub dosomething(optional things as type[] =
null)



2: I've tried a 'work around' of creating a class
types that inherits object[], I've overridden? the add
function so that I can add a key and value (I know I
can do this with a collection, but I want to be able
to get the keys back too)

PUBLIC SUB add(key AS String, value AS Variant)
 DIM aparam AS  Object
 aparam = NEW parameter(key,value) 

which is find, but how do I call the object[] to add 
I've tried  add(aPARAM)  but it doesn't work...

Also when I try to perform array access on my class it
fails, reporting class is not an array.


3: I've also been playing around with some graphics
and couldn't find a way to read the value of a pixel,
is this possible?


4: where can I request some which list functions...
the kind of things I always seem to re-write, like
(and I know this is a hack)

PUBLIC FUNCTION ang(xvalue AS Float, yvalue AS Float)
AS Float

  DIM tanvalue AS Float 
  IF xvalue = 0 THEN 
    tanvalue = 90
  ELSE
    tanvalue= Deg(ATan(yvalue/xvalue))
  END IF
  IF tanvalue < 0 THEN tanvalue = tanvalue + 360 
  IF xvalue > 0  THEN
    tanvalue = tanvalue + 180
  END IF
  IF tanvalue > 360 THEN tanvalue = tanvalue - 360
    
  RETURN tanvalue 
  
END

and

PUBLIC FUNCTION mag(xvalue AS Float, yvalue AS Float)
AS Float
    
  RETURN  Sqr(xvalue*xvalue + yvalue*yvalue)
  
END


5: I've also done C/C++ for quite a few years too so I
don't mind helping out where I can (though I don't
really have time to get drawn into to many projects)

6: While I'm porting the apps I'll try to keep a log
of VB->Gambas issues and try to periodically
consolidate things, I'll post it as I go if you want.

7: The apps are old but quite interesting (no db stuff
thought, mostly VB3 he he) and are as follows.

A full GUI fractal landscape, tree and vista generator
for povray, featuting FFT, many 2d graphic
manipulation functions, 3d preview and that kind of
thing, all in vb3, with some c helper libraies (that I
can redo in VB).

screen short here 
http://www.oliverthered.f2s.com/fractalworlds/

A simple visual component based logic simulator(put
lots of gates on the form, join the inputs and
outputs).

A photograpic database (for photographers), a standard
database but with spline based vector graphics for
modeling you set.


Loads of other stuff too, adventure game generators,
AI's to solve mine-sweeper, maybe the odd byte code
interpreter, a RTF WISIWYG editor. that kind of thing.


Your more than welcome to include any of the
applications/demos with Gambas, they haven't made me
any money over the past 15 years(but they've got me a
quite a few jobs!).







	
	
		
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com




More information about the User mailing list