Option Button Validate

Option Button Validate

Anonymous
Not applicable
308 Views
3 Replies
Message 1 of 4

Option Button Validate

Anonymous
Not applicable
In a dialog I have 4 option buttons that when changed show stored values in a number
of different controls. If the user changes a value in one of the other controls and then
tries to change option buttons without hitting apply, I want to prompt them with a
messagebox.

Maybe some of the problems I am having are because this is in a addin dll ?? but if I
use a normal option button the validate sub fires but the click event never does. (just
like it works if you are stepping through code using the validate sub). If I change the
option buttons to graphical buttons then it works every time except the first.

The form loads, I edit a textbox which sets a Boolean to notify the validate that
something has changed, but then when I click a different option button the text change
event fires again??, and the validate doesn't. After that first time it works right.

Is there a better way to do what I want. If I put the code in the Mouse down event for
the option buttons is there any way to cancel the click event for it?

I imagine I could do it in the click event but it would take all kinds of Booleans and
checks and storing the old button name etc.


--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program
0 Likes
309 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Kent,
Will it work if you use the option button change event to set a form level
'changed' boolean flag? Then just check this flag in the same event and call
a prompt function...

Kevin

"Kent Keller" wrote in message
news:E0E99542CD1D331491C93EDD7B4453EB@in.WebX.maYIadrTaRb...
> In a dialog I have 4 option buttons that when changed show stored
values in a number
> of different controls. If the user changes a value in one of the other
controls and then
> tries to change option buttons without hitting apply, I want to prompt
them with a
> messagebox.
>
> Maybe some of the problems I am having are because this is in a addin
dll ?? but if I
> use a normal option button the validate sub fires but the click event
never does. (just
> like it works if you are stepping through code using the validate sub).
If I change the
> option buttons to graphical buttons then it works every time except the
first.
>
> The form loads, I edit a textbox which sets a Boolean to notify the
validate that
> something has changed, but then when I click a different option button the
text change
> event fires again??, and the validate doesn't. After that first time it
works right.
>
> Is there a better way to do what I want. If I put the code in the Mouse
down event for
> the option buttons is there any way to cancel the click event for it?
>
> I imagine I could do it in the click event but it would take all kinds of
Booleans and
> checks and storing the old button name etc.
>
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi Kevin

It will/would work, but it would take more effort. 8^) I would like to give them the
option with a yes/no/cancel messagebox to either apply and change, or not apply and change
or cancel the change. If the click event has fired I would have to have the name of the
previous button stored, and have a Boolean or something in a routine to be able to return
to it without refiring its click event code. I already have a Boolean to check if it is a
form load click event and one to check if anything actually changed or not(to know if I
need to fire the message box or not) so it starts getting a little messy.

It probably is the best way out, but I was really hoping there was a way to do it before
the change is made, and that is what the Validate event appears to be for. Unfortunately
it is one of those hard to debug things where the click never happens if you step through
it with F8, but does in normal run mode.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Kevin Terry" wrote in message
news:B1A2214335680A79C551FC7E38EBD451@in.WebX.maYIadrTaRb...
> Kent,
> Will it work if you use the option button change event to set a form level
> 'changed' boolean flag? Then just check this flag in the same event and call
> a prompt function...
>
> Kevin
0 Likes
Message 4 of 4

Anonymous
Not applicable
Kent
I see what you mean - for debugging such things I've sometimes put a 'stop'
statement in the code after such a section, then F5 to 'run' through just
that part and the code will break at the stop for you to continue stepping
through. Not sure if that will help this scenario though - it may be the
same behavior (read 'bug') will be evident that way as well. I've got an app
kind of like this that I never did fully debug - it works ok, but since it's
not really 'critical' I just left it in it's existing (half-a$$ed) state 😉
Sorry I can't help more...

Kevin

"Kent Keller" wrote in message
news:0205339B5A613DFE183DC7FDB4941EDB@in.WebX.maYIadrTaRb...
> Hi Kevin
>
> It will/would work, but it would take more effort. 8^) I would like to
give them the
> option with a yes/no/cancel messagebox to either apply and change, or not
apply and change
> or cancel the change. If the click event has fired I would have to have
the name of the
> previous button stored, and have a Boolean or something in a routine to be
able to return
> to it without refiring its click event code. I already have a Boolean to
check if it is a
> form load click event and one to check if anything actually changed or
not(to know if I
> need to fire the message box or not) so it starts getting a little messy.
>
> It probably is the best way out, but I was really hoping there was a way
to do it before
> the change is made, and that is what the Validate event appears to be for.
Unfortunately
> it is one of those hard to debug things where the click never happens if
you step through
> it with F8, but does in normal run mode.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
> "Kevin Terry" wrote in message
> news:B1A2214335680A79C551FC7E38EBD451@in.WebX.maYIadrTaRb...
> > Kent,
> > Will it work if you use the option button change event to set a form
level
> > 'changed' boolean flag? Then just check this flag in the same event and
call
> > a prompt function...
> >
> > Kevin
>
>
0 Likes