Adding controls from another form

skipper

Member
Licensed User
Hello all,

is it possible to add to a page of a tab control a control from another form in the same (or another) module?

Using a code like this (frmMain and frmPanels are forms in the same Main module)

B4X:
tab.New1("frmMain",280,25,500,440)
tab.AddTabPage("General")
tab.AddTabPage("Printers")
tab.AddTabPage("Users")

tab.AddControl("frmPanels.pnlGeneral",0,5,5)

I got an error "riferimento a un oggetto non impostato su un'istanza di oggetto"

Any help? many thanks
 

agraham

Expert
Licensed User
Longtime User
tab.AddControl("frmPanels.pnlGeneral",0,5,5)
It looks like you are qualifying the control name with a Form name. Controls belong to Modules not Forms, you can see this in the right hand pane, so you should use the Module name as a qualifier if a qualifier is needed.
 

skipper

Member
Licensed User
Thank you, Agraham!

Just a little confusing with "parent"..... :(

Do you please have any tip for changing font, color, size of text in a Tab object? I did a try with the door library but... no way...

Thanks for your help
Mimmo
 

agraham

Expert
Licensed User
Longtime User
There doesn't seem to be much you can do with a Tab control, nothing on the device and on the desktop the only thing that seems to stick is the Font.

Obj1 is a Door library Object, Font is an ImageLibEx NormalFont.

Obj1.New1(False)
Obj1.FromLibrary("Main.tab", "tbc", B4PObject(2)) ' get the TabControl
Font.New1("Times New Roman", 10, 1)
Obj1.SetProperty2("Font", Font.Value)
 
Top