By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,192 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,192 IT Pros & Developers. It's quick & easy.

TextBox.Leave's event does not trigger

P: n/a
Hi
I have three textboxes indicating the individual RGB values of a
color. When the user leaves a textbox (Leave event), I check the
validity of that number and saves the three values to a set of raw
data... The sub used handles the three textboxes's Leave events, and
uses the 'sender' variable...

Now I have a picturebox with GDI+ circles in it, representing the 8
different colors in the palette. You can choose the color number by
clicking on the circle.

The problem arises when I change a RGB component and change the color
number. The Leave event is not triggered, because the cursor is still
in the checkbox, and thus the last component is not saved before
switching to the chosen color.

I have tried to put the focus elsewhere when the user chooses a new
color, but it seems the Leave event is only triggered when the user
manually changes the active control.

The most intuitive way of solving the problem would be to trigger the
Leave event programatically when the user changes the color number,
but to do that I would need to know the active checkbox that was just
changed in order to pass it up as the 'sender'.

Another way to do it would be to use the TextChanged events instead of
Leave, thus saving the data everytime, but my palette would be
refreshed 16 or 24 times when the user changes the palette number or
some other things...

I would need some way to find the active control for the 'sender'
argument, but my search wasn't successful so far... The best way to
do it would be to make the program trigger the Leave event when
clicking on the circle.....

Any idea would be appreciated.

Thank you
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

Have you tried the "validated" event instead of "leave"? I had a problem
similar to this a while back, though, and I'm fairly sure I never completely
solved it.

Another idea is to put your validation code in a separate routine and call
it EITHER when the Leave even occurs or when you click on the circle.

--George

"Zyrthofar" <Sh*********@Japan.com> wrote in message
news:8r********************************@4ax.com...
Hi
I have three textboxes indicating the individual RGB values of a
color. When the user leaves a textbox (Leave event), I check the
validity of that number and saves the three values to a set of raw
data... The sub used handles the three textboxes's Leave events, and
uses the 'sender' variable...

Now I have a picturebox with GDI+ circles in it, representing the 8
different colors in the palette. You can choose the color number by
clicking on the circle.

The problem arises when I change a RGB component and change the color
number. The Leave event is not triggered, because the cursor is still
in the checkbox, and thus the last component is not saved before
switching to the chosen color.

I have tried to put the focus elsewhere when the user chooses a new
color, but it seems the Leave event is only triggered when the user
manually changes the active control.

The most intuitive way of solving the problem would be to trigger the
Leave event programatically when the user changes the color number,
but to do that I would need to know the active checkbox that was just
changed in order to pass it up as the 'sender'.

Another way to do it would be to use the TextChanged events instead of
Leave, thus saving the data everytime, but my palette would be
refreshed 16 or 24 times when the user changes the palette number or
some other things...

I would need some way to find the active control for the 'sender'
argument, but my search wasn't successful so far... The best way to
do it would be to make the program trigger the Leave event when
clicking on the circle.....

Any idea would be appreciated.

Thank you

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.