ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Tcl-core
Tcl-core
Re: [TCLCORE] Re: TIP #158: Distinguish the two 'Enter' keys on Windows
by =?ISO-8859-1?Q?Fr=E9d=E9ric_Bonnet?= other posts by this author
Sep 26 2003 8:30AM messages near this date
[TCLCORE] Re: TIP #158: Distinguish the two 'Enter' keys on Windows | [TCLCORE] Re: TIP #158: Distinguish the two 'Enter' keys on Windows
Benjamin Riefenstahl wrote:
>  Hi Frédéric,
>  
>  Frédéric Bonnet <frederic.bonnet@[...].com> writes:
>  
> >bind all <Mod4-Return> {event generate %W <KP_Enter>}
>  
>  
>  I am not sure that you can generate key events that don't have any
>  native representation (the implementation is supposed to supply a
>  native keycode for the event).  Not to mention that [event generate]
>  is mostly unimplemented on Mac until now, at least for key events.

The prerequisite would be of course to implement KP_Enter on Windows, 
which is feasible according to the Win32 doco: although WM_CHAR and 
friends give the same character code in wParam for Return and Enter, 
lParam carries flags that can tell whether the key is an extended key 
(bit #24); in this case Return isn't and Enter is.

But the solution I had in mind was rather to implement Enter as KP_Enter 
code then to generate Return events by default on Windows :

	bind all <KP_Enter>  {event generate %W <Return>}

In this case, no need for Mod4. Moreover, KP_Enter would be available on 
all platforms. Last, Return bindings would work as usual. This can also 
be done on a per-widget basis, given that we use the regular bindtags 
mechanism. The risk would be to call both handlers for KP_Enter and 
Return, as applications willing to clearly separate KP_Enter from Return 
would have to break explicitly at the end of their event script.

Of course this doesn't solve the problem on the Mac, but I think the 
real priority here would be to complete the implementation of [event 
generate] on this platform.

But if we want to keep the Mod4 idea, I suggest we choose a more 
explicit name (or give it an alias) such as <Num-Return>  because this 
would also allow distinct bindings to the other numpad keys (useful for 
games).

----- Small digression
What is the purpose of the Mod4 modifier on common keyboards: does it 
already serve to distinguish numpad keys? Does a Mod4 key exist on some 
keyboards or is it purely abstract? If some keyboards provide a Mod4 
key, wouldn't using the Mod4 modifier for the numpad enter key 
potentially conflict with combining this key and the regular return key? 
Perhaps I'm thinking too hard :-/
-----

Moreover, only the X version of Tk would have to re-route <Num-Return>  
to <KP_Enter>  to preserve compatibility. Windows & Mac would be happy. 
This is certainly a cleaner solution as in this case only the X platform 
needs this feature and it seems more logical for a platform to 
explicitly require a feature than for all other platforms to explicitly 
disable a cross-platform feature that violates their UI guidelines. 
Perhaps this could also be integrated in tk_strictMotif ?



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Benjamin Riefenstahl
=?ISO-8859-1?Q?Fr=E9d=E9ric_Bonnet?=
Benjamin Riefenstahl
George Howlett
Benjamin Riefenstahl
George Howlett
Vince Darley
Joe English
Vince Darley

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved