in short (since i have no time to code)..
You need several vars.
- Dim DrawerOpen(10) --- where 10 is the max number of drawers
- MaxDrawers = 10
- For x =1 to MaxDrawers
- DrawerOpen(x) = False
- Next x
'-- That sets all the drawers to "closed" in the vars
'now in the button that opens the 1st drawer :
' as i have pointed out in multiple other posts (see THIS ONE) i would suggest 1 MASTER object and ALL the other objects having "empty" scripts in them, so that all the code resides in 1 location. This allows you to easily keep track of things.
So lets say you named the button that opens the first drawer BTN1 & the btn that loads the 2nd slider BTN2 the code would look like: -- keep in mind CaSe is important here
- Function Object_OnLButtonUpEx(obj,x,y,dragged)
- If Not dragged Then
- Select Case obj.name
- Case "BTN1"
- '-- ok here we have to make some assumtions - 1 that the drawers are named Drawer1/2/3 etc.
- '-- we will toggle the open/close based on DrawerOpen(1) = True/False
- if DrawerOpen(1)= False then
- 'do whatever you want to open the drawer1 - the code above seems ok
- ' at the END of that add:
- DrawerOpen(1)= True
- 'Here is the check to see if the 2nd drawer opens
- if DrawerOpen(2)= True then ' close the 2nd drawer
- 'do whatever you want to close the 2nd drawer first
- DrawerOpen(2)= False 'used to store the fact drawer 2 is closed now
- end if
- 'then do whatever it takes to close drawer1
- DrawerOpen(1) = False
- end if
- Case "BTN2"
- 'Add similar code here to open/close drawer2
- End Select
- End If
- End Function
Ok i know its not 100% but it should put you on the right track.
1. always keep the code in 1 master object
2. use VARS to store open/closed states, etc.
3. i like to use DIM var so that you dont need things like Drawer1, Drawer2, drawer3, etc.. its all a DIM.. ie: Drawer(1), (2), (3) and its easy to traverse this list.
4. look at what others have done (Zu calls this STEALING but if you dont take their code, just the ideas, or if you ask for the code, its not Stealing) and see how others have done what you are trying to do
5. ok this sounds lame, but i wonder how many people do this.. TRY GOOGLE... ie: DesktopX Slide or DesktopX Buttons, etc.