|
-
Dec 9th, 2002, 06:25 PM
#1
Thread Starter
Hyperactive Member
Toolbar buttons like Radiobuttons *[RESOLVED]*
I have a toolbar with which I want the image that the user clicked upon to stay pressed until another one is pressed, then I wish the last button pressed to pop out and the new button to press in <phew!>
I know I can set the buttonstyles to pushbutton and I know I have to get the index of the last button pressed and I know you have to use something like:
VB Code:
Case "Details" 'First button
pnlDetails.BringToFront()
[b]OldIndex = 0[/b]
MessageBox.Show(OldIndex)
'
Case "Game" 'Second button
<[i]toolbar1.Buttons.IndexOf(oldindex) = <pop this button out>[/i]>
...
But what exactly is the right code? Can anyone help? Please.
Last edited by RealNickyDude; Dec 9th, 2002 at 07:27 PM.
-
Dec 9th, 2002, 06:42 PM
#2
Member
I've never done it before, but I'm guessing it would be something like this...(in the ButtonClick event of the ToolBar)
Code:
MyToolBar.Buttons.Item(LastButtonIndex).Pushed = False
LastButtonIndex = MyToolBar.Buttons.IndexOf(e.Button)
Hope that helps
btw, what's the tag for formatting your code to VB?
-
Dec 9th, 2002, 06:48 PM
#3
Thread Starter
Hyperactive Member
I'll try that, thanks.
(open square bracket)vbcode(close square bracket) blah, blah (open square bracket slash)vbcode(close square bracket)
-
Dec 9th, 2002, 06:57 PM
#4
Member
right on, thanx 
VB Code:
MessageBox.Show(IIF(Me.NotSoBright, ":(", ":)"))
-
Dec 9th, 2002, 07:12 PM
#5
Thread Starter
Hyperactive Member
I can't get it quite right, this is what I have:
VB Code:
If ToolBar1.Buttons.IndexOf(e.Button) <> LastButtonIndex Then
ToolBar1.Buttons.Item(LastButtonIndex).Pushed = False
LastButtonIndex = ToolBar1.Buttons.IndexOf(e.Button)
Else
[b]ToolBar1.Buttons.Item(ToolBar1.Buttons.IndexOf).Pushed = True[/b]
End If
I need the button to stay in still if the user clicks on a pushed in button. The line in bold is giving me trouble, can you help?
-
Dec 9th, 2002, 07:17 PM
#6
Member
that line won't really do anything...try this instead...i think you're trying to make it more complicated than it should be 
You just want the button your on to stay pushed right? e.Button is just a reference to the button that was just clicked on.
-
Dec 9th, 2002, 07:26 PM
#7
Thread Starter
Hyperactive Member
right on, thanx
VB Code:
MessageBox.Show(IIF(Me.NotSoBright, ":(", ":)"))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|