Re: Navigation in menu with multiple columns
Vasilis Vlachoudis <[email protected]> Mon, 25 Sep 2023 08:05:23 +0000
| Newsgroups | gmane.comp.python.tkinter |
|---|---|
| Message-ID | <ZRAP278MB022115AF53B9E9A1E3AC2ED784FCA@ZRAP278MB0221.CHEP278.PROD.OUTLOOK.COM> |
--===============0416906364996685895== Content-Language: en-IE Content-Type: multipart/alternative; boundary="_000_ZRAP278MB022115AF53B9E9A1E3AC2ED784FCAZRAP278MB0221CHEP_" --_000_ZRAP278MB022115AF53B9E9A1E3AC2ED784FCAZRAP278MB0221CHEP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Great! Many thanks Michael! ________________________________ From: Michael Lange <[email protected]> Sent: Saturday 23 September 2023 19:08 To: Vasilis Vlachoudis <[email protected]> Cc: [email protected] <[email protected]> Subject: Re: [Tkinter-discuss] Navigation in menu with multiple columns Hi, On Tue, 19 Sep 2023 09:34:34 +0000 Vasilis Vlachoudis <[email protected]> wrote: > Using column breaks and sub-menus, makes navigation with the mouse > almost impossible. e.g. with the code below > > * open the menu > * hover the mouse over "one" > * hover the mouse over "Item #40" > * <Left-mouse-click> to select the submenu > * ... try to select in the new submenu "Item #40 : 2" with the mouse > > I cannot, since when I hover the mouse over the other items their > respective submenu opens. I can only selected it with the keyboard. you can avoid this by calling root.option_add('*Menu.clickToFocus', '1') immediately after creating the main Tk window. This doesn't seem to be documented, you can find the option in menu.tcl though. It is in the following code block in the Tk function ::tk::MenuMotion : set mode [option get $menu clickToFocus ClickToFocus] if {[string is false $mode]} { set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}] if {[$menu type $index] eq "cascade"} { set Priv(menuActivatedTimer) \ [after $delay [list $menu postcascade active]] } else { set Priv(menuDeactivatedTimer) \ [after $delay [list $menu postcascade none]] } So you see, if clickToFocus evaluates True, the call to postcascade does no= t occur. Have a nice day, Michael --_000_ZRAP278MB022115AF53B9E9A1E3AC2ED784FCAZRAP278MB0221CHEP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"= > <style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo= ttom:0;} </style> </head> <body dir=3D"ltr"> <div style=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, = Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" clas= s=3D"elementToProof"> Great! Many thanks Michael!</div> <div class=3D"elementToProof"> <div id=3D"Signature"> <div> <div style=3D"font-family:Tahoma; font-size:13px"> <div style=3D"font-family:Tahoma; font-size:13px"> <div style=3D"font-size:13px; font-family:Tahoma"> <div style=3D"font-size:13px; font-family:Tahoma"><font size=3D"1"><span st= yle=3D"font-family:Helvetica"><br> </span></font></div> </div> </div> </div> </div> </div> </div> <div id=3D"appendonsend"></div> <hr style=3D"display:inline-block;width:98%" tabindex=3D"-1"> <div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st= yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> Michael Lange <kla= [email protected]><br> <b>Sent:</b> Saturday 23 September 2023 19:08<br> <b>To:</b> Vasilis Vlachoudis <[email protected]><br> <b>Cc:</b> [email protected] <[email protected]><br= > <b>Subject:</b> Re: [Tkinter-discuss] Navigation in menu with multiple colu= mns</font> <div> </div> </div> <div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt;= "> <div class=3D"PlainText">Hi,<br> <br> On Tue, 19 Sep 2023 09:34:34 +0000<br> Vasilis Vlachoudis <[email protected]> wrote:<br> <br> > Using column breaks and sub-menus, makes navigation with the mouse<br> > almost impossible. e.g. with the code below<br> ><br> > * open the menu<br> > * hover the mouse over "one"<br> > * hover the mouse over "Item #40"<br= > > * <Left-mouse-click> to select the subme= nu<br> > * ... try to select in the new submenu "I= tem #40 : 2" with the mouse<br> ><br> > I cannot, since when I hover the mouse over the other items their<br> > respective submenu opens. I can only selected it with the keyboard.<br= > <br> you can avoid this by calling<br> <br> root.option_add('*Menu.clickToFocus', '1')<br> <br> immediately after creating the main Tk window. This doesn't seem to be<br> documented, you can find the option in menu.tcl though.<br> It is in the following code block in the Tk function ::tk::MenuMotion :<br> <br> <br> set mode= [option get $menu clickToFocus ClickToFocus]<br> if {[str= ing is false $mode]} {<br> &nb= sp; set delay [expr {[$menu cget -type] eq "menubar" = ? 0 : 50}]<br> &nb= sp; if {[$menu type $index] eq "cascade"} {<br> &nb= sp; set Priv(menuActivatedTimer) \<br> &nb= sp; [after $del= ay [list $menu postcascade active]]<br> &nb= sp; } else {<br> &nb= sp; set Priv(menuDeactivatedTimer) \<br= > &nb= sp; [after $del= ay [list $menu postcascade none]]<br> &nb= sp; }<br> <br> <br> <br> So you see, if clickToFocus evaluates True, the call to postcascade does no= t occur.<br> <br> Have a nice day,<br> <br> Michael<br> </div> </span></font></div> </body> </html> --_000_ZRAP278MB022115AF53B9E9A1E3AC2ED784FCAZRAP278MB0221CHEP_-- --===============0416906364996685895== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Tkinter-discuss mailing list [email protected] https://mail.python.org/mailman/listinfo/tkinter-discuss --===============0416906364996685895==--