VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Making a toggle button...

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
568 Views, 9 Replies

Making a toggle button...

Really new to this VBA stuff and got a hold of the "AcadStatButton" routine
from manusoft.com
I used the SBBTest.dvd (Re named to Pickstyle) as a template. What I'm
trying to do is make a toggle button that will alow me to reset a variable.
For example:

I want to reset the Pickstyle variable:

When the button is "Unpressed" the Pickstle varible will be set to "3"
(normally how I have it set in all my drawings)

When the button is "Pressed" the Pickstle varible will be set to "0"

Does any one have an example or know of a resource that show how to make a
Toggle button in VBA.

TIA

Posted my file in Customer Files
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: Anonymous

I can't seem attach the VBA file anyone know something I'm doing wrong the
web browser version of the NG say I can't attach a file with this type of
Context ????.


"Albert Giuliano" wrote in message
news:4892857@discussion.autodesk.com...
Really new to this VBA stuff and got a hold of the "AcadStatButton" routine
from manusoft.com
I used the SBBTest.dvd (Re named to Pickstyle) as a template. What I'm
trying to do is make a toggle button that will alow me to reset a variable.
For example:

I want to reset the Pickstyle variable:

When the button is "Unpressed" the Pickstle varible will be set to "3"
(normally how I have it set in all my drawings)

When the button is "Pressed" the Pickstle varible will be set to "0"

Does any one have an example or know of a resource that show how to make a
Toggle button in VBA.

TIA

Posted my file in Customer Files
Message 3 of 10
Anonymous
in reply to: Anonymous

Hi Albert,

I have Acad 2004 and there is a toggle button built into the tool box.

Maybe you could also do it with an image:

Put an image control on a form and put the code below in the "Click" event.

Hope it helps.

Gary

If Image1.SpecialEffect = fmSpecialEffectSunken Then

Image1.SpecialEffect = fmSpecialEffectRaised

Else
Image1.SpecialEffect = fmSpecialEffectSunken

End If
Message 4 of 10
Anonymous
in reply to: Anonymous

Just add a toggle button on your form, and check the value of Pickstyle, and
change the value of the toggle button according the value of the picklist.


In the form activate event put

If ThisDrawing.GetVariable("Pickstyle") = 3 Then
tog.Value = False
Elseif ThisDrawing.GetVariable("Pickstyle") = 0
tog.Value = True

End If


In the change event of the toggle,

If tog.Value Then
ThisDrawing.SetVariable "Pickstyle", 0
Else
ThisDrawing.SetVariable "Pickstyle", 3
End If



"Albert Giuliano" a écrit dans le message de news:
4892857@discussion.autodesk.com...
Really new to this VBA stuff and got a hold of the "AcadStatButton" routine
from manusoft.com
I used the SBBTest.dvd (Re named to Pickstyle) as a template. What I'm
trying to do is make a toggle button that will alow me to reset a variable.
For example:

I want to reset the Pickstyle variable:

When the button is "Unpressed" the Pickstle varible will be set to "3"
(normally how I have it set in all my drawings)

When the button is "Pressed" the Pickstle varible will be set to "0"

Does any one have an example or know of a resource that show how to make a
Toggle button in VBA.

TIA

Posted my file in Customer Files
Message 5 of 10
Anonymous
in reply to: Anonymous

Zip the file first.

--
R. Robert Bell


"Albert Giuliano" wrote in message
news:4892980@discussion.autodesk.com...
I can't seem attach the VBA file anyone know something I'm doing wrong the
web browser version of the NG say I can't attach a file with this type of
Context ????.
Message 6 of 10
Anonymous
in reply to: Anonymous

The program you mention comes with a dll that creates a custom button on the
status bar of the main acad window. The other replies talk about the regular
vba toggle control. Which is it that you are trying to work with?

--
----
Ed
----
"Albert Giuliano" wrote in message
news:4892857@discussion.autodesk.com...
Really new to this VBA stuff and got a hold of the "AcadStatButton" routine
from manusoft.com
I used the SBBTest.dvd (Re named to Pickstyle) as a template. What I'm
trying to do is make a toggle button that will alow me to reset a variable.
For example:

I want to reset the Pickstyle variable:

When the button is "Unpressed" the Pickstle varible will be set to "3"
(normally how I have it set in all my drawings)

When the button is "Pressed" the Pickstle varible will be set to "0"

