[Gambas-user] Add objects to a scrollview
sbungay
sbungay at ...981...
Fri Sep 8 18:37:40 CEST 2006
Timothy Marshal-Nichols wrote:
>>-----Original Message-----
>>From: gambas-user-bounces at lists.sourceforge.net
>>[mailto:gambas-user-bounces at lists.sourceforge.net]On Behalf Of rolf
>>Sent: Friday, 08 September 2006 12:44
>>To: mailing list for gambas users
>>Subject: [Gambas-user] Add objects to a scrollview
>>
>>
>>Hi everybody out there,
>>
>>still fighting with objects I would like to ask if someone can
>>give me a hint,
>>how to add objects like comboxes, textlabels... to a scrollview
>>dynamically
>>at runtime. BTW the scrollview itself is element of a tabstrip.
>>
>>Many thanks for your suggestions
>>Rolf
>>
>
>
> Take a look at the example at
> http://www.linuxbasic.net/index.php?topic=117.0
>
> This example uses a Form as the parent of the dynamic controls. However you
> can use any container - even throw caution to the wind and use a ScrollView.
> You would change the line:
>
> b = NEW Button(ME) AS "KeyButton"
>
> to your ScrollViewName:
>
> b = NEW Button(ScrollViewName) AS "KeyButton"
>
>
>
> Thanks
>
> 8-{)} Timothy Marshal-Nichols
> <mailto: timothy.marshal-nichols at ...247...>
>
>
>
This is good stuff. Lets say we want to dynamically instantiate
buttons in an hpanel and then assign pictures to the buttons surfaces
and values to their tags. I did this..
DIM bh as Button
bh - NEW Button(hpanel1) AS "Button" & CSTR(hpanel1.children.count)
WAIT
bh.picture = bh.picture.load("MyImage.png")
And it creates the button OK, but gives me a NULL OBJECT error when it
executes the picture assignment. Shouldn't 'bh' be a handle to the newly
instantiated button?
Steve.
More information about the User
mailing list