oForm = CREATEOBJECT("clsMainForm")
oForm.Visible = .T.
oForm.SHOW()
Read EVENTS
CLOSE ALL
CLEAR ALL
RETURN
*!* Define Main Form Class
Define CLASS clsMainForm AS FORM
Caption = "Test Pageframe"
Left = 12
Top = 12
Height = _screen.Height - 24
Width = _screen.Width - 24 && 1680
BorderStyle = 2
WindowState = 2
WindowType = 0
BackColor = RGB(210, 210, 210)
Themes = .F.
*!* ADD exitbutton to form
Add OBJECT cmdExit AS COMMANDBUTTON WITH;
Caption = "Exit", ;
FontSize = 12, ;
FontBold = .T., ;
Backcolor = RGB(192,192,192), ;
ForeColor = RGB(255,0,0), ;
Left = ThisForm.Width - 120, ;
Top = ThisForm.Height - (48 + 24), ;
Width = 120, ;
Height = 48, ;
Alignment = 2
*!* ADD label to form
ADD OBJECT lblIntro as label WITH ;
Left = 240, Top = 48, autosize = .T., Caption = "Whatever you want", FontBold = .T., FontItalic = .T., FontSize = 24
*!* ADD optiongroup to form
ADD OBJECT opgPages as OptionGroup WITH ;
Left = 12, Top = 42, ButtonCount = 6, Autosize = .T.
PROCEDURE opgPages.Init()
FOR i = 1 TO This.ButtonCount
WITH This.Buttons(i)
.AutoSize = .T.
.Caption = "Click to activate page " + ALLTRIM(STR(i))
ENDWITH
ENDFOR
ENDPROC
PROCEDURE opgPages.Click()
LOCAL lni
lni = This.Value
WITH ThisForm.pgfMain
.ActivePage = lni
.Click
ENDWITH
ENDPROC
ADD OBJECT chkTabs as Checkbox WITH ;
Top = 142, Left = ThisForm.Width - 180, Value = .F., AutoSize = .T., Caption = "Show Tabs of PageFrame"
PROCEDURE chkTabs.Click
WITH ThisForm
.opgPages.Value = ThisForm.pgfMain.ActivePage
.opgPages.Enabled = !(This.Value)
.pgfMain.Tabs = This.Value
.Refresh()
ENDWITH
ENDPROC
*!* Add pageframe to Form
ADD OBJECT pgfMain AS PageFrame WITH ;
PAGECOUNT = 6, ;
LEFT = 12, ;
TOP = 184, ;
WIDTH = THISFORM.WIDTH - 12, ;
HEIGHT = THISFORM.HEIGHT - 272, ;
Tabs = .F.
PROCEDURE pgfMain.Init()
LOCAL loPage as Object
FOR i = 1 TO This.pageCount
loPage = This.Pages(i)
WITH loPage
.Caption = ICASE(i = 1, "Page One", i = 2, "Page Two", i = 3, "Page Three", i = 4, "Page Four", ;
i = 5, "Page Five","Page Six" )
.FontBold = .T.
.FontName = "Verdana"
.FontSize = 12
.Forecolor = ICASE(i = 1, RGB(0,0,255), i = 2, RGB(0,0,0), i = 3, RGB(0,0,255), ;
i = 4, RGB(128,64,64), i = 5, RGB(0,128,0), RGB(255,128,0))
.Addobject("lblPage", "lblLabel")
.lblPage.Top = 120
.lblPage.Left = i * 210
.lblPage.Caption = "This is label on page" + " " + ALLTRIM(STR(i))
ENDWITH
ENDFOR
ENDPROC
PROCEDURE cmdExit.CLICK
CLEAR Events
ENDPROC
PROCEDURE Destroy()
This.cmdExit.Click()
ENDPROC
ENDDEFINE
**********
DEFINE CLASS lblLabel as Label
Visible = .T.
Left = 12
Top = 24
Height = 48
FontSize = 18
FontName = "Verdana"
BorderStyle = 1
Backcolor = RGB(255,255,128)
Caption = "Label"
Autosize = .T.
ENDDEFINE
*********