Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Ding sound from ENTRY

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Ding sound from ENTRY
#8205
Posted by: el_supremo 2006-05-04 00:14:05
I have an ENTRY box into which the user types a four letter code. When I type a return key after entering those four character, windows plays the ding.wav sound. How do I get rid of that?

P.S. It dings whether or not the "want return" option is selected. I tried typing a TAB instead of enter but that doesn't cause the UNFOCUS event.
Message2. Re
#8212
Posted by: Jeff Glatt 2006-05-04 10:49:07
Did you send the ENTRY a message to limit the amount of text that can be entered to only 4 characters? If so, as I recall, when you press Enter, Windows considers that the fifth character and "dings" as an error indication. As I recall, the way to get rid of that is to have a default style PUSH button so the Enter gets siphoned off as a "click" on the button.




There's another alternative. Am I correct in assuming that your input window has only an ENTRY and nothing else in it? You're handling its UNFOCUS event, so when he types Enter, your UNFOCUS event is called and you grab the value of the ENTRY and close down the window?

Another alternative is to handle the "CHANGE" event for the ENTRY. Get the ENTRY's current value, and if the length is 4 characters, then do what you would have done in the UNFOCUS handling.

This way, as soon as he enters the fourth character, you're ready to go. He doesn't have to press ENTER. And you can even do pattern matching. For example, let's say that only one of your possible birds begins with the letters DO. As soon as you see that he has typed 2 letters, and they happen to be DO, then you already know which bird he wants. You can set the value of the ENTRY to the appropriate text, and then do what you need to do right then.

Assuming your ENTRY's variable is MyEntry, it would sort of be like this:
wm_change_myentry:
guigetctlvalue("MyEntry")
IF LENGTH(myentry) == 2 && myentry = "DO" THEN DO
    /* I know he wants the bird DOVE */
    myentry = "Dove"
    /* If you weren't going to destroy the window, you
     * may want to visually update the Entry as so:
     * GuiSetCtlValue("MyEntry")
     */
    SIGNAL useit
END
ELSE IF LENGTH(myentry) == 4 THEN DO
    /* He has finished entering all 4 chars */
useit:
    guidestroywindow()
    /* Here I go on to use this MyEntry selection */
END
/* Otherwise, do nothing */
RETURN
Message3. Re: Ding
#8218
Posted by: el_supremo 2006-05-05 01:18:09
Hi Jeff,
I have limited the input to 4 characters so, as you say, that's where the ding must be coming from. I tried setting it to 5 but the ding still occurred - even with "Want Return".
I have added a push button with Tabstop and Default. If I type a TAB at the end of the entry there's no ding. If I type a return it dings but takes the entry anyway.
I can live with that :-)

Pete
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,360.00 ·
 
 
¥271.00 ·
 
 
¥880.00 ·
 
 
¥980.00 ·
 
 
¥890.00 编辑
 
 
¥918.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0