Link to home
Start Free TrialLog in
Avatar of lisa_mc
lisa_mcFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Form Focus

I am using C++ builder 6.0 and windows XP

I have a form with numerous edit boxes when the user inputs information to the edit box then presses X (i have used the keypress method of the edit box) I want to give focus to the form so that when the user presses X again something else will happen.

void __fastcall Tentermeters1form::MaskEdit1KeyPress(TObject *Sender,
      char &Key)
{
        if (Key == 'X')  // if user presses X the program will show the totals on the screen
        {
             //DO OTHER CLACULATIONS HERE  
             entermeters1form->SetFocus();

        }// end if Key == X
}

after all the calculations are done I want the form to receive focus but the above code doesnt work could anyone explain why?

Avatar of Anthony2000
Anthony2000
Flag of United States of America image

I noticed that you are testing 'X", are you pressing a lower case 'x' instead of an upper case one?
Avatar of lisa_mc

ASKER

No i am def pressing uppercase X because I have a mask over the edit box which only accepts numbers so when the user presses anything other than X and a number the program doesnt do anything
ASKER CERTIFIED SOLUTION
Avatar of George Tokas
George Tokas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lisa_mc

ASKER

Thanks guys got it sorted have accepted both solutions