Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Odd refresh of PageFrame
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Odd refresh of PageFrame
Divers
Thread ID:
00834802
Message ID:
00834802
Vues:
133
The following code uses some VFP8 features. It also shows a problem I have seen on 3 machines, 2 W2K the other XP Pro. All I need to do is click Next, Add, Next on these three workstations, the Add and Next buttons both have highlights around the caption in the command button. When I click and hold the Add button, it does not go down, however the click works. It is acting like a LockScreen is in effect. The grid doesn’t always fill in 100% everytime.

Anybody have a suggestion of what might be done to prevent this behavior?
*- Refresh the active screen
ON KEY LABEL F5 do RefreshForm IN 'C:\Work\Wizard.PRG'

oForm = CREATEOBJECT('form1')
oForm.Show(1)
ON KEY LABEL F5 

*- Clear the class that doesn't clear automatically
CLEAR CLASS cmgcmd

PROCEDURE RefreshForm
IF TYPE('_Screen.ActiveForm') = 'O'
   _Screen.ActiveForm.Refresh()
ENDIF
ENDPROC

DEFINE CLASS form1 AS form
	Caption = "Form1"
   ADD OBJECT pgf_COA as pgf_COA
   ADD OBJECT cmg_nav AS cmgnav

   PROCEDURE Init
      LOCAL lnHeight, lnAdjust
      WITH Thisform.pgf_COA
         lnHeight = .PageHeight
         .Tabs = .F. 
         lnAdjust = .PageHeight - lnHeight
         .Height = .Height - lnAdjust
         .SpecialEffect = 2
         .BorderWidth = 0
      ENDWITH
      ThisForm.Height = ThisForm.Height - lnAdjust
      ThisForm.cmg_Nav.Top = ThisForm.cmg_Nav.Top - lnAdjust
      *- VFP 8 feature
      =BINDEVENT(ThisForm.cmg_Nav.Command1,'Click',ThisForm,'ProcessNavClick')
      =BINDEVENT(ThisForm.cmg_Nav.Command2,'Click',ThisForm,'ProcessNavClick')
      =BINDEVENT(ThisForm.cmg_Nav.Command3,'Click',ThisForm,'ProcessNavClick')
      =BINDEVENT(ThisForm.pgf_COA.Page2.cmg_grp.Command1,'Click',ThisForm,'ProcessAcctClick')
      =BINDEVENT(ThisForm.pgf_COA.Page2.cmg_grp.Command2,'Click',ThisForm,'ProcessAcctClick')
      =BINDEVENT(ThisForm.pgf_COA.Page2.cmg_grp.Command3,'Click',ThisForm,'ProcessAcctClick')
      ThisForm.ActivatePage('A')
   ENDPROC

   PROCEDURE Load
      CREATE CURSOR acct (descript c(25), amount n(12,2), acct_key i)
      CREATE CURSOR acct_disp (rec_no i, descript c(25), amount n(12,2), acct_key i)
      APPEND BLANK IN Acct_Disp
   ENDPROC

   PROCEDURE ActivatePage
      LPARAMETERS lcPageType
      IF TYPE('lcPageType') <> 'C'
         RETURN
      ENDIF
      LOCAL lnPageNumber
      DO CASE 
      CASE lcPageType = 'A'
         *- Account
         lnPageNumber = 1
      CASE lcPageType = 'G'
         *- Group
         lnPageNumber = 2
      OTHERWISE
         RETURN 
      ENDCASE
      ThisForm.SetupPage(lnPageNumber)
      ThisForm.pgf_COA.ActivePage = lnPageNumber
      ThisForm.pgf_CoA.Pages(lnPageNumber).Refresh()
   ENDPROC

   PROCEDURE ProcessAcctClick
      LOCAL lnButton
      lnButton = ThisForm.pgf_COA.Page2.cmg_grp.Value
      DO CASE 
      CASE lnButton = 1
         *- Add
         APPEND BLANK IN Acct_Disp
         ThisForm.ActivatePage('A')
      CASE lnButton = 2
         *- Change
         ThisForm.ActivatePage('A')
      CASE lnButton = 3
         *- Delete
         DELETE FOR RECNO('Acct') == Acct_Disp.Rec_No IN Acct
         ThisForm.RefreshAcctGrid()
      ENDCASE
   ENDPROC

   PROCEDURE ProcessNavClick
      LOCAL lnButton
      lnButton = ThisForm.cmg_Nav.Value
      DO CASE
      CASE lnButton = 1
         *-- Next
         IF Thisform.pgf_COA.ActivePage = 1
            ZAP IN Acct_Disp
            ThisForm.ActivatePage('G')
         ELSE
            ThisForm.ActivatePage('A')
         ENDIF
      CASE lnButton = 2
         *-- Previous
         IF ThisForm.pgf_COA.ActivePage = 1
            ThisForm.ActivatePage('G')
         ELSE
            ThisForm.ActivatePage('A')
         ENDIF
      CASE lnButton = 3
         *-- Cancel
         ThisForm.Release()
      ENDCASE
   ENDPROC

   PROCEDURE RefreshAcctGrid
      LOCAL lnCursor
      lnCursor = SELECT()
      SELECT RECNO() as rec_no, * from Acct INTO CURSOR tempcursor
      SELECT acct_disp
      ZAP
      APPEND FROM DBF('tempcursor')
      USE IN SELECT('tempcursor')
      SELECT (lnCursor)
   ENDPROC

   PROCEDURE SaveAcctChanges
      LOCAL lnCursor, loUpdate
      lnCursor = SELECT()
      SELECT Acct_Disp
      SCAN ALL 
         SCATTER NAME loUpdate
         IF acct_disp.rec_no > 0
            SELECT Acct
            GO (acct_disp.rec_no)
            GATHER NAME loUpdate
            SELECT Acct_Disp
         ELSE
            *- VFP 8 feature
            INSERT INTO Acct FROM NAME loUpdate
         ENDIF
      ENDSCAN
      SELECT (lnCursor)
   ENDPROC

   PROCEDURE SetupPage
      LPARAMETERS lnPageNumber
      IF lnPageNumber = 2
         ThisForm.SaveAcctChanges()
         ThisForm.RefreshAcctGrid()
      ENDIF
   ENDPROC
ENDDEFINE

DEFINE CLASS pgf_COA AS pageframe 
		ErasePage = .T.
		PageCount = 0
		Top = 0
		Left = 0
		Width = 372
		Height = 204
		Name = "pgf_COA"
      ADD OBJECT Page1 AS Page1
      ADD OBJECT Page2 AS Page2
ENDDEFINE

DEFINE CLASS page1 as Page
   Caption = "Page1"
   Name = "Page1"
   ADD OBJECT label1 AS label1 WITH ;
		Caption = "Account Page", ;
		Left = 145, ;
		Top = 7, ;
		Width = 77, ;
		Name = "Label1"
	ADD OBJECT label2 AS label1 WITH ;
		Caption = "Description:", ;
		Left = 13, ;
		Top = 30, ;
		Width = 68, ;
		Name = "Label2"
	ADD OBJECT text1 AS textbox WITH ;
		ControlSource = "Acct_Disp.Descript", ;
		Height = 23, ;
		Left = 83, ;
		Top = 26, ;
		Width = 258, ;
		Name = "Text1"
	ADD OBJECT label3 AS label1 WITH ;
		Caption = "Amount:", ;
		Left = 34, ;
		Top = 54, ;
		Width = 47, ;
		Name = "Label3"
	ADD OBJECT text2 AS textbox WITH ;
		ControlSource = "Acct_Disp.Amount", ;
		Height = 23, ;
		Left = 83, ;
		Top = 54, ;
		Width = 100, ;
		Name = "Text2"
ENDDEFINE

DEFINE CLASS Page2 As Page
   Caption = "Page2"
   Name = "Page2"
	ADD OBJECT label1 AS label1 WITH ;
		Caption = "Group page", ;
		Left = 150, ;
		Top = 7, ;
		Width = 67, ;
		Name = "Label1"
   ADD OBJECT grd_acct AS grdAcct
   ADD OBJECT cmg_grp  AS cmggrp
ENDDEFINE

DEFINE CLASS label1 as Label
      AutoSize = .T.
      BackStyle = 0
      Height = 17
ENDDEFINE

DEFINE CLASS grdAcct as Grid
	ColumnCount = 0
	DeleteMark = .F.
	Height = 110
   HighlightRowLineWidth = 0
	Left = 24
	Panel = 1
	RecordMark = .F.
	RecordSource = "Acct_Disp"
   ScrollBars = 2
	SplitBar = .F.
	Top = 27
	Width = 320
	GridLineColor = RGB(192,192,192)
   ADD OBJECT Column1 AS Column1
   ADD OBJECT Column2 AS Column2
ENDDEFINE

DEFINE CLASS Column1 AS Column
   ControlSource = "acct_disp.descript"
   Width = 223
   Name = "Column1"
	ADD OBJECT header1 AS header WITH ;
		Caption = "Description", ;
		Name = "Header1"
	ADD OBJECT text1 AS gridtextbox 
ENDDEFINE

DEFINE CLASS Column2 AS Column
   ControlSource = "acct_disp.amount"
   Name = "Column2"
	ADD OBJECT header1 AS header WITH ;
		Caption = "Amount", ;
		Name = "Header1"
	ADD OBJECT text1 AS gridtextbox 
ENDDEFINE

DEFINE CLASS gridtextbox as TextBox
   BorderStyle = 0
   Margin = 0
ENDDEFINE

DEFINE CLASS cmg AS CommandGroup 
   AutoSize = .F.
   BackStyle = 0
   ButtonCount = 0
   Value = 1
   Height = 37
   Width = 212
ENDDEFINE
 
DEFINE CLASS cmgcmd as CommandButton
   AutoSize = .F.
   Top = 5
   Height = 27
   Width = 66
ENDDEFINE

DEFINE CLASS cmggrp as cmg
	Left = 133
	Top = 138
   ADD OBJECT Command1 AS cmgcmd WITH ;
	   Caption = "Add", ;
      Left = 5, ;
	   Name = "Command1"
   ADD OBJECT Command2 AS cmgcmd WITH ;
	   Left = 73, ;
	   Caption = "Change", ;
	   Name = "Command2"
   ADD OBJECT Command3 AS cmgcmd WITH ;
	   Left = 141, ;
	   Caption = "Delete", ;
	   Name = "Command3"
ENDDEFINE

DEFINE CLASS cmgnav as cmg
   Left = 162
   Top = 210
   ADD OBJECT Command1 AS cmgcmd WITH ;
      Left = 5, ;
      Caption = 'Previous', ;
      Name = 'Command1'
   ADD OBJECT Command2 AS cmgcmd WITH ;
      Left = 73, ;
      Caption = 'Next', ;
      Name = 'Command2'
   ADD OBJECT Command3 AS cmgcmd WITH ;
      Left = 141, ;
      Caption = 'Cancel', ;
      Name = 'Command3'
ENDDEFINE
Tracy
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform