×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Sep 2003
    Location
    Bangalore,India.
    Posts
    63

    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

  2. #2
    Registered User
    Join Date
    Oct 2003
    Posts
    30
    hi,

    I too have a same problem..


    Anish Agarwal

  3. #3
    Regular Contributor
    Join Date
    Nov 2005
    Location
    India
    Posts
    101

    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

  4. #4
    Super Contributor
    Join Date
    Jul 2004
    Location
    Romania
    Posts
    560

    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 Originally Posted by 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×