CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2011
    Location
    Greece
    Posts
    26

    C++ builder 2007, scan in edit with barcode scanner

    Goodmorning

    I have a simple application with one edit inside. So the user in this edit use a barcode scanner and scan. I have the above code

    if(Key == '\n' ||Key == '\r')

    checkCustomer();

    So when it scans everything is ok. but when the user put a number from keyboard or letter i want to bring a message to him to use scanner with else.

    all the code is on
    Edit1KeyDown event

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

    Re: C++ builder 2007, scan in edit with barcode scanner

    Quote Originally Posted by Leite333 View Post
    ... I have the above code
    But I don't see any code "above"!
    Nor is there some code below! (well, two lines of some pseudo-code that do not make any sense!)
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2011
    Location
    Greece
    Posts
    26

    Re: C++ builder 2007, scan in edit with barcode scanner

    Goodmorning
    Here is some code i wrote. No much things. I want the user to use a scanner barcode and scan on edit. If he use scanner everything is ok. but if he use keyboard copy paste letters on numbers i want to bring a message to use scanner. I wrote the above but its not right. I wrote this code onkeypress event of Edit.. any help?

    #
    if(Key == '\n' ||Key == '\r') {
    MessageDlg("THANK YOU FOR USE SCANNER",mtInformation,TMsgDlgButtons()<<mbOK,0);

    else
    {
    MessageDlg("TRY SCANNER",mtInformation,TMsgDlgButtons()<<mbOK,0);
    Edit1->Clear();
    Edit1->SetFocus() ;
    }
    #

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

    Re: C++ builder 2007, scan in edit with barcode scanner

    I don't see any "onkeypress" code here, nor is your code properly formatted!
    Please, read the Announcement... first: http://forums.codeguru.com/announcement.php?f=9
    Victor Nijegorodov

  5. #5
    Join Date
    Mar 2011
    Location
    Greece
    Posts
    26

    Arrow Re: C++ builder 2007, scan in edit with barcode scanner

    if(Key == '\n' ||Key == '\r')
    MessageDlg("THANK YOU FOR USE SCANNER",mtInformation,TMsgDlgButtons()<<mbOK,0);

    else
    {
    MessageDlg("TRY SCANNER",mtInformation,TMsgDlgButtons()<<mbOK,0);
    Edit1->Clear();
    Edit1->SetFocus() ;
    }




    this is my code and its onkeypress event of edit1
    you dont need to answer if you dont wanna help
    Last edited by Leite333; October 19th, 2012 at 03:01 AM.

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

    Re: C++ builder 2007, scan in edit with barcode scanner

    Well, if you ignore all my requests to clarify your problem then I should give up.
    Good luck!
    Victor Nijegorodov

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

    Re: C++ builder 2007, scan in edit with barcode scanner

    Quote Originally Posted by Leite333 View Post
    I wrote the above but its not right.
    Would you explain how you know that it's not right? Just what you do and what you get. Did you debug your code? Is the handler really fired?

    Besides, you have to inspect the Key value and see what data comes in it. You really sure there must be '\n' or 'r' and not virtual key codes?

    And the last but not least. There's no need to be rude with the people that are trying to help. If you see they fail to understand you, you re-phrase, or provide some more detailed description, but keep being nice.
    Best regards,
    Igor

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