Playing with Pageframes orientations

Published on by Yousfi Benameur


A page frame is a container object that contains pages, which can contain controls.to be visible it must added to a form.
The page frame defines global characteristics of the page: size and positioning, border style, which page is active, and so on. The page frame determines the location of the pages and how much of each page is visible. Pages are positioned at the top left corner of the page frame. If the page frame is moved, the pages move with the page frame.
A page frame contains individual pages that are named Page1, Page2, Page3, and so on by default.

Note:
Only the active page is refreshed when the Form Refresh method occurs for the form on which the page is located.

The PageFrame Themes property provides a gradient effect on Page objects, so a label, option button, or similar control with text does not appear correctly if the BackStyle property of the control is set to Opaque. You can remedy this situation by setting BackStyle to Transparent.
here we play with the pageframe.tabOrientation property.this can build the pageframe Tabs in 4 positions of the pageframe borders (0,1,2,3).
the tabs are supersteded (better overlayed) with classic vfp controls as:
-commandbutton (can embed text caption+image positionned with picturePosition property)
-label (text)  having a rotation property to be correctly positionned
 -container (image+label)

these codes below demonstrate these capabilities on a resizable top level form.
the pageframe in code have the properties as follow
-Tabs=.t.
-themes=.t.
-tabstyle=0 &&justified to calculate positions.
-tabOrientation :0,1,2,3  &&variable (top, bottom,left, right tabs placement)



Click on code to select [then copy] -click outside to deselect


*1*
*a classic pageframe with 4 orientations(0,1,2,3) and a container as tab (image+label).the label can be rotated to position it in its parent container (0-360 degrees).
*can choose to hide pictures or captions or show all
*can make a random backcolor with backstyle=1 (opaque) but this natively is not recommandable in pageframe control.
*tabs are not hidden (tabs=.t.) ans are overlayed with controls

Publi yform
yform=Newobject("ypgf")
yform.Show
Read Events
Retu
*
Define Class ypgf As Form
    Height = 421
	Width = 740
	ShowWindow = 2
	ShowTips = .T.
	AutoCenter = .T.
	Caption = "Playing with pageframe orientation"
*BackColor = Rgb(212,208,200)
	Name = "Form1"

	Add Object pageframe1 As PageFrame With ;
		PageCount = 4, ;
		Anchor = 15, ;
		Top = 25, ;
		Left = 24, ;
		Width = 616, ;
		Height = 325, ;
		Tabs = .T., ;
		TabOrientation = 0, ;
		Name = "Pageframe1", ;
		Page1.FontSize = 11, ;
		Page1.Caption = "Page1", ;
		Page1.Name = "Page1", ;
		Page2.FontSize = 11, ;
		Page2.Caption = "Page2", ;
		Page2.Name = "Page2", ;
		Page3.Caption = "Page3", ;
		Page3.Name = "Page3", ;
		Page4.Caption = "Page4", ;
		Page4.Name = "Page4"

	Add Object combo1 As ComboBox With ;
		Anchor = 768, ;
		Height = 25, ;
		Left = 216, ;
		ToolTipText = "TabOrientation", ;
		Top = 384, ;
		Width = 60, ;
		Name = "Combo1"

	Add Object check1 As Checkbox With ;
		Top = 388, ;
		Left = 294, ;
		Height = 17, ;
		Width = 70, ;
		Anchor = 768, ;
		AutoSize = .T., ;
		Alignment = 0, ;
		BackStyle = 0, ;
		Caption = "Backstyle", ;
		value=0,;
		Name = "Check1"

	Add Object image1 As Image With ;
		Anchor = 768, ;
		Picture = Home(1)+"graphics\icons\arrows\arw09rt.ico", ;
		Stretch = 0, ;
		mousepointer=15, ;
		BackStyle = 0, ;
		Height = 32, ;
		Left = 383, ;
		Top = 376+14,;
		Width = 32, ;
		ToolTipText = "Tabs rotation (mouse button1-2)", ;
		Name = "Image1"

	Add Object spinner1 As Spinner With ;
		Anchor = 768, ;
		mousepointer=15, ;
		spinnerlowValue=0,;
		SpinnerHighValue=360, ;
		KeyboardHighValue=360,;
		keyboardLowValue=0,;
		value=0, ;
		left=500, ;
		top=376+6, ;
		width=70, ;
		name="spinner1"


	Procedure ybind
	Lparameters nButton, nShift, nXCoord, nYCoord
*--- aevent create an array laEvents
	Aevents( myArray, 0)
*--- reference the calling object
	loObject = myArray[1]
	oo="thisform.pageframe1.page"+  Right(Alltrim(loObject.Parent.Name) ,1)   &&if tabs<=9  otheriwse rweek this line
	ss=oo+".setfocus"
	&ss

	ss=oo+".activate"
	&ss

	Thisform.pageframe1.Resize
	Endproc

	Procedure Init
	Thisform.ShowTips=.T.

	Thisform.AddObject("yop1","yop")
	Thisform.yop1.Visible=.T.

	With This.pageframe1.Page1
		.AddObject("edit1", "editbox")

		With .edit1
			.Anchor=15
			.Height = 229
			.Left = 11
			.Top = 20
			.Width = 361
			.Alignment=2
			.Visible=.T.
			.ScrollBars=0
			.Name = "Edit1"
			TEXT TO .value noshow
		  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
		fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
		nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst. Nulla in iaculis nisi.
		Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non, porta congue dolor. Aenean viverra
		auctor sagittis. Integer lobortis dignissim auctor. Proin et volutpat massa.
		Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
		fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
		nulla. Aenean ultrices eget lectus eu efficitur.
			ENDTEXT
		Endwith
	Endwith

	With This.pageframe1.Page2
		.AddObject("image1", "image")
		With .image1
			.Anchor=15
			.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\CALLLAUR.BMP"
			.Height =2* Thisform.pageframe1.Height/3
			.Left = 95
			.Top = 44
			.Width = Thisform.pageframe1.Width/2
			.Stretch = 2
			.Visible=.T.
			Name = "Image1"
		Endwith
	Endwith


	With This.pageframe1.Page3
		.AddObject("command1", "commandbutton")
		With .command1
			.Picture=.Parent.Parent.Page2.image1.Picture
			.Anchor=15
			.Caption=""
			.Height =  Thisform.pageframe1.Height/2
			.Left = 47
			.Top = 32
			.Width = Thisform.pageframe1.Width/2
			.Visible=.T.
			.Name = "command1"
		Endwith
	Endwith

	With This.pageframe1.Page4
		.AddObject("image1", "image")
		With .image1
			.Anchor=15
			.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\BRIDJUST.BMP"
			.Height =2* Thisform.pageframe1.Height/3
			.Left = 95
			.Top = 44
			.Width = Thisform.pageframe1.Width/2
			.Stretch = 2
			.Visible=.T.
			Name = "Image1"
		Endwith
	Endwith
	For i=1 To This.pageframe1.PageCount
		aa="thisform.ycom"+Transform(i)+".label1"
		Bindevent(&aa,"mousedown",Thisform,"ybind")

		bb="thisform.ycom"+Transform(i)+".image1"
		Bindevent(&bb,"mousedown",Thisform,"ybind")

	Endfor
	Thisform.pageframe1.Resize
	Endproc


	Procedure Resize
	Try
		With Thisform.pageframe1.Page1
			With .edit1
				.Anchor=15
				.Height = 229
				.Left = 11
				.Top = 20
				.Width = 361
				.Alignment=2
				.Visible=.T.
				.Name = "Edit1"
				TEXT TO .value noshow
		 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
		fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
		nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst. Nulla in iaculis nisi.
		Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non, porta congue dolor. Aenean viverra
		auctor sagittis. Integer lobortis dignissim auctor. Proin et volutpat massa.
				ENDTEXT
			Endwith
		Endwith


		With This.pageframe1.Page2
			With .image1
				.Anchor=15
				.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\CALLLAUR.BMP"
				.Height =2* Thisform.pageframe1.Height/3
				.Left = 95
				.Top = 44
				.Width = Thisform.pageframe1.Width/2
				.Stretch = 2
				.Visible=.T.
				Name = "Image1"
			Endwith
		Endwith


		With This.pageframe1.Page3
			With .command1
				.Picture=.Parent.Parent.Page2.image1.Picture
				.Anchor=15
				.Caption=""
				.Height =  Thisform.pageframe1.Height/2
				.Left = 47
				.Top = 32
				.Width = Thisform.pageframe1.Width/2
				.Visible=.T.
				.Name = "command1"
			Endwith
		Endwith

		With This.pageframe1.Page4
			With .image1
				.Anchor=15
				.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\BRIDJUST.BMP"
				.Height =2* Thisform.pageframe1.Height/3
				.Left = 95
				.Top = 44
				.Width = Thisform.pageframe1.Width/2
				.Stretch = 2
				.Visible=.T.
				Name = "Image1"
			Endwith
		Endwith
		Thisform.pageframe1.Resize
	Catch
	Endtry
	Endproc

	Procedure Destroy
	Clea Events
	Endproc

	Procedure pageframe1.Resize
	DoDefault()
	Rand(-1)
	Local m.aa
	Try
		With This
			xorientation=This.TabOrientation
			xtop=This.Top
			xwidth=This.Width/This.PageCount
			xheight=This.Height/This.PageCount

			For i=1 To This.PageCount
				This.Pages(i).Caption=""
				m.aa="thisform.ycom"+Trans(i)
				With Eval(m.aa)
					Do Case
					Case m.xorientation=0    &&top
						.Top=xtop
						.Width=Int(xwidth)-1
						.Height=Thisform.oheight
						.Left=10+ Int((i-1)*xwidth)
						.label1.BackColor=Rgb(255*Rand(),255*Rand(),255*Rand())
						.label1.Rotation=0


					Case m.xorientation=1     &&bottom
						.Height=Thisform.oheight
						.Top=Thisform.pageframe1.Top+Thisform.pageframe1.Height-.Height
						.Width=Int(xwidth)-1
						.Left=10+ Int((i-1)*xwidth)
						.label1.BackColor=Rgb(255*Rand(),255*Rand(),255*Rand())
						.label1.Rotation=0


					Case m.xorientation=2 	  &&left
						.Top= Int(i-1)*xheight
						.Width=Thisform.oheight
						.Height=xheight
						.Left= Thisform.pageframe1.Left
						.label1.Rotation=65
						.label1.BackColor=Rgb(255*Rand(),255*Rand(),255*Rand())
						.label1.Left=0
						.label1.Top=.image1.Top+.image1.Height

					Case m.xorientation=3         &&right
						.Top= Int(i-1)*xheight
						.Width=Thisform.oheight
						.Height=xheight
						.Left= Thisform.pageframe1.Left+Thisform.pageframe1.Width -.Width
						.label1.Rotation=65
						.label1.BackColor=Rgb(255*Rand(),255*Rand(),255*Rand())
						.label1.Left=0
						.label1.Top=.image1.Top+.image1.Height
					Endcase

					.label1.Anchor=15
					.label1.BackStyle=Thisform.check1.Value
					.label1.BorderStyle=0   &&1
					.label1.FontSize=10
					.label1.Alignment=2    &&0
					.label1.FontBold=.T.
					.label1.MousePointer=15
					.label1.Caption="myPage"+Trans(i)
					.label1.ForeColor=Rgb(255*Rand(),255*Rand(),255*Rand())
					.ZOrder(0)
					.Visible=.T.
				Endwith
				This.Pages(i).Activate
			Endfor
			.Refresh
		Endwith

	Catch
	Endtry

	Thisform.Resize
	Endproc

	Procedure pageframe1.Init
	Thisform.AddProperty("oheight",36)

	With This
		.Tabs=.T.
		.TabStyle=0  &&default - justified
		m.xorientation=This.TabOrientation
		m.xtop=This.Top
		m.xwidth=This.Width/This.PageCount
		m.xheight=This.Height/This.PageCount
		Local m.aa
		For i=1 To This.PageCount
			This.Pages(i).Caption="myPage"+Trans(i)
			Thisform.AddObject("ycom"+Transform(i),"ycapt")
			m.aa="thisform.ycom"+Trans(i)

			With Eval(aa)
				.ToolTipText=Eval("thisform.pageframe1.page"+Trans(i)+".caption")
				.BackStyle=0
				Do Case
				Case m.xorientation=0    &&top
					.Top=m.xtop
					.Width=Int(m.xwidth)-1
					.Height=Thisform.oheight
					.Left=10+ Int((i-1)*m.xwidth)

				Case m.xorientation=1     &&bottom
					.Height=Thisform.oheight
					.Width=Int(m.xwidth)-1
					.Top=Thisform.pageframe1.Top+Thisform.pageframe1.Height-.Height
					.Left=10+ Int((i-1)*m.xwidth)

				Case m.xorientation=2 	  &&left
					.Top= Int(i-1)*m.xheight
					.Width=Thisform.oheight
					.Height=m.xheight
					.Left= Thisform.pageframe1.Left

				Case m.xorientation=3         &&right
					.Top= Int(i-1)*m.xheight
					.Width=Thisform.oheight
					.Height=m.xheight
					.Left= Thisform.pageframe1.Width
				Endcase
