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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Befre-/After-RowColChange event query

Status
Not open for further replies.

StewartUK

Programmer
Feb 19, 2001
860
GB
I have this code in the BeforeRowColChange
Code:
MbReply = MESSAGEBOX("Do you want to save the changes you made")
IF MbReply = Mb_Cancel
  NODEFAULT
ELSE && Yes or No
  IF MbReply = Mb_Yes
    .cmdChangesSave.MyClick()
    .FormSetup()
  ENDIF
ENDIF
...and this in the AfterRowColChange event:
Code:
IF INLIST(THIS.RowColChange, 1, 3)
  THISFORM.FormSetup()
ENDIF

Form method FormSetup changes the values of a number of other objects on the form as the user goes up and down the grid.

This all works fine, except when the user clicks Yes on the messagebox. When that happens, the grid property RowColChange is 1 in the BeforeRCC but becomes 0 when the AfterRCC fires and so the method FormSetup doesn't run and the objects are refreshed.

Is there a fix for this situation?

Thanks,

Stewart

Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Stewart,
when i run
Code:
CODE
MbReply = MESSAGEBOX("Do you want to save the changes you made")
?mbreply
from the command box, I always get mbreply=1, could this be part of the problem?
wjwjr
 
Apart from others' ideas I think you're probably moving focus out of the grid and thus lots of other extra events occurring.

Marcia Akins posted a way to validate records in a grid on a different web-site.
 
Thanks for your replies.

Really sorry - I've realised that the line that I reported as running the messagebox is not the same as I'm using. I am using 3 (Yes/No/Cancel) as the second parameter and trapping that into variable MbReply.

Ilyad - thanks for your tip. Which website was it?

Thanks,

Stewart
 
Ilyad - yes of course. The focus is going to the CommandButton "cmdChangesSave" and then coming back to the grid. When it comes back, effectively the row hasn't changed.

I changed it to how I should have set it up to start with - having a method in the class that I generally use for updating tables and getting the BeforeRCC event to call that, meaning that the grid never loses focus and everything is now OK.

Star to you :)

Stewart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top