Adding controls at runtime

tinmanjo

Member
Licensed User
Hi, ive read the manual that was released for download, but im stuck with how you add an object at runtime which is part of the main controls.

I want to add a text box using:-

addobject("mytxtbox","Textbox")
mytxtbox.new1("form1",0,0,50,0)

the manual only shows you to add an object as part of an addon library dll not as part of the default controls.

or am I missing something here in the declaration bit.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Note that this tutorial was not updated yet with the changes regarding the Control keyword.
As of v6.90 it is recommended to not use it and instead use the new set of keywords that match the control type.
For example:
B4X:
Sub App_Start
    AddForm("form1", "")
    Form1.Color = cGray
    Form1.Show
    For i = 1 To 5
        AddTextBox("form1", "t" & i, 20, 45 * i, 90, 40, "")
        TextBox("t" & i).Text = "I'm Textbox t" & i 'instead of Control("t" & i, TextBox).Text = ...
    Next
End Sub
 
Top