&&any small pictures or ico (16*16 pixels)
				With .image1
					.MousePointer=15
					.BackStyle=0
					Do Case
					Case  i=1
						.Picture=Home()+"graphics\icons\misc\lighton.ico"
					Case i=2
						.Picture=Home()+"graphics\icons\misc\misc15.ico"
					Case i=3
						.Picture=Home()+"graphics\icons\misc\binoculr.ico"
					Otherwise
						.Picture=Home()+"graphics\icons\misc\clock01.ico"
					Endcase
				Endwith

				With .label1
					.BorderStyle=1
					.FontBold=.T.
					.MousePointer=15
					.Caption="myPage"+Trans(i)
				Endwith
				.ZOrder(0)
				.Visible=.T.
			Endwith
			This.Pages(i).Activate
		Endfor
		This.Resize()
	Endwith
	Endproc

	Procedure combo1.AddItem
	Lparameters cItem
	Endproc

	Procedure combo1.Init
	With This
		.AddItem("0 - top")
		.AddItem("1 - Bottom")
		.AddItem("2 - Left")
		.AddItem("3 - Right")
		.ListIndex=Thisform.pageframe1.TabOrientation+1
		.Value=Thisform.pageframe1.TabOrientation+1
		.Style=2
	Endwith
	Endproc

	Procedure combo1.Click
	With Thisform.pageframe1
		.TabOrientation=This.Value-1
		.Resize
	Endwith
	Endproc


	Procedure check1.InteractiveChange
	Thisform.pageframe1.Resize
	Endproc

	Procedure image1.MouseDown
	Lparameters nButton, nShift, nXCoord, nYCoord
	Thisform.LockScreen=.T.
	Try
		Do Case
		Case  nButton=1
			This.RotateFlip=7
			With Thisform
				For i=1 To .ControlCount
					If Lower(Substr(.Controls(i).Name,1,4))=="ycom"
						.Controls(i).label1.Rotation=.Controls(i).label1.Rotation+1
						Thisform.spinner1.Value=.Controls(i).label1.Rotation
					Endi
				Endfor
			Endwith

		Case  nButton=2
			This.RotateFlip=0
			With Thisform
				For i=1 To .ControlCount
					If Lower(Substr(.Controls(i).Name,1,4))=="ycom"
						.Controls(i).label1.Rotation=.Controls(i).label1.Rotation-1
						Thisform.spinner1.Value=.Controls(i).label1.Rotation
					Endi
				Endfor
			Endwith
		Endcase
	Catch
	Endtry

	Thisform.LockScreen=.F.
	Endproc

	Procedure spinner1.InteractiveChange
	Lparameters nButton, nShift, nXCoord, nYCoord
	Thisform.LockScreen=.T.
	Try
		With Thisform
			For i=1 To .ControlCount
				If Lower(Substr(.Controls(i).Name,1,4))=="ycom"
					.Controls(i).label1.Rotation=This.Value
				Endi
			Endfor
		Endwith

	Catch
	Endtry
	Thisform.LockScreen=.F.
	Endproc


	Procedure image1.Init
	This.RotateFlip=7
	Endproc

Enddefine
*
*-- EndDefine: ypgf
Define Class ycapt As Container
	Top = 84
	Left = 696
	Width = 181
	Height = 36
	BackStyle = 0
	BorderWidth = 0
	Name = "Container1"

	Add Object image1 As Image With ;
		Picture = Home(1)+"graphics\icons\misc\face03.ico", ;
		Stretch = 2, ;
		Height = 32, ;
		Left = 0+10, ;
		Top = 4, ;
		backstyle=0, ;
		borderstyle=1, ;
		Width = 32, ;
		Name = "Image1"

	Add Object label1 As Label With ;
		anchor=768, ;
		FontBold = .T., ;
		FontSize = 12, ;
		Alignment = 0, ;
		borderstyle=0, ;
		Caption = "Label1", ;
		backstyle=0, ;
		Height = 34, ;
		Left = 42+20, ;
		Top = 4, ;
		Width = 142, ;
		Name = "Label1"



Enddefine
*
*-- EndDefine: ycapt

Define Class yop As OptionGroup
	AutoSize = .T.
	ButtonCount = 3
	Anchor = 768
	BackStyle = 0
	BorderStyle = 0
	Value = 1
	Height = 27
	Left = 5  &&439
	Top = 384
	Width = 219
	Name = "Optiongroup1"
	Option1.Caption = "No img"
	Option1.Value = 1
	Option1.Height = 17
	Option1.Left = 5
	Option1.Style = 0
	Option1.Top = 5
	Option1.Width = 61
	Option1.AutoSize = .F.
	Option1.Name = "Option1"
	Option2.Caption = "no Captions"
	Option2.Height = 17
	Option2.Left = 65
	Option2.Style = 0
	Option2.Top = 5
	Option2.Width = 85
	Option2.AutoSize = .T.
	Option2.Name = "Option2"
	Option3.Caption = "Default"
	Option3.Height = 17
	Option3.Left = 153
	Option3.Style = 0
	Option3.Top = 5
	Option3.Width = 61
	Option3.AutoSize = .F.
	Option3.Name = "Option3"

	Procedure Init
	This.SetAll("backstyle",0,"optionButton")
	This.Value=3  &&default
	Endproc

	Procedure InteractiveChange
	With Thisform
		Do Case
		Case This.Value=1
			For i=1 To .ControlCount
				If Substr(Lower( .Controls(i).Name),1,4)=="ycom"
					.Controls(i).image1.Visible=.F.
					.Controls(i).label1.Visible=.T.
				Endi
			Endfor

		Case This.Value=2
			For i=1 To .ControlCount
				If Substr(Lower( .Controls(i).Name),1,4)=="ycom"
					.Controls(i).label1.Visible=.F.
					.Controls(i).image1.Visible=.T.
				Endi
			Endfor

		Case This.Value=3
			For i=1 To .ControlCount
				If Substr(Lower( .Controls(i).Name),1,4)=="ycom"
					.Controls(i).image1.Visible=.T.
					.Controls(i).label1.Visible=.T.
				Endi
			Endfor

		Endcase
	Endwith
	Endproc


Enddefine
*
*-- EndDefine: yop


Playing with Pageframes orientations
Playing with Pageframes orientations
Playing with Pageframes orientations
Playing with Pageframes orientations

Click on code to select [then copy] -click outside to deselect


*2*
*a pageframe with tabs supersteded with commandbuttons (can embed text caption+image poistionned with picturePosition property)
*can choose to hide pictures or captions or show all
*tabs are not hidden (tabs=.t.) and are overlayed with controls

Publi yform
yform=Newobject("ypgf1")
yform.Show
Read Events
Retu
*
Define Class ypgf1 As Form
Height = 620
Width = 850
ShowWindow = 2
ShowTips = .T.
AutoCenter = .T.
Caption = "Pageframes with commandbuttons as TABS in 4 orientations"
yrback = .F.
Name = "Form1"

Add Object pageframe1 As PageFrame With ;
    ErasePage = .T., ;
	PageCount = 4, ;
	Anchor = 15, ;
	Top = 9, ;
	Left = 11, ;
	Width = 825, ;
	Height = 555, ;
	TabOrientation = 0, ;
	Name = "Pageframe1", ;
	Page1.FontSize = 11, ;
	Page1.Caption = "Page1", ;
	Page1.Name = "Page1", ;
	Page2.FontSize = 11, ;
	Page2.Caption = "Page2", ;
	Page2.Name = "Page2", ;
	Page3.Caption = "Page3", ;
	Page3.Name = "Page3", ;
	Page4.Caption = "Page4", ;
	Page4.Name = "Page4"

Add Object combo1 As ComboBox With ;
	Anchor = 768, ;
	Height = 25, ;
	Left = 159, ;
	ToolTipText = "TabOrientation", ;
	Top = 588, ;
	Width = 60, ;
	Name = "Combo1"

Add Object check1 As Checkbox With ;
	Top = 588, ;
	Left = 267, ;
	Height = 17, ;
	Width = 89, ;
	Anchor = 768, ;
	AutoSize = .T., ;
	Alignment = 0, ;
	BackStyle = 0, ;
	Caption = "SpecialEffect", ;
	MousePointer = 15, ;
	Name = "Check1"

