Re: win32lib pronlem

new topic     » goto parent     » topic index » view thread      » older message » newer message

The proper solution for making a dialog is to use DefPushButton (and CancelButton) instead of PushButton. They will intercept the Enter and Escape key events automatically. You just need to set your w32HClick handler.

Win32Lib said...

DefPushButton

Default command button control.

A DefPushButton is a PushButton, but is displayed with an extra border indicating that this button will automatically be selected if the user presses the Return button on the keyboard.


CancelButton

Command button that reacts to the Escape key.

A CancelButton is a PushButton, but is displayed with italic font indicating that this button will automatically be selected if the user presses the Escape key.

You can use registerHotKey() to associate a key code (e.g. VK_ESCAPE) to a control. I know its description says "ALT-key combination" but that's left over from when it was only for applying mnemonics (e.g. "&New" -> "New").

Win32Lib said...

registerHotKey ( integer id, object caption )

Allows you to associate a ALT-key combination to set focus to a control.

Any control or Window can have any number of hotkeys registered.
id is the control/window id returned by create()
caption is either a single keycode, or a string containing a '&' character.
If using a keycode, you must use the keycode names in w32Keys.e. If using a string, the uppercase version of the character following the '&' is used. Note that this is happens automatically when you create() a control with some caption text. Also, the default pushbutton, if any, is automatically registered with VK_RETURN.

If you want to handle this manually, use w32HKeyDown instead of w32HKeyUp. Typically "click" events are triggered on mouse up and key down. Then use invokeHandler() to trigger w32HClick instead of sendMessage().

Win32Lib said...

w32HKeyDown

Key is pressed.

parms = {integer keyCode, integer shift}

The keyCode is "raw" value of the key. The primary purpose of onKeyDown is to trap "special" keys not reported by onKeyPress.


invokeHandler ( integer id, integer event, sequence params)

Triggers a Win32Lib event.

Returns: OBJECT: The value set by returnValue() if called inside

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu