1. Beeping EditText

I'm creating a Quake-style console window with an EditText control at 
the bottom of the window and an MLE occupying the rest of the window. 
This window is a child to a frame window, which is used to simulate an 
MDI environment. Typing a command and pressing Enter sends the command 
off to the command parser and interpreter. 

However, when you press Enter in the EditText control (single-line) 
Windows beeps (it plays the Default sound in whatever the current 
Windows theme is). In the C++ version of the app I was able to stop this 
by using IsDialogMessage() in the message loop and trapping the 
WM_KEYDOWN message there. I’ve tried this in the Eu version by checking 
for the event with w32HEvent. I’ve also tried trapping the w32HKeyDown 
event for the frame window as well as the console window. 

When I changed the EditText control to an MLE control the same size as a 
single line EditText control, the beep went away but carriage-return 
char was always prepended to the next command. I could probably work 
around that quirk as long as it stays consistent but I don’t want to do 
that unless I have to.

The command parser and interpreter work fine, it just gets annoying 
hearing that beep when ever enter is pressed in the command control. 
Anyone have any ideas on how to stop this?

new topic     » topic index » view message » categorize

2. Re: Beeping EditText

Hi,
here is one way to do it. Basically it says that whenever an enter key is
pressed, tell windows to ignore it.

----------
procedure KeyPress_Sle1(integer self, integer event, sequence parms)
    if parms[1] = VK_RETURN then
        returnValue(0)
    end if
end procedure
setHandler(Sle1, w32HKeyPress, routine_id("KeyPress_Sle1"))
------------

----------------
cheers,
Derek Parnell
----- Original Message -----
From: "Raudaun Long" <LilFreak02_ at hotmail.com>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, March 02, 2003 5:03 AM
Subject: Beeping EditText


>
> I'm creating a Quake-style console window with an EditText control at
> the bottom of the window and an MLE occupying the rest of the window.
> This window is a child to a frame window, which is used to simulate an
> MDI environment. Typing a command and pressing Enter sends the command
> off to the command parser and interpreter.
>
> However, when you press Enter in the EditText control (single-line)
> Windows beeps (it plays the Default sound in whatever the current
> Windows theme is). In the C++ version of the app I was able to stop this
> by using IsDialogMessage() in the message loop and trapping the
> WM_KEYDOWN message there. I’ve tried this in the Eu version by checking
> for the event with w32HEvent. I’ve also tried trapping the w32HKeyDown
> event for the frame window as well as the console window.
>
> When I changed the EditText control to an MLE control the same size as a
> single line EditText control, the beep went away but carriage-return
> char was always prepended to the next command. I could probably work
> around that quirk as long as it stays consistent but I don’t want to do
> that unless I have to.
>
> The command parser and interpreter work fine, it just gets annoying
> hearing that beep when ever enter is pressed in the command control.
> Anyone have any ideas on how to stop this?
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Beeping EditText

On Sat,  1 Mar 2003 23:29:10 +0000, Raudaun Long <LilFreak02_ at hotmail.com> 
wrote:

>
> Any idea why w32HKeyPress works correctly but not w32HKeyDown? The body 
> of the handler procedure is identical to what you wrote (i'm sure you 
> meant returnValue(-1) though) except instead of VJ_RETURN i just tested 
> for 13. i know that had nothing to do with it so it must have been the 
> event i was trapping.

I think you can use KeyDown for this, but you must also trap the 
corresponding KeyUp event, plus its not just a matter of calling 
returnValue(-1) either. You have to get Windows to ignore the keystroke by 
some other method. The KeyPress is a lot easier. You can also get KeyPress 
to substitute alternate values. This is a neat way of forcing uppercase, 
for example.

  x= find(parms[1], LowerCaseChars)
  if x then
     returnValue( UpperCaseChars[x] )
  end if

-- 

cheers,
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu