Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Capturing Text from text box with Enter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Capturing Text from text box with Enter

    I have the following code snippet.
    I can get text from it just fine, but I need to
    capture it after the user presses enter.
    It's just in the Test stage, that's why the msgbox.

    SUB enterKey()
    CONTROL ADD TEXTBOX, hDlg, %id_Company, "", 68, 17, 42, 12, %ES_WANTRETURN, %WS_EX_LEFT CALL EnterKeyCallBack
    CONTROL SET FOCUS hDlg,%Id_Company
    END SUB

    CALLBACK FUNCTION EnterKeyCallBack
    CONTROL GET TEXT hDlg, %ID_Company TO key$
    'IF %IDOK AND LEN(key$) THEN
    IF len(key$)=6 THEN
    MSGBOX key$
    END IF
    END FUNCTION

    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

  • #2
    you can get the on change messages sent to the textbox, but not the key as its pressed without subclassing that control.
    lance posted an excellent example on this awhile back.

    the wmsg& you are interested in is wm_char. wparam& holds the ascii value of the key pressed.


    ------------------

    Comment

    Working...
    X