[Gambas-user] Really dumb question about dialog forms

Kadaitcha Man nospam.nospam.nospam at ...626...
Sat Dec 12 00:13:34 CET 2009


2009/12/11 Fabien Bodard <gambas.fr at ...626...>:

> Static Public sValue as string
>
> Public Sub Run () As Boolean

I knew there was a reason not to use your method and to make the
recommendation I did.

If you tested that code then I presume you did it in gb3 and not gb2.

Gambas 2 either crashes out with a SIG 11, or in some unfathomable
instances, when the form is closed, it drops into debug and complains
about the pending destruction of a public static variable. Furthermore
if the form is instantiated in a variable of type Form then you cannot
access the public static by referencing the variable as a property in
the instanced form type variable;  the only way to get to the value of
the public static is directly from the class itself, like this:

  DIM ff AS NEW Form1

  IF NOT ff.Run() THEN

    PRINT Form1.sValue

  ENDIF

In short, Fabien, as far as I can tell, the only way to make it work
correctly in gb2 is to do it the way I originally said to do it. Of
course I'm open to being shown to be wrong.




More information about the User mailing list