Toggle Blues and text boxes

Toggle Blues and text boxes

Anonymous
Not applicable
446 Views
9 Replies
Message 1 of 10

Toggle Blues and text boxes

Anonymous
Not applicable
Does anyone have a good workaround for making toggle buttons in VB6 other than using a
image control with multiple pictures?

The real problem I am running into is that I am in a DoEvents loop and if I press a button
it sees it, but it doesn't seem to see any of the click events on a image control.

Also one time Brian shared with me a easy way to mimic the standard Inventor textbox so as
to only allow valid distance entries. I foolishly didn't write it down and can't remember
how to do it. Anyone know how to do it?


--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program
0 Likes
447 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
So you want to change a button that says "on" to "off" when it's clicked
(and vice versa?)

if command1.caption = "on" then
command1.caption="off"
else
command1.caption="on"
end if

or am I missing the point?

I'd like the know the answer to your last question. I had that one also but
misplaced it.

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
"Kent Keller" wrote in message
news:80DAD0D6B19F57B53D308C2E59D0F87A@in.WebX.maYIadrTaRb...
> Does anyone have a good workaround for making toggle buttons in VB6 other
than using a
> image control with multiple pictures?
>
> The real problem I am running into is that I am in a DoEvents loop and if
I press a button
> it sees it, but it doesn't seem to see any of the click events on a image
control.
>
> Also one time Brian shared with me a easy way to mimic the standard
Inventor textbox so as
> to only allow valid distance entries. I foolishly didn't write it down
and can't remember
> how to do it. Anyone know how to do it?
>
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
>
0 Likes
Message 3 of 10

Anonymous
Not applicable
No, I am trying to mimic a VBA toggle button. Press it and it stays down. VB doesn't
have such a control.... at least that I have ever been able to see. The only way I have
been able to do it is to take a image or picture control and swap pictures to make it look
like a button down on the mousedown event.

I have just figured out that a Picture control mouse click is seen while in a DoEvents
loop, but a Image click isn't??? 8^(

I have always kind of preferred the Image control, but am in the process of changing over
8^/

And yes the second question is one I would really like to know. Promise I will write it
down this time. 8^)

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Sean Dotson" wrote in message
news:5883CEEBCEEAF87A83FD9EAE100B15EF@in.WebX.maYIadrTaRb...
> So you want to change a button that says "on" to "off" when it's clicked

> I'd like the know the answer to your last question. I had that one also but
> misplaced it.
>
> --
> Sean Dotson, PE
> http://www.sdotson.com
> Check the Inventor FAQ for most common questions
> www.sdotson.com/faq.html
0 Likes
Message 4 of 10

Anonymous
Not applicable
You can do this. Go to the toolbox. Insert a Toggle Button. You can insert
it as a frame with more than one button or one toggle button on its own.

Kathy Johnson
0 Likes
Message 5 of 10

Anonymous
Not applicable
Well about the only thing I know for sure right now is that I am confused. 8^))

It appears that if I have a image in either control it isn't seeing the click event, but
if I add either a image control or a picture control without a picture then it does trap
on the event???

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Kent Keller" wrote in message
news:0E03728042A392A1C9EC15D3F8EE7639@in.WebX.maYIadrTaRb...


> I have just figured out that a Picture control mouse click is seen while in a DoEvents
> loop, but a Image click isn't??? 8^(
0 Likes
Message 6 of 10

Anonymous
Not applicable
Thank you Thank you thank you At first I thought you were just talking about VBA
which has a toggle button, but then I inserted a Option button and started looking through
the properties and you can turn it into a button. Weird, even a FAQ I found out on the
web said you had to use Images. LOL

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"KJohnson" wrote in message
news:04BE1EE5158B2D5D66ABD82CA93D1088@in.WebX.maYIadrTaRb...
> You can do this. Go to the toolbox. Insert a Toggle Button. You can insert
> it as a frame with more than one button or one toggle button on its own.
>
> Kathy Johnson
>
>
0 Likes
Message 7 of 10

Anonymous
Not applicable
I hate looking like a fool even though I do it so well 8^)

I think I figured out why the click event wasn't working before. I was setting the
Enabled state to False in the code, and I thought I had it in a different spot than I did.
With the image controls being disabled doesn't change their appearance much so it wasn't
obvious. When I switched to a graphical option button it became a little more obvious.
8^)

Through all this mess I hope the Textbox issue doesn't get buried.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Kent Keller" wrote in message
news:781CF272CC851C37E5F9AA418C13D56E@in.WebX.maYIadrTaRb...
> Well about the only thing I know for sure right now is that I am confused. 8^))
0 Likes
Message 8 of 10

Anonymous
Not applicable
Here's the answer to your second question. Here's the code for the Change
event of a text box that will perform this validation.

Private Sub txtLength_Change()

' Check to see if expression entered is valid.

On Error Resume Next

Dim dValue As Double

dValue =
ThisDocument.UnitsOfMeasure.GetValueFromExpression(txtLength.Text, _


kDefaultDisplayLengthUnits)

If Err Then

txtLength.ForeColor = vbRed

Else

txtLength.ForeColor = vbWindowText

End If

End Sub


--
Brian Ekins
Developer Technical Services, Autodesk
Discussion Q&A: http://www.autodesk.com/discussion


"Kent Keller" wrote in message
news:80DAD0D6B19F57B53D308C2E59D0F87A@in.WebX.maYIadrTaRb...
> Does anyone have a good workaround for making toggle buttons in VB6 other
than using a
> image control with multiple pictures?
>
> The real problem I am running into is that I am in a DoEvents loop and if
I press a button
> it sees it, but it doesn't seem to see any of the click events on a image
control.
>
> Also one time Brian shared with me a easy way to mimic the standard
Inventor textbox so as
> to only allow valid distance entries. I foolishly didn't write it down
and can't remember
> how to do it. Anyone know how to do it?
>
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
>
0 Likes
Message 9 of 10

Anonymous
Not applicable
Thanks Brian Always seems so easy when you see it in black and white, and so hard when
you are trying to figure it out yourself 8^)

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Brian Ekins (Autodesk)" wrote in message
news:0B31C811C37AA78F408E9EFBCF0A98A4@in.WebX.maYIadrTaRb...
> Here's the answer to your second question. Here's the code for the Change
> event of a text box that will perform this validation.
>
> Private Sub txtLength_Change()
0 Likes
Message 10 of 10

Anonymous
Not applicable
Does it seem odd that this doesn't work

dValue = oUOM.GetValueFromExpression(txtOffset.Text, 11266)
sVal = oUOM.GetStringFromValue(dValue, 11266)

But this does?

dValue = oUOM.GetValueFromExpression(txtOffset.Text,
kDefaultDisplayLengthUnits)
sVal = oUOM.GetStringFromValue(dValue, kDefaultDisplayLengthUnits)

Is my understanding correct, that to be sure the code can be run in any
language, you should always use the Enum instead of the name ?

--
Kent Keller
http://www.MyMcad.com/KWiK/Mcad.htm

Assistant Moderator
Autodesk Discussion Forum Moderator Program

"Brian Ekins (Autodesk)" wrote in message
news:0B31C811C37AA78F408E9EFBCF0A98A4@in.WebX.maYIadrTaRb...
> Here's the answer to your second question. Here's the code for the Change
> event of a text box that will perform this validation.
>
> Private Sub txtLength_Change()
>
> ' Check to see if expression entered is valid.
>
> On Error Resume Next
>
> Dim dValue As Double
>
> dValue =
> ThisDocument.UnitsOfMeasure.GetValueFromExpression(txtLength.Text, _
>
>
> kDefaultDisplayLengthUnits)
>
> If Err Then
>
> txtLength.ForeColor = vbRed
>
> Else
>
> txtLength.ForeColor = vbWindowText
>
> End If
>
> End Sub
0 Likes