eyDown Event(Problem in detecting "SHIFT + 1")

Discussion in 'MFC' started by apremanandh, Nov 21, 2007.

  1. apremanandh

    apremanandh New Member

    Joined:
    Nov 21, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi friends,

    I working with MFC and i am a beginner also,
    I am Trying to validate an editbox (which take a phone number as input with starting character '+' should be allowed if user wishes).
    i am not able to block special characters(!,@,#,$,%,^,&,*,(,))

    Please help me to solve this problem. :confused:
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,374
    Likes Received:
    388
    Trophy Points:
    83
    you need to sub class the CEdit class and have your own event handler for the keypress / keydown event and then handle the characters accordingly. Also if you wish you can validate in the lost focus event there.
     
  3. apremanandh

    apremanandh New Member

    Joined:
    Nov 21, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Ok i tried out this logic and it works, but one problem, this nChar Param in OnKeyDown always showing the Capital letter Ascii only. any solution for that
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,374
    Likes Received:
    388
    Trophy Points:
    83
    That should not be the case unless you have caps lock on.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice