Yup!  That's the one.  I'm embarassed that it was so simple - but thanks very
much!
Thanks too to the other respondents, who assumed that I'm a lot smarter than I
am!
Mark

Greg Nixon wrote:

> All I would do is say
>
> procedure OnExit
>    if not BtnSave.Focused then
>       DoSetFocusCode;
>
> -----Original Message-----
> From: Mark Howard <[EMAIL PROTECTED]>
> To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> Date: Monday, 15 February 1999 13:56
> Subject: Re: [DUG]: Control of Focus
>
> Sorry - wasn't specific enough.
>
> I have a ComboBox some EditBoxes and a Save Button.
> I want to be able to Select an item from the ComboBox list; press Tab to
> move to
> an EditBox determined by code (not necessarily the next on) BUT if I click
> on
> the Save button instead of pressing Tab I want it to execute the Save code.
>
> My problem is that the code determining the next EditBox is in the ONExit
> event
> and so also captures the Save button click.
> I have tried putting the code to detect the Tab into the OnKeyPress event
> but
> that seems to already have been fired by the selection of the list item.
>
> Any other suggestions would be gratefully received
>
> Mark
> Greg Nixon wrote:
>
> > One way would be to set the tag property on each control in the normal
> entry
> > order then use and on exit like:
> >
> >    if TEdit(Sender).Tag < ActiveControl.Tag then
> >       Label1.Caption := 'Forward'
> >    else
> >        Label1.Caption := 'Back';
> >
> > To know where to process the validation code or not.
> >
> > -----Original Message-----
> > From: Mark Howard <[EMAIL PROTECTED]>
> > To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> > Date: Monday, 15 February 1999 09:16
> > Subject: [DUG]: Control of Focus
> >
> > Hi
> > Newbie question.
> >
> > I have a form with several edit boxes.
> >
> > In order to make it efficient for data entry I have some code attached
> > to the OnExit event of some of the boxes which decides which is the next
> > box that should receive focus, when Tab is pressed.
> >
> > This works fine for a normal entry sequence, but if something goes wrong
> > and the user needs to use the mouse to reselect an earlier box, or
> > wishes to click Save before cycling through the rest of the fields then
> > the OnExit event will override the mouse click, and merely set focus to
> > the edit box specified in the code.
> >
> > How can I achieve this automatic moving to a specific box on pressing
> > Tab but allow a mouse click on a different control to have precedence?
> >
> > Thanks
> >
> > Mark
> >
> > --------------------------------------------------------------------------
> -
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> >
> > --------------------------------------------------------------------------
> -
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
>
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
>
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to