PDA

View Full Version : How can I add objects to a custom section?



hmischel@diligentsystems.com
2016-03-11, 11:12
Hi,

I have created a class based on a section. Like so.


define class contTopStatusBar as container
layout = "vertical"
fixedheight = 40
backcolor = "white"
enddefine

This works fine.

However, I want the class to have certain UI objects in it by default.

But I can't seem to get that working.

I have tried different ways to get this working. Does "this" work in class based on container?


define class contTopStatusBar as container
layout = "vertical"
fixedheight = 40
backcolor = "white"
this.addObject("buttonTest","commandbutton")

enddefine

Thanks.

Herb

yvonne.milne
2016-03-11, 11:37
Hi Herb,

Try this:


//
// Lianja custom section for page "page1" section "section1"
//

define class page1_section1 as section
enddefine
define class contTopStatusBar as container
layout = "vertical"
fixedheight = 40
backcolor = "white"
add object buttonTest as commandbutton

enddefine

proc page1_section1
page1_section1 = createobject("page1_section1")
page1_section1.addobject("cont1", "contTopStatusBar")
cont1.buttontest.caption = "Hello"
page1_section1.addobject("cont2", "contTopStatusBar")
cont2.buttontest.caption = "World"
return page1_section1

Regards,

Yvonne

hmischel@diligentsystems.com
2016-03-13, 10:32
Thats's perfect Yvonne!!!

This works.



define class herbButton as commandbutton
proc click()
Lianja.showMessage("Button was clicked")
endproc


enddefine

define class contTopStatusBar as container
layout = "vertical"
fixedheight = 40
backcolor = "white"
add object buttontest as herbButton

enddefine



proc page1_section1
page1_section1 = createobject("page1_section1")

page1_section1.addobject("cont1", "contTopStatusBar")
cont1.buttontest.caption = "Hello"
page1_section1.addobject("cont2", "contTopStatusBar")
cont2.buttontest.caption = "World"


return page1_section1