Difference between revisions of "Pageframe"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 60: | Line 60: | ||
|} | |} | ||
− | |||
====Examples==== | ====Examples==== | ||
Line 66: | Line 65: | ||
'''Recital''' | '''Recital''' | ||
<code lang="recital"> | <code lang="recital"> | ||
+ | // | ||
+ | // Lianja custom section for page "page1" section "section1" | ||
+ | // | ||
+ | namespace rectabs | ||
+ | public pageframe1, tab0, tab1, tab2 | ||
+ | |||
+ | define class page1_section1 as section | ||
+ | enddefine | ||
+ | |||
+ | define class tabbutton as CommandButton | ||
+ | proc click | ||
+ | do case | ||
+ | case upper(this.name) = "TABBUTTON1" | ||
+ | pageframe1.activepage = 1 | ||
+ | case upper(this.name) = "TABBUTTON2" | ||
+ | pageframe1.activepage = 2 | ||
+ | case upper(this.name) = "TABBUTTON3" | ||
+ | messagebox(etos(int(pageframe1.pagecount)),64,"Pages") | ||
+ | case upper(this.name) = "TABBUTTON4" | ||
+ | pageframe1.closable = not pageframe1.closable | ||
+ | case upper(this.name) = "TABBUTTON5" | ||
+ | pageframe1.tabs = not pageframe1.tabs | ||
+ | case upper(this.name) = "TABBUTTON6" | ||
+ | if pageframe1.pagecount = 3 | ||
+ | pageframe1.removeobject(tab2) | ||
+ | else | ||
+ | pageframe1.addobject("tab2","page") | ||
+ | tab2.caption = "Tab2" | ||
+ | tab2.backcolor = "green" | ||
+ | endif | ||
+ | endcase | ||
+ | endproc | ||
+ | enddefine | ||
+ | |||
+ | proc page1_section1 | ||
+ | page1_section1 = createobject("page1_section1") | ||
+ | page1_section1.addobject("pageframe1", "pageframe") | ||
+ | pageframe1.addobject("tab0", "page") | ||
+ | tab0.layout = 3 | ||
+ | tab0.picture = ":/images/recital_background" | ||
+ | tab0.caption = "Tab0" | ||
+ | tab0.addobject("tabbutton1", "tabbutton") | ||
+ | tabbutton1.caption = "Select Tab1" | ||
+ | tab0.addobject("tabbutton2", "tabbutton") | ||
+ | tabbutton2.caption = "Select Tab2" | ||
+ | tab0.addobject("tabbutton3", "tabbutton") | ||
+ | tabbutton3.caption = "Display Pagecount" | ||
+ | tab0.addobject("tabbutton4", "tabbutton") | ||
+ | tabbutton4.caption = "Toggle closable tabs" | ||
+ | tab0.addobject("tabbutton5", "tabbutton") | ||
+ | tabbutton5.caption = "Toggle tab bar" | ||
+ | tab0.addobject("tabbutton6", "tabbutton") | ||
+ | tabbutton6.caption = "Add/remove tab" | ||
+ | |||
+ | pageframe1.addobject("tab1", "page") | ||
+ | tab1.caption = "Tab1" | ||
+ | tab1.backcolor = "red" | ||
+ | |||
+ | pageframe1.addobject("tab2", "page") | ||
+ | tab2.caption = "Tab2" | ||
+ | tab2.backcolor = "blue" | ||
+ | |||
+ | return page1_section2 | ||
</code> | </code> |
Revision as of 08:12, 2 February 2012
Contents
Properties
This class supports the Common properties plus the following:
Property | Access (R/RW) | Value | Description |
---|---|---|---|
Tabs | RW | boolean | If true, the tab bar is displayed. If false, only the current page is displayed. |
Activepage | RW | numeric | Index of the selected page (starting from 0, left to right). |
Closable | RW | boolean | If true, individual tabs have a close button (x). If false tabs cannot be closed. |
Pagecount | RW | numeric | Number of pages in the pageframe. |
Methods
This class supports the Common methods plus the following:
Method | Args | Description |
---|---|---|
Addobject | name,class | Adds an object to the pageframe container. |
Removeobject | object | Removes an object from the pageframe container. |
Events
This class supports the Common events plus the following:
Event | Args | Description |
---|
Examples
Recital
// // Lianja custom section for page "page1" section "section1" // namespace rectabs public pageframe1, tab0, tab1, tab2 define class page1_section1 as section enddefine define class tabbutton as CommandButton proc click do case case upper(this.name) = "TABBUTTON1" pageframe1.activepage = 1 case upper(this.name) = "TABBUTTON2" pageframe1.activepage = 2 case upper(this.name) = "TABBUTTON3" messagebox(etos(int(pageframe1.pagecount)),64,"Pages") case upper(this.name) = "TABBUTTON4" pageframe1.closable = not pageframe1.closable case upper(this.name) = "TABBUTTON5" pageframe1.tabs = not pageframe1.tabs case upper(this.name) = "TABBUTTON6" if pageframe1.pagecount = 3 pageframe1.removeobject(tab2) else pageframe1.addobject("tab2","page") tab2.caption = "Tab2" tab2.backcolor = "green" endif endcase endproc enddefine proc page1_section1 page1_section1 = createobject("page1_section1") page1_section1.addobject("pageframe1", "pageframe") pageframe1.addobject("tab0", "page") tab0.layout = 3 tab0.picture = ":/images/recital_background" tab0.caption = "Tab0" tab0.addobject("tabbutton1", "tabbutton") tabbutton1.caption = "Select Tab1" tab0.addobject("tabbutton2", "tabbutton") tabbutton2.caption = "Select Tab2" tab0.addobject("tabbutton3", "tabbutton") tabbutton3.caption = "Display Pagecount" tab0.addobject("tabbutton4", "tabbutton") tabbutton4.caption = "Toggle closable tabs" tab0.addobject("tabbutton5", "tabbutton") tabbutton5.caption = "Toggle tab bar" tab0.addobject("tabbutton6", "tabbutton") tabbutton6.caption = "Add/remove tab" pageframe1.addobject("tab1", "page") tab1.caption = "Tab1" tab1.backcolor = "red" pageframe1.addobject("tab2", "page") tab2.caption = "Tab2" tab2.backcolor = "blue" return page1_section2