Change WindowEvent() and WaitWindowEvent() functionality

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Change WindowEvent() and WaitWindowEvent() functionality

Post by fsw »

The commands WindowEvent() and WaitWindowEvent() seem to intervene the TAB keyboard key.
I work with a edit custom control and all seems to work fine except that the TAB key doesn't work (doesn't pass through the custom control).

If I use Windows API like:
(example)

Code: Select all

While GetMessage_(msg.MSG, #NULL, 0, 0 ) 
  TranslateMessage_(msg) 
  DispatchMessage_(msg) 
Wend
instead of WindowEvent() or WaitWindowEvent() all works fine.
Last edited by fsw on Mon Sep 27, 2004 5:54 pm, edited 2 times in total.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

A possible answer from the PB manual:
Add or replace a keyboard shortcut to the specified #Window. A shortcut generates a menu event (like a menu item) as most of them are used in conjonction with menus. The EventID is the number which will be returned by the EventMenuID() command. By default, a window already has the #PB_Shorcut_Tab and #PB_Shortcut_Tab|#PB_Shortcut_Shift shortcuts to handle tab and shift-tab correctly trough the gadgets. A shortcut can be removed with RemoveKeyboardShortcut().
:?:
--Kale

Image
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: WindowEvent() and WaitWindowEvent() BUG

Post by PB »

> I work with a edit custom control and all seems to work fine except that the
> TAB key doesn't work (doesn't pass through the custom control).

Try PolyVector's TabStop tip, and apply it to the custom control:

viewtopic.php?t=12388

Should fix the problem. (BTW, this isn't a bug, since you're using a custom
control that PureBasic doesn't natively support). ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

The tab key is automatically added to each window as a shortcut to jump
between the gadgets. Shortcuts are processed before passing on the
Message to the WindorProc it belongs to, that's why you get nothing.

With RemoveKeyboardShortcut() you can remove this easily.

The reason why your api code works is that it doesn't call TranslateAccelerator_(), which handles the shortcuts.

Timo
quidquid Latine dictum sit altum videtur
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Kale wrote:A possible answer from the PB manual:
Add or replace a keyboard shortcut to the specified #Window. A shortcut generates a menu event (like a menu item) as most of them are used in conjonction with menus. The EventID is the number which will be returned by the EventMenuID() command. By default, a window already has the #PB_Shorcut_Tab and #PB_Shortcut_Tab|#PB_Shortcut_Shift shortcuts to handle tab and shift-tab correctly trough the gadgets. A shortcut can be removed with RemoveKeyboardShortcut().
:?:
Kale,
I don't won't to ADD the TAB key.
It's already there.... but not working because of PB.

EDIT: you are right, there it says:
  • By default, a window already has the #PB_Shorcut_Tab and #PB_Shortcut_Tab|#PB_Shortcut_Shift shortcuts to handle tab and shift-tab correctly trough the gadgets.
I missed that.
Now I stand corrected too... :wink:
Thanks
Last edited by fsw on Mon Sep 27, 2004 10:55 pm, edited 1 time in total.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: WindowEvent() and WaitWindowEvent() BUG

Post by fsw »

PB wrote:> I work with a edit custom control and all seems to work fine except that the
> TAB key doesn't work (doesn't pass through the custom control).

Try PolyVector's TabStop tip, and apply it to the custom control:

viewtopic.php?t=12388

Should fix the problem. (BTW, this isn't a bug, since you're using a custom
control that PureBasic doesn't natively support). ;)
PB,
no offence, but you are wrong.
This has nothing to do with a specific custom control, it's just an example.
It's PB that is cutting off the messages from the os...

Thanks
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

freak wrote:The tab key is automatically added to each window as a shortcut to jump
between the gadgets. Shortcuts are processed before passing on the
Message to the WindorProc it belongs to, that's why you get nothing.

With RemoveKeyboardShortcut() you can remove this easily.

The reason why your api code works is that it doesn't call TranslateAccelerator_(), which handles the shortcuts.

Timo
Timo,
just looked at the manual and you are right:
  • By default, a window already has the #PB_Shorcut_Tab and #PB_Shortcut_Tab|#PB_Shortcut_Shift shortcuts to handle tab and shift-tab correctly trough the gadgets. A shortcut can be removed with RemoveKeyboardShortcut().
But nevertheless, IMO the way it is now, is not OK.
Normally if the user wants special functionality like: shortcuts to handle tab and shift-tab correctly trough the gadgets, this should be added through a command or through a parameter for WaitWindowEvent() and WindowEvent(), and not automatically added.

Like: WaitWindowEvent(#PB_ADD_GADGETS_TAB)


Maybe I should add this to the PB_Wishlist.

Thanks

EDIT: maybe WaitWindowEvent(#PB_USE_DIALOGSTYLE_TABS) is better, but it's up to the PureBasic Coding Team
Last edited by fsw on Mon Sep 27, 2004 6:10 pm, edited 1 time in total.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

BTW:
@FREAK,
If you are a admin you could move this topic to the WISHLIST section.

Thanks
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Jumping between Gadgets with the Tab key is basic functionality, why should
everybody be required to add that on his own?
quidquid Latine dictum sit altum videtur
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

freak wrote:Jumping between Gadgets with the Tab key is basic functionality, why should
everybody be required to add that on his own?
No it's not.
At least not for normal Windows.
It's a special functionality from a Dialog Window.

PureBasic doesn't have DialogWindow(...)
But that is another story... :wink:

EDIT: @Freak: Thanks for moving...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: WindowEvent() and WaitWindowEvent() BUG

Post by PB »

> PB, no offence, but you are wrong.

No offence taken at all. :)

> This has nothing to do with a specific custom control, it's just an example.

Well you did say that Tab didn't pass through a custom control, so that's why
I thought it wasn't working, because PureBasic didn't recognize the control.

> It's PB that is cutting off the messages from the os...

Yep, I've read Freak's explanation, and I stand corrected.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: WindowEvent() and WaitWindowEvent() BUG

Post by fsw »

PB wrote:... and I stand corrected.
me too... every morning when I look in the mirror 8O

I am to provide the public with beneficial shocks.
Alfred Hitshock
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Hope this wish makes it in v4...
Post Reply