How to set focus programatically to a control on a form?
Hi All,
I want to set focus to a contro programatically based on some
data validation. For example inside 'OkToExitL()' I want to validate the data enterted on a form and set focus to a control that has invalid data. I have tried something like this :
CEikEdwin* myEdwin = STATIC_CAST(CEikEdwin*,ControlOrNull
(EEnhAgnCreateMeetingDlgCtrlIdTextEditor02));
myEdwin->SetFocus(ETrue);
myEdwin->DrawNow();
What I observed is that the 'caret' is moving to my edit control but the focus indicator - black rectagle is not drawn and keyboard input is going to another control which had focus earlier.
Are there any additional APIs to call?
Regards,
Sreenivasulu Y
Re: How to set focus programatically to a control on a form?
Can anybody tell me how to set focus on different controls like labels,buttons and how to trigger events related to these controls
Thanks
Regards
phonynk
Re: How to set focus programatically to a control on a form?
You have to do 2 things...first remove the focus from the provious focused control (use SetFocus(EFalse, EDrawNow) for this)
Second give the focus to the new component (SetFocus(ETrue, EDrawNow))
The way you get pointers to your controls it's up to you
[QUOTE=sreenivasuluy]Hi All,
I want to set focus to a contro programatically based on some
data validation. For example inside 'OkToExitL()' I want to validate the data enterted on a form and set focus to a control that has invalid data. I have tried something like this :
CEikEdwin* myEdwin = STATIC_CAST(CEikEdwin*,ControlOrNull
(EEnhAgnCreateMeetingDlgCtrlIdTextEditor02));
myEdwin->SetFocus(ETrue);
myEdwin->DrawNow();
What I observed is that the 'caret' is moving to my edit control but the focus indicator - black rectagle is not drawn and keyboard input is going to another control which had focus earlier.
Are there any additional APIs to call?
Regards,
Sreenivasulu Y[/QUOTE]