From: Kevin W. <kw...@co...> - 2011-03-04 01:35:06
|
On 3/3/11 11:16 AM, Kevin Walzer wrote: > I'm making substantial process on my library to add Cocoa NSToolbars to > Tk windows. At present the library creates the toolbar, populates it > with buttons, images, labels, tooltips, etc., and passes commands on to > the Tcl interpreter to execute. So far, so good. > > I am running into an unexpected issue, however. The toolbar appears to > mess up the tracking of mouse coordinates in the Tk widgets. For > instance, in a test script with a ttk entry, the entry does not gain > focus when the mouse pointer is directly over it, but rather about 54 > pixels higher on the screen. With some trial and error, I can force > focus to the entry with this binding: > > bind all<Button-1> {focus -force [winfo containing %X [expr %Y - 54]]} > > However, that only sets focus on the entry field, not its insertion > point, nor does the cursor change to a text insert cursor when hovered > directly over the entry, but rather when it is located about 50 pixels > above it. > > Additionally, a button command does not fire when the button is pressed, > but rather when<Button-1> is pressed about 50 pixels above the button. > > I think I understand what is going on here: the toolbar is part of the > window chrome, not Tk's widgets, and it takes up a lot of real estate. I > believe default Tk-Mac window geometry is based on a height of 22 pixels > for the title bar, after which Tk's real estate beings. > > What would be the right way to fix this? Override some of the default > bindings for widgets with some cursor mapping procedure as above, or is > there a different solution I'm not thinking of? > > --Kevin > > Looks like I can achieve the required effect on a widget-by-widget basis, but there does not appear to be any general procedure or variable I can set at a global level that will get the job done. -- Kevin Walzer Code by Kevin http://www.codebykevin.com |