CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Location
    UAE
    Posts
    62

    [Question] How to get Data from Edit Class

    I Have two questions Regarding to Edit Class :

    Q1: If I want to input only integer Number to Edit Class. how can I Prevent user to input characters to Edit Class
    Q2 : How can I get data Input to Edit_Class
    Simply my Application is to create Edit_Classes to Let user provide the application Numbers

    Thanks & Regards

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: [Question] How to get Data from Edit Class

    Handle WM_CHAR message and check if the inputted character is a digit or not.
    You should also handle the case of a negative numbers if they are allowed: it means that the "minus" is allowed only as the first symbol in the control.
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: [Question] How to get Data from Edit Class

    Quote Originally Posted by mecheil.edwar View Post
    I Have two questions Regarding to Edit Class :

    Q1: If I want to input only integer Number to Edit Class. how can I Prevent user to input characters to Edit Class
    Q2 : How can I get data Input to Edit_Class
    Simply my Application is to create Edit_Classes to Let user provide the application Numbers

    Thanks & Regards
    A1: ES_NUMBER
    A2: GetDlgItemInt
    Best regards,
    Igor

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: [Question] How to get Data from Edit Class

    Only handling WM_CHAR is most likely not enough, you will also have to handle WM_PASTE.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  5. #5
    Join Date
    Jun 2012
    Location
    UAE
    Posts
    62

    Re: [Question] How to get Data from Edit Class

    Thanks to all for their effective replies,
    But still I have problem to get Real Number (as Example 23.334)
    If I can get any sample Example It will be better to clear using concpet

    My Best Regards to all

  6. #6
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: [Question] How to get Data from Edit Class

    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  7. #7
    Join Date
    Jun 2012
    Location
    UAE
    Posts
    62

    Re: [Question] How to get Data from Edit Class

    Thanks for VictorN , Igor and Marc for their answers ,

    I have other question , If I add Edit Class inside Dialog Class ,
    I found that WM_CHAR message is not working ,
    How I can get WM_CHAR Message from Dialog class to control char from dialog Box

    My Best Regards

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: [Question] How to get Data from Edit Class

    Victor Nijegorodov

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured