[Gambas-user] Gambas IDE 1.9.49-2 New Function formating.

ron ronstk at ...239...
Mon Jun 25 17:43:25 CEST 2007


On Monday 25 June 2007 12:41, Andreas Kostyrka wrote:
> Trouble is that New is also a function. NEW is a keyword that can be only
> used in an assignment.
> New is the function to use instead in all other places.
> 
> >From the docs that were installed with Gambas:
> 
> New
> Syntax
> Object = New ( Class [ , Constructor parameters... ] )
>  Instantiates the class Class.
>  This routine works exactly like the NEW operator, except that the class
> name is specified at runtime and not at compile time.
>  If you want to specify the observer that will receives all the events
> generated by the newly created object, you must use the Object.Attach static
> method.
> 
> Andreas
> 

$entries.Add( New("ABC",arg1) )

See that 'Object' is well defined handle to that object created by 'New'.
It is that handle you want to add to the entries after the object is made.

In php/java it would be:
  $entries.Add( Object = New("ABC",arg1) )

There you are allowed to replace almost every part by complex functions

$entries.Add( New(document.getElementById(Sqr(4)*2) , prompt("the Argument","1234").substr(0,4) ) )

That is what people do when they want impress the boss.
For testing and debugging when something goes wrong they slap themself 
because they do not understand what happens after a few months. 
Result a angry boss :)

Ron




More information about the User mailing list