[Gambas-user] Custom controls - 1 more question
Doriano Blengino
doriano.blengino at ...1909...
Tue Jan 19 12:42:01 CET 2010
Ron_1st ha scritto:
> On Tuesday 19 January 2010, Kadaitcha Man wrote:
>
>> 2010/1/19 Aaron Peachey <alpeachey at ...626...>:
>>
>>> Yes, this is the code in my form's class file:
>>>
>>> PUBLIC SUB Form_Open()
>>> DIM lblName AS Label
>>> lblName = NEW Label(ME)
>>> lblName.Show()
>>> END
>>>
>> Erm... have you tried putting text in the label's Caption property,
>> set its width and X, Y location so that it is within the visible area
>> of the form, yes?
>>
>> No, you haven't?
>>
>> There's your problem then, hey. The field has no text so it can't be
>> seen, even if it is hiding behind the window title-bar.
>>
>> Also, lose lblName.Show().
>>
>> Regards,
>>
>> <aside to Benoit>
>> It looks like X and Y are taken from the top left boundary of the
>> form's physical coordinates and not the the top left boundary of the
>> visible area within the form.
>>
>> Perhaps that needs to be fixed, squire.
>>
>>
>
>
> if he want the control always on the form the dim must be done global
> in the head else it lives only for the time the subroutine lives (??)
>
> -----------
> private lblName AS Label
>
> PUBLIC SUB Form_Open()
> lblName = NEW Label(ME)
> lblName.Show()
> END
> -------------
>
He does not need - at the time of the label creation with NEW, lblName
gets two references; one of them is discarded by leaving the subroutine,
but the other, held by the form (thanks to "(ME)"), remains; so the
label is not destroyed. Kadaitcha is right - the label should have
something to display, and show() does nothing because the Visible
property is already true by default. Or, at least, so It should be - too
lazy to try by myself...
Regards,
Doriano
More information about the User
mailing list