[Gambas-user] Weird, form width alway return as 640
Benoît Minisini
gambas at ...1...
Tue Dec 29 17:05:46 CET 2009
> cwyong1 ha scritto:
> > Hi all
> > i m experimenting with the HelloWorld project and i m confused, pls tell
> > me what is wrong here. Thanking you all in advance
> >
> > This is what i have added to the code
> >
> > PUBLIC SUB _new()
> >
> > END
> >
> > PUBLIC SUB Form_Open()
> > DEBUG Form.width
> > END
> >
> > PUBLIC SUB Button1_Click()
> >
> > DEBUG Form.width
> >
> > END
> >
> > When i run the project, debug show this
> > FMain.Form_Open.8: 640
> >
> > I then resize the window and on clicking the button 1, debug show this
> > FMain.Form_Open.8: 640
> > FMain.Button1_Click.13: 640
> >
> > So, my question is how come the width is still showing 640 when the width
> > have increased.
>
> Perhaps you should use "FMain.width", or "ME.Width" and not "Form.width".
>
> "Form" is not an instance of a class, but a class name. I don't know
> what gambas does in this case (it should give a compilation error, I
> suppose; what is the sense of querying a field of a non-instantiated
> class?).
>
> Regards,
> Doriano
>
Form is "auto-instanciable", so by querying Form.Width, you are querying the
width of an internal automatically created Form object.
Regards,
--
Benoît Minisini
More information about the User
mailing list