[Gambas-user] Really dumb question about dialog forms
Fabien Bodard
gambas.fr at ...626...
Sat Dec 12 08:00:19 CET 2009
2009/12/12 Kadaitcha Man <nospam.nospam.nospam at ...626...>:
> 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.
in fact you are right in the vb way ... but not it OO way...
And gambas is more in the OO one and since the begining.
For the return problem ... there is not problem as the run procedure
can return the value.
You can use a public variable in a module too
Private sValue as string
STATIC Publc Run() as string
if not me.showmodal then return
return sValue
END
dim s as string
s = fForm.Run
if s then print s
>
> ------------------------------------------------------------------------------
> Return on Information:
> Google Enterprise Search pays you back
> Get the facts.
> http://p.sf.net/sfu/google-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list