Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Is there a way to group buttons to keep them from interacting?

Author
Message
Slaid
18
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Vallsjobo, Sweden
Posted: 12th Sep 2007 17:26

NewProject = createButton(10,3,30,30,"",0,groupOne)
OpenProject = createButton(40,3,30,30,"",0,groupOne)
Spara = createButton(70,3,30,30,"",0,groupOne)
setButtonImage NewProject,"Images/NewProject.bmp"
setButtonImage OpenProject,"Images/Open_Project.bmp"
setButtonImage Spara,"Images/Spara.bmp"

ReName = createButton(110,3,30,30,"",1,groupTwo)
setButtonImage ReName,"Images/RenameAndSave.bmp"

Kamera_Horizontal = createButton(300,3,30,30,"",0,groupThree)
Kamera_TopDown = createButton(330,3,30,30,"",0,groupThree)
setButtonImage Kamera_Horizontal,"Images/Kamera_Horizontal.bmp"
setButtonImage Kamera_TopDown,"Images/Kamera_TopDown.bmp"

The buttons in groupOne and groupTwo should only look depressed when the mouse is clicked on one, then return to the undepressed state right after you clicked on them. The ones in groupThree should not be affected by the clicks on groupOne or two. They should only interact with each other. If one is down the other is up and vis versa. Is this possible? This won't affect my program but I think it would look nicer knowing which option are curenly in use.

May the sun shine on the soles of your feet.
wildbill
18
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 12th Sep 2007 17:42
I assume this is BlueGui. You really should mention what program you are using.

Anyway I use a select statement to accomplish what your after.This is for the main tool bar, but can be adopted for any group of buttons

Select id `Where id is the button id

case 9 `in this case my id is button #9 and my buttons are numbered 9 to 22.
for index = 9 to 22
`i set all the buttons to up
setToolBarButtonState MainToolBar,index,0
next index
`i set the button being selected by the mouse (9) to down
setToolBarButtonState MainToolBar,9,1
gLayerView = 12
endcase
endselect
Just put a while loop in to only occur when the mouse is clicked.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Sep 2007 19:31
Are you setting the values for your groupOne, groupTwo & groupThree variables?

Create a panel or a frame for each group, and then use the handles for those as their parent handles.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Slaid
18
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Vallsjobo, Sweden
Posted: 15th Sep 2007 17:51
Yes, I'm using BlueGui. Good tips but they seem to only work with stardart buttons.
But since I'm using....

GroupTwo = createPanel(110,0,40,37,0)
ReName = createButton(10,3,30,30,"",0,GroupTwo)
setButtonImage ReName,"Images/RenameAndSave.bmp"

The "setToolBarButtonState" has no effect on such buttons. It affects only the standard toolbar buttons.

I had allready tryed creating different panels. I have a total of 8 different panels and and 28 differnt buttons. I'm thinking that maybe its the way buttons work, if you press in one the other change to up. I'm going to try using the "setButtonImage" command to manualy change the look of the button to make the button looked pressed ner untill another one in the group is pressed. So I'll be useing a combo of both tips. If I get it to work I'll post the final code.

May the sun shine on the soles of your feet.

Login to post a reply

Server time is: 2024-05-10 03:55:23
Your offset time is: 2024-05-10 03:55:23