New topic: close button, .visible hide / show behavior
<http://forums.realsoftware.com/viewtopic.php?t=32195> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message AaronAndrewHunt Post subject: close button, .visible hide / show behaviorPosted: Tue Jan 26, 2010 1:03 pm Joined: Sat Jul 14, 2007 2:16 pm Posts: 274 I have a GlobalFloatingWindow with the close button visible. I want to be able to open and close the window (toggling) using a menu item. I also want the cancel button to close the window and allow it to be opened using the menu item. 1. I hide GlobalFloatingWindow at startup 2. In CancelClose event of GlobalFloatingWindow I put "return false" (if I put "return true" then the window does not close when the close button is clicked, and the application also will not quit properly). 3. I have a MenuItem with a keyboard shortcut that calls a setup method in the window: Code: Sub setup() if self.visible then self.hide else self.show End Sub Results: the keyboard shortcut works as expected to open and close the GlobalFloatingWindow, toggling ... UNTIL I use the cancel button of GlobalFloatingWindow. After I close the window using the cancel button (red circle in the corner on Mac) instead of the menu item, then I have to do the menu action TWICE in order for GlobalFloatingWindow to open again. What am I doing wrong? Thanks, AAH Top DaveS Post subject: Re: close button, .visible hide / show behaviorPosted: Tue Jan 26, 2010 1:23 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 1997 Location: San Diego, CA There is SHOW, HIDE and CLOSE Your menu is using SHOW and HIDE the RED button uses CLOSE HIDE leaves the window "active" just not visible... CLOSE "destroys" the instance of the window What I normally do is create a global boolean flag... .and NOT rely on window.visible I set the flag in the OPEN event, clear the flag in the CLOSE event... and I don't use HIDE very much.... Not that that may be the right solution for you.... especially if you need to OPEN/CLOSE that window alot, as it take time/resources to create the window if you did more than just hide it. _________________ Dave Sisemore MacPro, OSX 10.5.8 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
