Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clicked Control in Page in PageFrame Still 'Visible' when new page is activated 2

Status
Not open for further replies.

dylim

Programmer
Dec 12, 2001
106
PH
Hi Experts,

I have a pageframe with 2 pages. One containing a grid (pagGrid) and 3 commandbuttons for New, Edit and Delete. The second one (pagRecord) is a bunch of textboxes for data entry and commandbuttons for Save and Cancel.

If user clicks on say New in pagGrid, it will do an APPEND BLANK and activate pagRecord to start encoding of data. Clicking on Save or Cancel will perform the appropriate action and go back to pagGrid.

Here is the strange behavior - if one clicks on New, which will activate pagRecord, the New button still is 'visible'!

The same happens also when one clicks on Save or Cancel. Page pagGrid is activated alright, but Save or Cancel still is 'visible'.

I have tried setting BackStyle property to Opaque and Transaparent, to no avail.

I have included screenshots for a better appreciation.
Screenshot_2022-07-17_154438_zbfwtk.png
Screenshot_2022-07-17_154521_tmtz6r.png


Thanks in advance!
 
It sounds like the "New" button is not actually on the pageframe, but has been placed directly on the form but is in front of the pageframe.

You can easily check that by going to the properties windows. Look for the button in the drop-down list at the top of the window. That will show you where the button sits within the containership hierarchy.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

All the commandbuttons are inside each page sir. I have attached images of the hierarchy. Weird huh?


Screenshot_2022-07-17_171933_ecv7v4.png


Screenshot_2022-07-17_172058_spciff.png
 
Is this a visual effect hangover?

I think I would delete the control and remake it, or perhaps play with it a little, move it

Just in case there are two controls, on on the form and one in the page frame

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
GriffMG / Mike,

If I click any of New, Edit, Delete, Save or Cancel commandbuttons, the clicked one will still show up when a new page is activated. It is there visually, but is not tclickable. It will go away if you tab or click on any of the enabled controls in the page.

I just bumped into a similar problem. In fact, Mike also participated in that particular thread.

Here is the code that re-created what I meant:


[pre]Local oForm
oForm = CREATEOBJECT("clsBleedingCheckBox")
oForm.SHOW()
Read EVENTS

Define CLASS clsBleedingCheckBox AS FORM
DoCreate = .T.
AutoCenter = .T.
Caption = "Bleeding and Non-bleeding checkboxes"

Add OBJECT pgfMain AS clsPageFrame WITH;
PAGECOUNT = 2, ;
LEFT = 10, ;
TOP = 10, ;
WIDTH = THIS.WIDTH - 20, ;
HEIGHT = THIS.HEIGHT - 60

Add OBJECT cmdRevert AS COMMANDBUTTON WITH;
CAPTION = "Revert", ;
LEFT = 10, ;
TOP = THIS.pgfMain.TOP+THIS.pgfMain.HEIGHT + 10, ;
AUTOSIZE = .T.

Procedure DESTROY
Clear EVENTS
Endproc

Procedure cmdRevert.CLICK
Thisform.pgfMain.ACTIVEPAGE = 1
Endproc

Enddefine

Define CLASS clsPageFrame AS PAGEFRAME
PageCount = 2
page1.CAPTION = "Main Page"
page2.CAPTION = "Page with checkboxes"

Procedure page2.INIT
With THIS
.ADDOBJECT("chkBleed","clsChkBleed")
.ADDOBJECT("chkNoBleed","clsChkNoBleed")
Endwith
Endproc
Enddefine

Define CLASS clsChkBleed AS CHECKBOX
Caption = "Bleeds through"
AutoSize = .T.
Top = 10
Left = 10
Visible = .t.

Procedure INTERACTIVECHANGE
* Pre test condition code...
If THIS.VALUE == 0
Thisform.cmdRevert.CLICK
Endif
* Post test condition code...
Endproc
Enddefine

Define CLASS clsChkNoBleed AS CHECKBOX
Caption = "Doesn't bleed through"
AutoSize = .T.
Top = 40
Left = 10
Visible = .t.

Procedure CLICK
* Pre test condition code...
If THIS.VALUE == 0
Thisform.cmdRevert.CLICK
Endif
* Post test condition code...
Endproc
Enddefine[/pre]
 
Dylim, I ran that code, but I'm not seeing the behaviour you are seeing. As far as I can see, it works as expected.

That said, there is a lot of information in that other thread. It will be worth the time to study it. I'd also try Griff's suggestion (if you haven't already done so) of deleting and remaking the control.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike,

Funny, I ran that code which shows the bug (the bleeding checkbox). It was discussed in that thread as well.

Only difference is my issue are commandbuttons.

I will try doing Griff's suggestion though.

Thanks.
 
Dylim,

Quite interesting.

So, the difference between the two behaviors is the event being used: InteractiveChange triggers the bleeding effect, Click does not.

When I changed the controls from checkboxes to command buttons, I could not see how to bleed the control into the newly activated page. The interaction performed as expected.

Can you provide a snippet with command buttons that demonstrate the behavior you're observing?
 
Hi ATLOPES,

Below is the code. It surely won't run as is, as it is tightly coupled with my dataentry form. But you surely can follow the code.

Basically, the Click() of the New, Edit, Delete, Save and Cancel buttons call the pageframe method to refresh the appropriate controls and activate any of the 2 pages pagRecord (which can contain textboxes and entry and the Save and Cancel buttons) and pagBrowse ( which has a grid and New, Edit, Delete buttons).

So, when click any of New, Edit, Delete... it will shift to the pagRecord page. When you click any of these, that button will be the one still appearing. Same with Save and Cancel, which reverts back to pagBrowse.

[pre]**************************************************
*-- Class: pgfchildrecs (d:\vfpxdev\common\classes\uitier.vcx)
*-- ParentClass: pgfdata (d:\vfpxdev\common\classes\uitier.vcx)
*-- BaseClass: pageframe
*-- Time Stamp: 07/17/22 07:48:09 PM
*
#INCLUDE "d:\vfpxdev\common\includes\system.h"
*
DEFINE CLASS pgfchildrecs AS pgfdata

ErasePage = .T.
PageCount = 2
BorderWidth = 2
Width = 366
Height = 191
Tabs = .F.
*-- Must be determined before Init
cursorsourcex = ""
noregisterdatacontrol = .F.
*-- 0-Top, 1-Left, 3-Right, 4-Bottom
dockposition = 0
mode = "XXX"
Name = "pgfchildrecs"
_page1.Caption = "Record Page"
_page1.BackStyle = 0
_page1.Name = "pagRecord"
_page2.Caption = "Grid Page"
_page2.BackStyle = 0
_page2.Name = "pagGrid"


ADD OBJECT pgfchildrecs.pagrecord.shpborder AS _3dline WITH ;
Top = 5, ;
Left = 1, ;
Height = 4, ;
Width = 356, ;
Anchor = 15, ;
BorderWidth = 2, ;
FillColor = RGB(0,0,255), ;
BorderColor = RGB(0,0,255), ;
ZOrderSet = 0, ;
Name = "shpBorder"


ADD OBJECT pgfchildrecs.pagrecord.cmdsave AS cmdbutton WITH ;
Top = 152, ;
Left = 197, ;
Anchor = 12, ;
Caption = "Ok", ;
TabIndex = 2, ;
ZOrderSet = 1, ;
enabledx = .F., ;
Name = "cmdSave"


ADD OBJECT pgfchildrecs.pagrecord.cmdcancel AS cmdbutton WITH ;
Top = 152, ;
Left = 276, ;
Anchor = 12, ;
Caption = "Cancel", ;
TabIndex = 3, ;
ZOrderSet = 2, ;
enabledx = .F., ;
Name = "cmdCancel"


ADD OBJECT pgfchildrecs.pagrecord.cntcursornav AS cntcursornav WITH ;
Anchor = 6, ;
Top = 148, ;
Left = 6, ;
TabIndex = 1, ;
ZOrderSet = 3, ;
Name = "cntCursorNav", ;
cmdTop.Name = "cmdTop", ;
cmdPrior.Name = "cmdPrior", ;
cmdNext.Name = "cmdNext", ;
cmdBottom.Name = "cmdBottom"


ADD OBJECT pgfchildrecs.pagrecord.lbltag AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Record", ;
Height = 17, ;
Left = 118, ;
Top = 154, ;
Visible = .F., ;
Width = 42, ;
TabIndex = 4, ;
ZOrderSet = 4, ;
Name = "lblTag"


ADD OBJECT pgfchildrecs.pagrecord.lblcaption AS _label WITH ;
FontBold = .T., ;
Anchor = 3, ;
BackStyle = 1, ;
Caption = " lblCaption ", ;
Left = 12, ;
Top = 0, ;
ForeColor = RGB(0,0,255), ;
BackColor = RGB(255,255,255), ;
ZOrderSet = 5, ;
Name = "lblCaption"


ADD OBJECT pgfchildrecs.paggrid.shpborder AS _3dline WITH ;
Top = 6, ;
Left = 1, ;
Height = 3, ;
Width = 356, ;
Anchor = 15, ;
ZOrderSet = 0, ;
Name = "shpBorder"


ADD OBJECT pgfchildrecs.paggrid.cmdaddchild AS cmdtoolbar WITH ;
Top = 18, ;
Left = 329, ;
Anchor = 8, ;
Picture = "..\graphics\_plus.bmp", ;
ToolTipText = "Add New Detail Record", ;
Name = "cmdAddChild"


ADD OBJECT pgfchildrecs.paggrid.cmdeditchild AS cmdtoolbar WITH ;
Top = 40, ;
Left = 329, ;
Anchor = 8, ;
Picture = "..\graphics\_pencil.bmp", ;
StatusBarText = "Edit selected detail record.", ;
TabIndex = 3, ;
ToolTipText = "Edit Detail Record", ;
ZOrderSet = 2, ;
Name = "cmdEditChild"


ADD OBJECT pgfchildrecs.paggrid.cmddeletechild AS cmdtoolbar WITH ;
Top = 62, ;
Left = 329, ;
Anchor = 8, ;
Picture = "..\graphics\_minus.bmp", ;
StatusBarText = "Delete selected detail record.", ;
TabIndex = 4, ;
ToolTipText = "Delete Detail Record", ;
ZOrderSet = 3, ;
Name = "cmdDeleteChild"


ADD OBJECT pgfchildrecs.paggrid.lblcaption AS _label WITH ;
FontBold = .T., ;
Anchor = 3, ;
BackStyle = 1, ;
Caption = " lblCaption ", ;
Left = 12, ;
Top = 0, ;
TabIndex = 5, ;
ZOrderSet = 4, ;
Name = "lblCaption"


ADD OBJECT pgfchildrecs.paggrid.lbltag AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Grid", ;
Height = 17, ;
Left = 327, ;
Top = 162, ;
Visible = .F., ;
Width = 25, ;
TabIndex = 6, ;
ZOrderSet = 5, ;
Name = "lblTag"


ADD OBJECT pgfchildrecs.paggrid.grdchildrecs AS grdbrowser WITH ;
MemberClassLibrary = "base.prg", ;
Height = 159, ;
Left = 10, ;
TabIndex = 1, ;
Top = 18, ;
Width = 319, ;
ZOrderSet = 6, ;
Name = "grdChildRecs"

PROCEDURE newchildrec
LOCAL lcAlias

This.Mode = REFCODE_ADDMODE
ThisForm.oBizObject.New( This.CursorSourceX )
This.RefreshControls()
ENDPROC


PROCEDURE editchildrec
LOCAL llOk, lcErrorText, lcAlias

llOk = .F.

lcAlias = This.pagGrid.grdChildRecs.RecordSource

* Error Check

DO CASE
CASE EOF( lcAlias )
lcErrorText = "No records to view or edit."
*!* CASE RECNO( lcAlias ) # This.grdChildRecs.GridRecno
*!* lcErrorText = "No selected record to view."
OTHERWISE
llOk = .T.
ENDCASE

IF NOT llOk
MESSAGEBOX( lcErrorText, MSG_OK + MSG_ICON_STOP, This.Class + " EditChildRec() Error" )
RETURN llOk
ENDIF

* Execution Proper

This.Mode = REFCODE_EDITMODE
This.RefreshControls()
ENDPROC


PROCEDURE deletechildrec
LOCAL llOk, lcErrorText, lcAlias

llOk = .F.

lcAlias = This.pagGrid.grdChildRecs.RecordSource

* Error Check

DO CASE
CASE EOF( lcAlias )
lcErrorText = "No records to delete."
*!* CASE RECNO( lcAlias ) # This.grdChildRecs.GridRecno
*!* lcErrorText = "No selected record to view."
OTHERWISE
llOk = .T.
ENDCASE

IF NOT llOk
MESSAGEBOX( lcErrorText, MSG_OK + MSG_ICON_STOP, This.Class + " DeleteChildRec() Error" )
RETURN llOk
ENDIF

* Execution Proper

This.Mode = REFCODE_DELETEMODE
This.RefreshControls()
ENDPROC


PROCEDURE viewchildrec
LOCAL llOk, lcErrorText, lcAlias

llOk = .F.

lcAlias = This.pagGrid.grdChildRecs.RecordSource

* Error Check

DO CASE
CASE EOF( lcAlias )
lcErrorText = "No records to view."
*!* CASE RECNO( lcAlias ) # This.grdChildRecs.GridRecno
*!* lcErrorText = "No selected record to view."
OTHERWISE
llOk = .T.
ENDCASE

IF NOT llOk
MESSAGEBOX( lcErrorText, MSG_OK + MSG_ICON_STOP, This.Class + " ViewChildRec() Error" )
RETURN llOk
ENDIF

* Execution Proper

This.Mode = REFCODE_VIEWMODE
This.RefreshControls()
ENDPROC

PROCEDURE refreshdatacontrols
This.Pages( This.ActivePage ).SetAll( "RefreshX", .T. )
ENDPROC


PROCEDURE refreshcontrols
LOCAL loPage, llEnable, lcCaption, llLockScreen

llLockScreen = ThisForm.LockScreen
ThisForm.LockScreen = .T.

* Refresh Controls

DO CASE

CASE This.Mode = REFCODE_ADDMODE
This.pagRecord.cmdSave.Caption = "Save"
This.pagRecord.cmdCancel.Caption = "Cancel"
This.pagRecord.cmdSave.Visible = .T.
This.pagRecord.cntCursorNav.Visible = .F.
llEnable = .T.
loPage = This.pagRecord

CASE This.Mode = REFCODE_EDITMODE
This.pagRecord.cmdSave.Caption = "Save"
This.pagRecord.cmdCancel.Caption = "Cancel"
This.pagRecord.cmdSave.Visible = .T.
This.pagRecord.cntCursorNav.Visible = .F.
llEnable = .T.
loPage = This.pagRecord

CASE This.Mode = REFCODE_DELETEMODE
This.pagRecord.cmdSave.Caption = "Delete"
This.pagRecord.cmdCancel.Caption = "Cancel"
This.pagRecord.cmdSave.Visible = .T.
This.pagRecord.cntCursorNav.Visible = .F.
llEnable = .F.
loPage = This.pagRecord

CASE This.Mode = REFCODE_VIEWMODE
This.pagRecord.cmdCancel.Caption = "Close"
This.pagRecord.cmdSave.Visible = .F.
This.pagRecord.cntCursorNav.Visible = .T.
llEnable = .F.
loPage = This.pagRecord

OTHERWISE
llEnable = .F.
loPage = This.pagGrid

ENDCASE

This.ActivePage = loPage.PageOrder

This.RefreshDataControls()
This.EnableDataControls( llEnable )

IF loPage = This.pagRecord
lcCaption = ThisForm.oBizObject.GetCursorProp( "UICaption", This.CursorSourceX )
This.pagRecord.lblCaption.Caption = SPACE(2) + lcCaption + SPACE(2) +"- ["+ This.Mode +"]"
ENDIF

ThisForm.LockScreen = llLockScreen
ENDPROC


PROCEDURE confirmaction
* Do note that this is always used for children tables!
* We do away with Child Forms na

LOCAL llSaveOk, lcMessage, lcFirstErrorField, llBackToGrid

DO CASE

CASE This.Mode = REFCODE_ADDMODE

llSaveOk = ThisForm.oBizObject.Save( .T., This.CursorSourceX ) && does validation

IF llSaveOk

ThisForm.HasNewChildChanges = .T.

lcMessage = "Record saved. Continue adding new records?"
IF MESSAGEBOX( lcMessage, MSG_YESNO + MSG_ICON_QUESTION + MSG_DEFAULT_2ND, ThisForm.Caption ) = MSG_REPLY_YES
This.NewChildRec() && loops back
ELSE
llBackToGrid = .T.
ENDIF

ELSE

MESSAGEBOX( ThisForm.oBizObject.ErrorMessage, MSG_ICON_STOP + MSG_OK, ThisForm.Caption )

lcFirstErrorField = ThisForm.oBizObject.GetCursorProp( "FirstErrorField", This.CursorSourceX )
IF NOT EMPTY( lcFirstErrorField )
This.pagRecord.SetAll( "Focus", lcFirstErrorField )
ENDIF

ENDIF

CASE This.Mode = REFCODE_EDITMODE

llSaveOk = ThisForm.oBizObject.Save( .T., This.CursorSourceX ) && does validation

IF llSaveOk

ThisForm.HasNewChildChanges = .T.
llBackToGrid = .T.

ELSE

MESSAGEBOX( ThisForm.oBizObject.ErrorMessage, MSG_ICON_STOP + MSG_OK, ThisForm.Caption )

lcFirstErrorField = ThisForm.oBizObject.GetCursorProp( "FirstErrorField", This.CursorSourceX )
IF NOT EMPTY( lcFirstErrorField )
This.pagRecord.SetAll( "Focus", lcFirstErrorField )
ENDIF

ENDIF

CASE This.Mode = REFCODE_DELETEMODE

* 1 - get confirmation
lcMessage = "Deleting will cause this record to be lost forever. Are you really sure?"
IF MESSAGEBOX( lcMessage, MSG_YESNO + MSG_ICON_EXCLAIM + MSG_DEFAULT_2ND, ThisForm.Caption ) = MSG_REPLY_NO
RETURN
ENDIF

* 2 - actual delete operation; assumes record loaded already
llSaveOk = ThisForm.oBizObject.Delete( This.CursorSourceX )

IF llSaveOk
ThisForm.HasNewChildChanges = .T.
llBackToGrid = .T.
ELSE
lcMessage = "Unable to delete selected record."
MESSAGEBOX( lcMessage, MSG_OK + MSG_ICON_STOP, ThisForm.Caption )
ENDIF

ENDCASE

IF llBackToGrid
This.Mode = "XXX"
This.RefreshControls()
ENDIF
ENDPROC


PROCEDURE cancelaction
LOCAL loCursorObject, lnMsgButtons, lcFirstFocusField, llBackToGrid

DO CASE

CASE This.Mode = REFCODE_ADDMODE

loCursorObject = ThisForm.oBizObject.GetCursorObject( This.CursorSourceX )

IF loCursorObject.HasUnsavedChanges() AND NOT loCursorObject.IsNewAndEmpty()

lnMsgButtons = MSG_YESNO + MSG_ICON_QUESTION + MSG_DEFAULT_2ND

IF MESSAGEBOX( "Discard new record?", lnMsgButtons, ThisForm.Caption ) = MSG_REPLY_YES
IF NOT loCursorObject.Undo( .T. ) && ThisForm.UndoRecord() - not main
MESSAGEBOX( "Unable to undo record.", MSG_OK + MSG_ICON_STOP, .Caption )
ENDIF
llBackToGrid = .T.
ELSE
lcFirstFocusField = ThisForm.oBizObject.GetCursorProp( "FirstFocusField", This.CursorSourceX )
IF NOT EMPTY( lcFirstFocusField )
This.pagRecord.SetAll( "Focus", lcFirstFocusField )
ENDIF
ENDIF

ELSE

loCursorObject.Undo( .T. ) && ThisForm.UndoRecord() - not main
llBackToGrid = .T.

ENDIF

CASE This.Mode = REFCODE_EDITMODE

loCursorObject = ThisForm.oBizObject.GetCursorObject( This.CursorSourceX )

IF loCursorObject.HasUnsavedChanges()

lnMsgButtons = MSG_YESNO + MSG_ICON_QUESTION + MSG_DEFAULT_2ND

IF MESSAGEBOX( "Discard changes?", lnMsgButtons, ThisForm.Caption ) = MSG_REPLY_YES
IF NOT loCursorObject.Undo( .T. ) && ThisForm.UndoRecord() - not main
MESSAGEBOX( "Unable to undo record.", MSG_OK + MSG_ICON_STOP, ThisForm.Caption )
ENDIF
llBackToGrid = .T.
ELSE
lcFirstFocusField = ThisForm.oBizObject.GetCursorProp( "FirstFocusField", This.CursorSourceX )
IF NOT EMPTY( lcFirstFocusField )
This.pagRecord.SetAll( "Focus", lcFirstFocusField )
ENDIF
ENDIF

ELSE

loCursorObject.Undo( .T. ) && ThisForm.UndoRecord() - not main
llBackToGrid = .T.

ENDIF

OTHERWISE
llBackToGrid = .T.

ENDCASE

IF llBackToGrid
This.Mode = "XXX"
This.RefreshControls()
ENDIF
ENDPROC


PROCEDURE aligncontrols
* Align Controls

LOCAL lnAnchor, llLockScreen

llLockScreen = ThisForm.LockScreen
ThisForm.LockScreen = .T.

This.BorderWidth = 0

* Record Page

WITH This.pagRecord.lblCaption
lnAnchor = .Anchor
.Top = 0
.Left = 12
.Anchor = 0
.Anchor = lnAnchor
ENDWITH

WITH This.pagRecord.shpBorder
lnAnchor = .Anchor
.Top = 6
.Left = 3
.Width = This.Width - ( .Left * 2 )
.Height = This.Height - ( .Top * 2 )
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 1 )
ENDWITH

WITH This.pagRecord.cmdSave
lnAnchor = .Anchor
.Top = This.pagRecord.shpBorder.Top + This.pagRecord.shpBorder.Height - .Height - 10
.Left = This.pagRecord.shpBorder.Left + This.pagRecord.shpBorder.Width - .Width - This.pagRecord.cmdCancel.Width - 20
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 0 )
ENDWITH

WITH This.pagRecord.cmdCancel
lnAnchor = .Anchor
.Top = This.pagRecord.shpBorder.Top + This.pagRecord.shpBorder.Height - .Height - 10
.Left = This.pagRecord.cmdSave.Left + This.pagRecord.cmdSave.Width + 6
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 0 )
ENDWITH

WITH This.pagRecord.cntCursorNav
lnAnchor = .Anchor
.Top = This.pagRecord.shpBorder.Top + This.pagRecord.shpBorder.Height - .Height - 10
.Left = This.pagRecord.shpBorder.Left + 10
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 0 )
ENDWITH

* Grid Page -- we are doing relative positioning

WITH This.pagGrid.lblCaption
lnAnchor = .Anchor
.Top = 0
.Left = 12
.Anchor = 0
.Anchor = lnAnchor
ENDWITH

WITH This.pagGrid.shpBorder
lnAnchor = .Anchor
.Top = 6
.Left = 3
.Width = This.Width - ( .Left * 2 )
.Height = This.Height - ( .Top * 2 )
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 1 )
ENDWITH

WITH This.pagGrid.grdChildRecs
lnAnchor = .Anchor
.Top = 22
.Left = 14
.Width = This.pagGrid.shpBorder.Width - ( .Left * 2 ) - This.pagGrid.cmdAddChild.Width + 4
.Height = This.pagGrid.shpBorder.Height - ( .Top - This.pagGrid.shpBorder.Top ) * 2 + 2
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 0 )
ENDWITH

WITH This.pagGrid.cmdAddChild
lnAnchor = .Anchor
.Top = This.pagGrid.grdChildRecs.Top
.Left = This.pagGrid.grdChildRecs.Left + This.pagGrid.grdChildRecs.Width + 4
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 0 )
ENDWITH

WITH This.pagGrid.cmdEditChild
lnAnchor = .Anchor
.Top = This.pagGrid.cmdAddChild.Top + This.pagGrid.cmdAddChild.Height + 4
.Left = This.pagGrid.grdChildRecs.Left + This.pagGrid.grdChildRecs.Width + 4
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 0 )
ENDWITH

WITH This.pagGrid.cmdDeleteChild
lnAnchor = .Anchor
.Top = This.pagGrid.cmdEditChild.Top + This.pagGrid.cmdEditChild.Height + 4
.Left = This.pagGrid.grdChildRecs.Left + This.pagGrid.grdChildRecs.Width + 4
.Anchor = 0
.Anchor = lnAnchor
.ZOrder( 0 )
ENDWITH