Add Object optiongroup1 As OptionGroup With ;
	AutoSize = .T., ;
	ButtonCount = 3, ;
	Anchor = 768, ;
	BackStyle = 0, ;
	BorderStyle = 0, ;
	Value = 3, ;
	Height = 27, ;
	Left = 388, ;
	MousePointer = 15, ;
	Top = 584, ;
	Width = 219, ;
	Name = "Optiongroup1", ;
	Option1.Caption = "No img", ;
	Option1.Value = 0, ;
	Option1.Height = 17, ;
	Option1.Left = 5, ;
	Option1.Style = 0, ;
	Option1.Top = 5, ;
	Option1.Width = 61, ;
	Option1.AutoSize = .F., ;
	Option1.Name = "Option1", ;
	Option2.Caption = "no Captions", ;
	Option2.Height = 17, ;
	Option2.Left = 65, ;
	Option2.Style = 0, ;
	Option2.Top = 5, ;
	Option2.Width = 85, ;
	Option2.AutoSize = .T., ;
	Option2.Name = "Option2", ;
	Option3.Caption = "Default", ;
	Option3.Value = 1, ;
	Option3.Height = 17, ;
	Option3.Left = 153, ;
	Option3.Style = 0, ;
	Option3.Top = 5, ;
	Option3.Width = 61, ;
	Option3.AutoSize = .F., ;
	Option3.Name = "Option3"

Add Object check2 As Checkbox With ;
	Top = 589, ;
	Left = 618, ;
	Height = 17, ;
	Width = 157, ;
	Anchor = 768, ;
	AutoSize = .T., ;
	BackStyle = 0, ;
	Caption = "Tabs Random Backcolor ", ;
	MousePointer = 15, ;
	Name = "Check2"

Procedure ybind
Lparameters nButton, nShift, nXCoord, nYCoord
*--- aevent create an array laEvents
Aevents( myArray, 0)
*--- reference the calling object
loObject = myArray[1]
*messagebox(loObject.name)
oo="thisform.pageframe1.page"+  Right(Alltrim(loObject.Name) ,1)   &&if tabs<=9
ss=oo+".setfocus"
&ss
ss=oo+".activate"
&ss
ss=oo+".refresh"
&ss
Thisform.pageframe1.Resize
Endproc

Procedure Resize
Try
	With Thisform.pageframe1.Page1
		With .edit1
			.Anchor=15
			.Height = 229
			.Left = 11
			.Top = 20
			.Width = 361
			.Alignment=2
			.Visible=.T.
			.Name = "Edit1"
			TEXT TO .value noshow
	  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
	fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
	nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst. Nulla in iaculis nisi.
	Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non, porta congue dolor. Aenean viverra
	auctor sagittis. Integer lobortis dignissim auctor. Proin et volutpat massa.
			ENDTEXT
		Endwith
	Endwith

	With This.pageframe1.Page2
		With .image1
			.Anchor=15
			.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\CALLLAUR.BMP"
			.Height =2* Thisform.pageframe1.Height/3
			.Left = 95
			.Top = 44
			.Width = Thisform.pageframe1.Width/2
			.Stretch = 2
			.Visible=.T.
			Name = "Image1"
		Endwith
	Endwith

	With This.pageframe1.Page3
		With .command1
			.Picture=.Parent.Parent.Page2.image1.Picture
			.Anchor=15
			.Caption=""
			.Height =  Thisform.pageframe1.Height/2
			.Left = 47
			.Top = 32
			.Width = Thisform.pageframe1.Width/2
			.Visible=.T.
			.Name = "command1"
		Endwith
	Endwith

	With This.pageframe1.Page4
		With .image1
			.Anchor=15
			.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\BRIDJUST.BMP"
			.Height =2* Thisform.pageframe1.Height/3
			.Left = 95
			.Top = 44
			.Width = Thisform.pageframe1.Width/2
			.Stretch = 2
			.Visible=.T.
			Name = "Image1"
		Endwith
	Endwith
	Thisform.pageframe1.Resize
Catch
Endtry
Endproc

Procedure Init
Thisform.ShowTips=.T.
Thisform.yrback=.F.

With This.pageframe1.Page1
	.AddObject("edit1", "editbox")
	With .edit1
		.Anchor=15
		.Height = 229
		.Left = 11
		.Top = 20
		.Width = 361
		.Alignment=2
		.Visible=.T.
		.ScrollBars=0
		.Name = "Edit1"
		TEXT TO .value noshow
	  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
	fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
	nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst. Nulla in iaculis nisi.
	Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non, porta congue dolor. Aenean viverra
	auctor sagittis. Integer lobortis dignissim auctor. Proin et volutpat massa.
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
	fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
	nulla. Aenean ultrices eget lectus eu efficitur.
		ENDTEXT
	Endwith
Endwith

With This.pageframe1.Page2
	.AddObject("image1", "image")
	With .image1
		.Anchor=15
		.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\CALLLAUR.BMP"
		.Height =2* Thisform.pageframe1.Height/3
		.Left = 95
		.Top = 44
		.Width = Thisform.pageframe1.Width/2
		.Stretch = 2
		.Visible=.T.
		Name = "Image1"
	Endwith
Endwith

With This.pageframe1.Page3
	.AddObject("command1", "commandbutton")
	With .command1
		.Picture=.Parent.Parent.Page2.image1.Picture
		.Anchor=15
		.Caption=""
		.Height =  Thisform.pageframe1.Height/2
		.Left = 47
		.Top = 32
		.Width = Thisform.pageframe1.Width/2
		.Visible=.T.
		.Name = "command1"
	Endwith
Endwith

With This.pageframe1.Page4
	.AddObject("image1", "image")
	With .image1
		.Anchor=15
		.Picture=Home(1)+"SAMPLES\TASTRADE\BITMAPS\BRIDJUST.BMP"
		.Height =2* Thisform.pageframe1.Height/3
		.Left = 95
		.Top = 44
		.Width = Thisform.pageframe1.Width/2
		.Stretch = 2
		.Visible=.T.
		Name = "Image1"
	Endwith
Endwith
For i=1 To This.pageframe1.PageCount
	aa="thisform.ycom"+Transform(i)
	Bindevent(&aa,"mouseDown",Thisform,"ybind")
Endfor
Thisform.pageframe1.Resize
Endproc

Procedure Destroy
Clea Events
Endproc

Procedure pageframe1.Init
Thisform.AddProperty("oheight",36)
With This
	.Tabs = .T.
	xorientation=This.TabOrientation
	xtop=This.Top
	xwidth=This.Width/This.PageCount
	xheight=This.Height/This.PageCount

	For i=1 To This.PageCount
		This.Pages(i).Caption="yPage"+Trans(i)
		Thisform.AddObject("ycom"+Transform(i),"commandbutton")
		aa="thisform.ycom"+Trans(i)

		With Eval(aa)
			.WordWrap=.T.
			.ToolTipText=Eval("thisform.pageframe1.page"+Trans(i)+".caption")
			.FontSize=9
			Do Case
			Case m.xorientation=0    &&top
				.Top=xtop
				.Width=Int(xwidth)-1
				.Height=Thisform.oheight
				.Left=10+ Int((i-1)*xwidth)

			Case m.xorientation=1     &&bottom
				.Height=Thisform.oheight
				.Width=Int(xwidth)-1
				.Top=Thisform.pageframe1.Top+Thisform.pageframe1.Height-.Height
				.Left=10+ Int((i-1)*xwidth)

			Case m.xorientation=2 	  &&left
				.Top= Int(i-1)*xheight
				.Width=Thisform.oheight
				.Height=xheight
				.Left= Thisform.pageframe1.Left

			Case m.xorientation=3         &&right
				.Top= Int(i-1)*xheight
				.Width=Thisform.oheight
				.Height=xheight
				.Left= Thisform.pageframe1.Width
			Endcase
&&any small pictures or ico (16*16 pixels)
			Do Case
			Case  i=1
				.Picture=Home()+"graphics\icons\misc\lighton.ico"
			Case i=2
				.Picture=Home()+"graphics\icons\misc\misc15.ico"
			Case i=3
				.Picture=Home()+"graphics\icons\misc\binoculr.ico"
			Otherwise
				.Picture=Home()+"graphics\icons\misc\misc15.ico"
			Endcase
			.PicturePosition=7
			.Caption="yPage"+Trans(i)
			.ZOrder(0)
			.Visible=.T.
		Endwith
		This.Pages(i).Activate
	Endfor
	This.Resize()
Endwith
Endproc

Procedure pageframe1.Resize
DoDefault()
Local m.aa
Try
	With This
		xorientation=This.TabOrientation
		xtop=This.Top
		xwidth=This.Width/This.PageCount
		xheight=This.Height/This.PageCount

		For i=1 To This.PageCount
			This.Pages(i).Caption=""

			m.aa="thisform.ycom"+Trans(i)

			With Eval(m.aa)
				.Caption="yPage"+Trans(i)
&&any small pictures or ico (16*16 pixels)
				Do Case
				Case  i=1
					.Picture=Home()+"graphics\icons\misc\lighton.ico"
				Case i=2
					.Picture=Home()+"graphics\icons\misc\misc15.ico"
				Case i=3
					.Picture=Home()+"graphics\icons\misc\binoculr.ico"
				Otherwise
					.Picture=Home()+"graphics\icons\misc\clock01.ico"
				Endcase

				Do Case
				Case m.xorientation=0    &&top
					.Top=xtop
					.Width=Int(xwidth)-1
					.Height=Thisform.oheight
					.Left=10+ Int((i-1)*xwidth)
					.PicturePosition=0

				Case m.xorientation=1     &&bottom
					.Height=Thisform.oheight
					.Top=Thisform.pageframe1.Top+Thisform.pageframe1.Height-.Height
					.Width=Int(xwidth)-1
					.Left=10+ Int((i-1)*xwidth)
					.Pictureposition=0

				Case m.xorientation=2 	  &&left
					.Top= Int(i-1)*xheight
					.Width=Thisform.oheight
					.Height=xheight
					.Left= Thisform.pageframe1.Left
*vertical caption style
					.PicturePosition=8
					.WordWrap=.T.
					m.oo=""
					For j=1 To Len(.Caption)
						m.oo=m.oo+Substr(.Caption,j,1)+Chr(13)
					Endfor
					.Caption=m.oo

				Case m.xorientation=3         &&right
					.Top= Int(i-1)*xheight
					.Width=Thisform.oheight
					.Height=xheight
					.Left= Thisform.pageframe1.Left+Thisform.pageframe1.Width -.Width
*vertical caption style
					.PicturePosition=8
					.WordWrap=.T.
					m.oo=""
					For j=1 To Len(.Caption)
						m.oo=m.oo+Substr(.Caption,j,1)+Chr(13)
					Endfor
					.Caption=m.oo
				Endcase
				.ZOrder(0)
				.Visible=.T.
			Endwith
			This.Pages(i).Activate
		Endfor
		.Refresh
	Endwith

	Do Case
	Case  Thisform.optiongroup1.Value=1  &&no picture

		With This.Parent
			For i=1 To .ControlCount
				If Substr(Lower( .Controls(i).Name),1,4)=="ycom"
					.Controls(i).Picture=""
				Endi
			Endfor
		Endwith

	Case  Thisform.optiongroup1.Value=2  &&no caption
		With This.Parent
			For i=1 To .ControlCount
				If Substr(Lower(.Controls(i).Name),1,4)=="ycom"
					.Controls(i).Caption=""
				Endi
			Endfor
		Endwith
	Case  Thisform.optiongroup1.Value=3  &&default picture+caption
		DoDefault()
	Endcase

*random backcolors
	If Thisform.yrback=.T.
		With This.Parent
			For i=1 To .ControlCount
				If Substr(Lower( .Controls(i).Name),1,4)=="ycom"
					.Controls(i).BackColor=Rgb(255*Rand(),255*Rand(),255*Rand())
				Endi
			Endfor
		Endwith
	Else
		With This.Parent
			For i=1 To .ControlCount
				If Substr(Lower( .Controls(i).Name),1,4)=="ycom"
					.Controls(i).BackColor=Rgb(240,240,240)
				Endi
			Endfor
		Endwith
	Endi

Catch
Endtry
Thisform.Resize
Endproc

Procedure combo1.Click
With Thisform.pageframe1
	.TabOrientation=This.Value-1
	.Resize
Endwith
Endproc


Procedure combo1.Init
With This
	.AddItem("0 - top")
	.AddItem("1 - Bottom")
	.AddItem("2 - Left")
	.AddItem("3 - Right")
	.ListIndex=Thisform.pageframe1.TabOrientation+1
	.Value=Thisform.pageframe1.TabOrientation+1
	.Style=2
Endwith
Endproc


Procedure combo1.AddItem
Lparameters cItem
Endproc

Procedure check1.Click
With Thisform
	For i=1 To .ControlCount
		If Lower(Substr(.Controls(i).Name,1,4))=="ycom"
			.Controls(i).SpecialEffect=Iif(.Controls(i).SpecialEffect=2,0,2)
		Endi
	Endfor
	.pageframe1.Resize
Endwith
Endproc


Procedure optiongroup1.InteractiveChange
Thisform.pageframe1.Resize
Endproc

Procedure optiongroup1.Init
This.SetAll("backstyle",0,"optionButton")
This.Value=3  &&default
Endproc

Procedure check2.Click
With Thisform
	.yrback=!.yrback
	.pageframe1.Resize
Endwith
Endproc

Enddefine
*
*-- EndDefine: ypgf1


Playing with Pageframes orientations
Playing with Pageframes orientations
Playing with Pageframes orientations
Playing with Pageframes orientations

Important:All Codes above are tested on VFP9SP2 & windows 10 pro.

Please come back with any bug.correcting code is usefull to all readers.

To be informed of the latest articles, subscribe:
Comment on this post