Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically Depress Toolbar Button 1

Status
Not open for further replies.

figler

Programmer
Dec 26, 2001
155
0
0
US
I have a button group consisting of two buttons that control whether the form is in read-only or read/write mode. When the user changes the mode by clicking one of these buttons, I change the state (readonly or readwrite) of the form programmatically.

But when I change the state of the form without user input, I would like to indicate the current state to the user through the use of these buttons. I would like to do something like the following:

toolbar.buttons("ReadOnly").clicked = True

There isn't a 'clicked' property, but is there another way to do something similar?
 
If you find out anything, let us know. I would like to know the same thing! TIA
 
Since you only have two choices - why not use one button and alter its caption, or image displayed on toolbar icon

Example
Sub ChangeStatus()
If button.caption = "Read Only" then
button.caption = "Read/Write Mode
Other Logic Here
else
button.caption = "Read Only"
other logic here
end if
end sub


You can then call this rutine from any where

Set Form.status = readOnly
button.caption = "Read/Write"
changeStatus

This logic will display "ReadOnly" when form is ReadOnly and "ReadWrite" when form is ReadWrite. In other words the current active status - or the captions can be reversed to display what status will be if you press the button or change status in code

I hope I understood your issue correctly

Good Luck

 
Maybe use a group of toggle buttons instead.

ie.

If bolReadOnly = True Then

tglReadOnly.Value = True
tglReadWrite.Value = False

Else

tglReadOnly.Value = False
tglReadWrite.Value = True

End If

Hope this helps Matt Smith

No two nulls are the same
 
Didn't realize I could change the value of a button that way. Thanks a lot, MattSmith.

As for papayac's suggestion (changing the image to reflect the read/write status), I would do that except that I don't have good enough images to toggle between. Actually... anyone know where i can get good icons and bitmaps (small enough for toolbar)? vis stud provides some, but they're all windows icons.

thanks for the help. -brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top