is there a tuturial for dynamic control creation

Ask about the individual Gambas components here.
BruceSteers
Posts: 766
Joined: Thursday 23rd July 2020 5:20pm

Re: is there a tuturial for dynamic control creation

Post by BruceSteers » Friday 27th August 2021 1:50am

sadams54 wrote:
Thursday 26th August 2021 11:31pm
I got the dynamic creation of everything figured out and working. Thank you guys very much. Thank you both for the examples they helped.

My next 2 issues are hopefully simple.

How do I create a control array? This is rather important for this project.

the 2nd is in the event handler. following cogier's example I have the following code and it worked at first then stopped working so wondering what I am doing wrong. when I click the button nothing happens.

Public Sub Testbutton_Click()

message(Last.Name)

End

Public Sub MakeChangeCamNameButton(cTab As Integer)

Dim P As New Panel(tCam[cTab])
P.Name = "p" & Str(cTab)
P.AutoResize = False

Dim B1 As New Button(P) As "Testbutton"
B1.Width = 160
B1.Height = 32
B1.X = 568
B1.Y = 16
B1.Name = "btnChangeCamName" & Str(cTab)
B1.Text = "Change Cam Name"

End
does it make a difference if you use
Dim P As Panel = New Panel(tCam[cTab])
and
Dim B1 As Button = New Button(P) As "Testbutton"

An array of controls can be made like this..
Dim MyControls as New Control[]

Mycontrols.Add(Button1)
etc, etc
Or
Dim MyContorls As New Object[]

sadams54
Posts: 90
Joined: Monday 09th July 2018 3:43am

Re: is there a tuturial for dynamic control creation

Post by sadams54 » Monday 30th August 2021 5:59pm

I tried both ways thinking just like you but made no difference. It seemed to work at first then stopped working so very lost as to why. It does not even fire the event.

can we create a control array from the gambas IDE?

Post Reply