Is it suppose group can do it for me? to do unpress?
Main Topics
Browse All TopicsThe following form use toolbar control (6.0). When I press the button, the frist toolbar button doesn't pop out. Why?
Is any way to do it beside using the default button and I have to set all button to tbrunpressed before set the specific one to tbrpressed?
Does any doc in MS talking about this? I cannot find any
?->
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3672
ClientLeft = 48
ClientTop = 288
ClientWidth = 8052
LinkTopic = "Form1"
ScaleHeight = 3672
ScaleWidth = 8052
StartUpPosition = 3 'Windows Default
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 336
Left = 0
TabIndex = 1
Top = 0
Width = 8052
_ExtentX = 14203
_ExtentY = 593
ButtonWidth = 487
Appearance = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-0
NumButtons = 4
BeginProperty Button1 {66833FEA-8583-11D1-B16A-0
Style = 2
Value = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-0
Style = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-0
Style = 2
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-0
Style = 2
EndProperty
EndProperty
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 372
Left = 480
TabIndex = 0
Top = 960
Width = 972
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Toolbar1.Buttons(3).Value = tbrPressed
End Sub
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hmm, you seriously can't set the first button to unpressed on a basically empty project? It works fine for me. Try using keys for your buttons and accessing them from the collection via that. If not, I haven't a clue.
Private Sub Form_Load()
Toolbar1.Buttons("Button1"
Toolbar1.Buttons("Button3"
End Sub
It works on form_load but if you do
Private Sub Command1_Click()
Toolbar1.Buttons(3).Value = tbrUnpressed
Toolbar1.Buttons(2).Value = tbrPressed
End Sub
Private Sub Form_Load()
Toolbar1.Buttons(1).Value = tbrUnpressed
Toolbar1.Buttons(3).Value = tbrPressed
End Sub
Click the button and you will see what i am talking about
Seems to be a bug when the form is just loading. I tried the below and it didn't occur like it did with the example you showed.
Private Sub Command1_Click()
Toolbar1.Buttons(1).Value = tbrPressed
Toolbar1.Buttons(2).Value = tbrUnpressed
End Sub
Private Sub Command2_Click()
Toolbar1.Buttons(1).Value = tbrUnpressed
Toolbar1.Buttons(2).Value = tbrPressed
End Sub
If that's not the issue, just delete the question. Nothing useful here to anybody anyways.
A request has been made to close this question and refund the points;
http://www.experts-exchang
If there are no objections within the next 72 hours, the request will be granted.
EXPERTS: Please leave your thoughts on the request here.
SerCouWisMOD
Community Support Moderator
Oh, my bad. I forgot to set the button .Style. You need to set that to tbrCheck or tbrButtonGroup to get it to work properly for buttons that you want to stay pressed. It seems to fix the problem alltogether if you set the .Style to one of the above rather then to tbrDefault (which is the same as not setting the .Style).
Basically, the tbrDefault for SP5 seems to act similarly to tbrCheck, but for SP6 the tbrDefault is distinctly different when it comes to keeping buttons pressed (and in relation to the Refresh of the control due to dragging something over it).
Business Accounts
Answer for Membership
by: zzzzzoocPosted on 2003-12-17 at 08:32:02ID: 9957697
Barely use ToolBars but I tried and it's the same for me. You could just have a static variable store whichever one is pressed, and unpress that when you're pressing another. :P
.Value = tbrUnpressed lue = tbrPressed
Option Explicit
Dim iPressed As Integer
Private Sub Command1_Click()
Dim iTemp As Integer
iTemp = Int(Rnd * Toolbar1.Buttons.Count) + 1
Toolbar1.Buttons(iPressed)
Toolbar1.Buttons(iTemp).Va
iPressed = iTemp
End Sub
Private Sub Form_Load()
iPressed = 1
End Sub