[Gambas-devel] Hit F5 and run

Benoit Minisini gambas at ...20...
Tue May 20 20:57:29 CEST 2003


Le Mardi 20 Mai 2003 15:25, Rob a écrit :
> On Tuesday 20 May 2003 03:34, Benoit Minisini wrote:
> > So I will add a static public native method "Main" to the Form class that
> > will automatically instanciate the form and show it.
> > So, no need to add stuff to the IDE. Just set the form as startup class,
> > and everything will work. And you will be able to add your own Main
> > implementation if you need yet.
>
> This sounds like a great idea and will go a long way towards making people
> more comfortable.
>
> As for the global variable problem, I think making the forms available to
> the other classes in the project would be a step in the right direction, if
> it's technically possible.  What about something like
>
> Dim myTest as Form
> Set myTest = Application.Forms("testform")
>
> where testform is the name of the form to which you want to refer?  I know
> you don't have an Application object (or equivalent) presently, but I know
> somewhere in the interpreter you've gotta be tracking which forms have been
> instantiated.... maybe there could also be a way to get a count of forms
> and get references to them in a loop.
>
> Rob
>

You have the Windows classes, that is a pseudo-collection of each opened 
windows.

DIM hWindow AS Window
DIM hForm AS Form

FOR EACH hWindow IN Windows
  TRY hForm = hWindow
  IF Error THEN CONTINUE
  ' This window is a form
  ' In the standard use of Gambas, all windows are form
  ' But you can instanciate directly the Window class
NEXT

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list