From: Daniel A. S. <st...@ic...> - 2001-08-28 08:51:45
|
Ryan, sorry for the delay in answering, I only just discovered the solution to this problem myself... At 14:22 -0400 on 15/8/01, Ryan Casey wrote: >I have a procedure that implements a popup box using a >overrideredirected toplevel. > >The item it is attached to is bound to kill it upon leaving or >motion (<Leave> or <Motion>), and to restart the timer for the popup >after motion is complete or upon enter (<Motion> or <Enter>). > >My problem is that the bound item (an image on a canvas) is getting >a <Leave> event when the popup comes up (which causes the popup to >close), then an Enter when the popup closes (which restarts the >popup). This is sending my popup box into a loop of ><Leave><Enter><Leave><Enter><...> I just had to solve this problem myself for a tk mac port here that uses the # Simple Balloon Help Package by # Robin Becker ro...@je... # Stewart Inglis si...@lu... Fri Apr 4 08:57:43 1997 # This is version 0.1 indeed the 'bind $w <Any-Leave> "balloonHelp_kill $w 1 %W$b"' in this package would trigger on the mac as soon as the balloon window came to the front, thus leading to exactly the <Leave><Enter><Leave><Enter>... cycle you are seeing. The easiest and most useable workaround is to make the balloon windows float, as MacTk's GeneratePollingEvents() ignores floating windows for the purposes of determining the front window, so displaying a floating window doesn't cause a <Leave> event to be sent. this can be achieved via the mac-only unsupported1 tk command after calling 'wm overrideredirect $the_balloon 1' on you balloon window, e.g. as follows: unsupported1 style $the_balloon floating sideTitlebar (BTW, for this to work, appearance mgr needs to be present, but that shouldn't be a problem for all except very old macs, otherwise you can try using the older 'unsupported1 style $the_balloon floatSideProc' although I had problems with it) There is no need to test for '$tcl_platform(platform) == "macintosh"' as the unsupported1 is just a noop on other platforms. The only minor problem with this solution is that with the current OS9 window manager, there is no way to get rid of the floating window decoration (titlebar, frame) on the balloon window (CarbonLib 1.1 and OSX now have a help window style that is undecorated). Using the sideTitlebar helps a bit in that the titlebar should be small for most help balloons. The real fix would be to change Mac Tk's 'wm overrideredirect' to make windows float, but because of the change in visual appearance I'm hesitant to make that change in the distribution, what do people think? (currently 'wm overrideredirect' changes the window style to plainDBox) Cheers, Daniel -- ** Daniel A. Steffen ** "And now to something completely ** Department of Mathematics ** different" Monty Python ** Macquarie University ** <mailto:st...@ma...> ** NSW 2109 Australia ** <http://www.maths.mq.edu.au/~steffen/> |