ThisForm.LockScreen = llLockScreen
ENDPROC


PROCEDURE enabledatacontrols
LPARAMETERS tlEnable

LOCAL loCursor, llLockScreen

WITH This.pagRecord

* llLockScreen = ThisForm.LockScreen
* ThisForm.LockScreen = .T.

.SetAll( "EnabledX", tlEnable )

IF tlEnable
loCursor = ThisForm.oBizObject.GetCursorObject( This.CursorSourceX )
IF NOT EMPTY( loCursor.FirstFocusField )
.SetAll( "Focus", loCursor.FirstFocusField )
ENDIF
ENDIF

* ThisForm.LockScreen = llLockScreen
loCursor = NULL

ENDWITH
ENDPROC

PROCEDURE Init
LOCAL llOk, lcErrorText, lcCaption

llOk = .F.

* Error Check

DO CASE
CASE EMPTY( This.CursorSourceX )
lcErrorText = "CursorSourceX property not specified."
CASE VARTYPE( This.CursorSourceX ) # "C"
lcErrorText = "CursorSourceX must be character type."
OTHERWISE
llOk = .T.
ENDCASE

IF NOT llOk
MESSAGEBOX( lcErrorText, MSG_OK + MSG_ICON_STOP, This.Name +" - "+ This.Class + " Init Error" )
RETURN llOk
ENDIF

* Execution Proper

This.AlignControls()
This.ActivePage = This.pagGrid.PageOrder
ENDPROC

PROCEDURE cmdsave.Click
This.Parent.Parent.ConfirmAction()
ENDPROC


PROCEDURE cmdcancel.Click
This.Parent.Parent.CancelAction()
ENDPROC


PROCEDURE cntcursornav.navigated
This.Parent.Parent.RefreshDataControls()
ENDPROC


PROCEDURE cmdaddchild.Click
This.Parent.Parent.NewChildRec()
ENDPROC

PROCEDURE cmdeditchild.Click
This.Parent.Parent.EditChildRec()
ENDPROC

PROCEDURE cmddeletechild.Click
This.Parent.Parent.DeleteChildRec()
ENDPROC

ENDDEFINE
*
*-- EndDefine: pgfchildrecs
**************************************************
[/pre]
 
Hi Guys,

This is what I did as a work-around.

In the Deactivate event of each page, I made the 'offending' button's Visible to .F., and made them to .T. in the Activate event.

Thanks for all the insights and ideas offered.
 
Hi Mike,

Thank you for the attention.. and those who helped as well.. so weird really...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top