473,508 Members | 2,130 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox.Leave's event does not trigger

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
1 2883
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3206
by: Chris Mayers | last post by:
Hi, I have an application that has (for the sake of argument) 2 (MDI) windows open. If I click into a textbox on FormA then the 'Enter' event for that TextBox fires, great! However, if I then...
2
6114
by: JayDee | last post by:
After a user enters data into a field, I need to populate other controls on the form, based on the user entry. I have to use either Leave, Validating or Validated, and I take it I can't use...
2
2814
by: AussieRules | last post by:
Hi, I have a form with many textbox on it. Behind this(so to speak), is a class, and each time the user changes the value of the text box I want to update the relevant property of the class. ...
1
2556
by: Robains | last post by:
I'm using a TextBox_Leave event to trigger the saving of a value to my object, however, my object is created via the AfterSelect from a TreView control -- which is fine. BUT, the problem seems...
8
4054
by: Martin | last post by:
Hi all, I'm trying to make a subclass of the Textbox. One of the things I did there is the following: Protected Overrides Sub OnLeave(ByVal e As System.EventArgs) If Me.DataType = 1 Or...
21
9114
by: Darin | last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to handle textbox.validating, and I have the form setup so the Cancel button is the Cancel button. WHen the user clicks on...
1
6964
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
2
3711
by: jd | last post by:
I have several textboxes in which the end user can enter values. When the user presses the Enter key when in any of the textboxes, or leaves that textbox, I want a routine to run (mathematical...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.