New topic: overlaying controls
<http://forums.realsoftware.com/viewtopic.php?t=45583> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message hpstocker Post subject: overlaying controlsPosted: Thu Oct 11, 2012 12:59 pm Joined: Tue Feb 17, 2009 5:25 am Posts: 6 Hi all, I'm not very happy with the standard RB ComboBox so I created my own. A ContainerControl with a Textfield and a ListBox. If a match is found between the Text in the TextField and the ListBox List, I resize the ContainerControl, the ListBox pop's up and the found Cell is selected - similar to the ComboBox. The ListBox may also popup above the TextField if there is not enough space for 5 rows below. So far so good. Problem starts when the poped up Listbox overlays an other Control, let's say a TextField on a window with Composite=True. On the IDE I can set the Z-order of my control to Front then it works on the above scenario. But how if I have 2 of my controls which may overlay each other? The RB ComboBox overlays everything - How can I get the same behaviour? Runtime change of Z-order is not possible - so I'm a bit lost. regards Peter Stocker Top charonn0 Post subject: Re: overlaying controlsPosted: Thu Oct 11, 2012 2:05 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 917 Location: San Francisco, CA, USA I've created something similar to what you're trying to do by using a MenuItem instead of a ListBox. After creating the MenuItem call MenuItem.Popup with the X and Y coordinates to show the menu at (e.g. the bottom-left corner of the TextField. MenuItems will always appear above controls so you don't have to worry about overlays which can be a huge headache. e.g.: Dim mnu As New MenuItem("Select One") mnu.Append(New MenuItem("Hello, world!")) mnu.Append(New MenuItem("Goodbye, world!")) //Now show the menu below TextField1 Dim choice As MenuItem = mnu.PopUp(TextField1.Left, TextField1.Bottom) If choice <> Nil Then Msgbox("You said: " + choice.Text) End If _________________ Boredom Software 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]