Does any one have an example or know of a resource that show how to make a
Toggle button in VBA.

TIA

Posted my file in Customer Files
Message 7 of 10
Anonymous
in reply to: Anonymous

The Program it uses VBA to activate the Acad Commands in these buttons, I
think what was mentioned could help me get a handle on it, unless you know
of better / differn't way?



"Ed Jobe" wrote in message
news:4893120@discussion.autodesk.com...
The program you mention comes with a dll that creates a custom button on the
status bar of the main acad window. The other replies talk about the regular
vba toggle control. Which is it that you are trying to work with?

--
----
Ed
----
"Albert Giuliano" wrote in message
news:4892857@discussion.autodesk.com...
Really new to this VBA stuff and got a hold of the "AcadStatButton" routine
from manusoft.com
I used the SBBTest.dvd (Re named to Pickstyle) as a template. What I'm
trying to do is make a toggle button that will alow me to reset a variable.
For example:

I want to reset the Pickstyle variable:

When the button is "Unpressed" the Pickstle varible will be set to "3"
(normally how I have it set in all my drawings)

When the button is "Pressed" the Pickstle varible will be set to "0"

Does any one have an example or know of a resource that show how to make a
Toggle button in VBA.

TIA

Posted my file in Customer Files
Message 8 of 10
Anonymous
in reply to: Anonymous

> Does any one have an example or know of a resource that show
> how to make a Toggle button in VBA.

If you change the function in the sample to the following it will change
PICKSTYLE when you press and unpress the button:

Private Function SBButton_OnClicked() As Boolean
If SBButton.Pressed Then
ThisDrawing.SetVariable "PICKSTYLE", 0
Else
ThisDrawing.SetVariable "PICKSTYLE", 3
End If
SBButton_OnClicked = True
End Function

You would probably want to change the button text to reflect the current
setting as well. To make it completely robust, you should programmatically
change the button state when the PICKSTYLE value changes by some other
method, as well as when the current document changes. This is a bit more
involved, but there are samples here in the newsgroup of implementing events
in VBA if you want to pursue that. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
Message 9 of 10
Anonymous
in reply to: Anonymous

Thanks Owen, Who better to Answer then the Author Himself.


"Owen Wengerd" wrote in message
news:4893425@discussion.autodesk.com...
> Does any one have an example or know of a resource that show
> how to make a Toggle button in VBA.

If you change the function in the sample to the following it will change
PICKSTYLE when you press and unpress the button:

Private Function SBButton_OnClicked() As Boolean
If SBButton.Pressed Then
ThisDrawing.SetVariable "PICKSTYLE", 0
Else
ThisDrawing.SetVariable "PICKSTYLE", 3
End If
SBButton_OnClicked = True
End Function

You would probably want to change the button text to reflect the current
setting as well. To make it completely robust, you should programmatically
change the button state when the PICKSTYLE value changes by some other
method, as well as when the current document changes. This is a bit more
involved, but there are samples here in the newsgroup of implementing events
in VBA if you want to pursue that. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
Message 10 of 10
Anonymous
in reply to: Anonymous

I don't really understand your question..."get a handle" on what? Please
provide more details.

--
----
Ed
----
"Pochrist" wrote in message
news:4893375@discussion.autodesk.com...
The Program it uses VBA to activate the Acad Commands in these buttons, I
think what was mentioned could help me get a handle on it, unless you know
of better / differn't way?



"Ed Jobe" wrote in message
news:4893120@discussion.autodesk.com...
The program you mention comes with a dll that creates a custom button on the
status bar of the main acad window. The other replies talk about the regular
vba toggle control. Which is it that you are trying to work with?

--
----
Ed
----
"Albert Giuliano" wrote in message
news:4892857@discussion.autodesk.com...
Really new to this VBA stuff and got a hold of the "AcadStatButton" routine
from manusoft.com
I used the SBBTest.dvd (Re named to Pickstyle) as a template. What I'm
trying to do is make a toggle button that will alow me to reset a variable.
For example:

I want to reset the Pickstyle variable:

When the button is "Unpressed" the Pickstle varible will be set to "3"
(normally how I have it set in all my drawings)

When the button is "Pressed" the Pickstle varible will be set to "0"

Does any one have an example or know of a resource that show how to make a
Toggle button in VBA.

TIA

Posted my file in Customer Files

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost