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

Toolbar grid textbox apply change to current line

Status
Not open for further replies.
Sep 17, 2001
673
US
I am stumped with this toolbar not getting focus issue. As you may be aware when clicking a button on a toolbar such as 'SAVE', the toolbar button does not take get the focus. So if I am editing a value in a grid textbox then click save, the cursor bound to the grid does not see the current records change since I have not hit enter or tab to change from edit to browse mode. What is the best way to tell the cursor/grid to collect the value currently being edited programatically?

Regards,

Rob
 

Rob,

One solution would be to explicitly set focus back to the control from the toolbar button:

TRY
_SCREEN.ActiveForm.ActiveControl.SetFocus
CATCH
ENDRY

The reason I have error-trapped that code is in case there is no form open, or the open form does not have an active control. Those conditions would otherwise produce an error.

You can put that code in any toolbar button (or menu command) where it is important for focus to leave the control, such as a Save button.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top