Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting the taborder thru code
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Setting the taborder thru code
Divers
Thread ID:
00769739
Message ID:
00769739
Vues:
43
I have a client that is continuously wanting to add new tabs. I started out reordering the tabs manually and decide to do it thru code. Everything seem to be working find until one day I noted that the order was being thrown off when the tab started with the same letter. For example(x_page6,x_page11,x_page12 during design become x_page11,x_page12,x_page6 at run time. Here is my code below.

oForm = CREATEOBJECT("frmtaborder")
oForm.visible = .T.
READ EVENTS
**************************************************
*-- Class: ctaborder (c:\a1-cperdue\junk\tabcontrol\taborder.vcx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 03/25/03 09:38:00 AM
*
DEFINE CLASS frmtaborder AS form


Top = -1
Left = -1
Height = 185
Width = 288
DoCreate = .T.
Caption = "Form1"
WindowState = 0
Name = "ctaborder"


ADD OBJECT pgfordertabs AS pageframe WITH ;
ErasePage = .T., ;
PageCount = 12, ;
TabStretch = 0, ;
Top = 0, ;
Left = 0, ;
Width = 288, ;
Height = 144, ;
Name = "pgfOrderTabs", ;
Page1.Caption = "K_Page1", ;
Page1.Name = "Page1", ;
Page2.Caption = "C_Page2", ;
Page2.Name = "Page2", ;
Page3.Caption = "Z_Page3", ;
Page3.Name = "Page3", ;
Page4.Caption = "A_Page4", ;
Page4.Name = "Page4", ;
Page5.Caption = "B_Page5", ;
Page5.Name = "Page5", ;
Page6.Caption = "X_Page6", ;
Page6.Name = "Page6", ;
Page7.Caption = "Y_Page7", ;
Page7.Name = "Page7", ;
Page8.Caption = "D_Page8", ;
Page8.Name = "Page8", ;
Page9.Caption = "E_Page9", ;
Page9.Name = "Page9", ;
Page10.Caption = "F_Page10", ;
Page10.Name = "F_Page10", ;
Page11.Caption = "X_Page11", ;
Page11.Name = "Page11", ;
Page12.Caption = "X_Page12", ;
Page12.Name = "Page12"


ADD OBJECT command1 AS commandbutton WITH ;
Top = 156, ;
Left = 12, ;
Height = 25, ;
Width = 85, ;
Caption = "Quit", ;
Name = "Command1"


PROCEDURE m_settaborder
lPARAMETERS poObject, plCalledFromInit

Private i, nPageCount, nActivePage

THISFORM.LockScreen=.T.
With poObject

nPageCount = .PageCount
** nActivePage = .ActivePage
Dimension arrPageFrameCaption(nPageCount,2)

For i = 1 To nPageCount

With .Pages(i)
arrPageFrameCaption(i,1) = .Caption
arrPageFrameCaption(i,2) = i
.Refresh() && refresh this page only
Endwith

Next


=Asort(arrPageFrameCaption)

For i = 1 To nPageCount


With .Pages(i)
For j = 1 To nPageCount

If .Caption = arrPageFrameCaption(J,1)
.PageOrder = j
Endif
Next
.Refresh() && refresh this page only
Endwith
Next
Endwith

Thisform.LockScreen=.F.
ENDPROC


PROCEDURE pgfordertabs.Init
* sort the pageframe captions
THISFORM.m_settaborder(thisform.pgfOrderTabs )
ENDPROC


PROCEDURE command1.Click

CLEAR EVENTS
thisform.Release()
ENDPROC


ENDDEFINE
*
*-- EndDefine: ctaborder
**************************************************
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform