473,508 Members | 4,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What can I know what component is getting focus?

Hi all!

I have one combobox, two grids and nine textbox. All textbox are tab index
one following another. When I press tab I go to the next textbox. How can I
known if I click on another component, like the combobox?

Thank you!
Vanessa
Jun 27 '08 #1
2 1594
On Thu, 15 May 2008 10:03:01 -0700, Vanessa
<Va*****@discussions.microsoft.comwrote:
Hi all!

I have one combobox, two grids and nine textbox. All textbox are tab
index
one following another. When I press tab I go to the next textbox. How
can I
known if I click on another component, like the combobox?
Your question is somewhat ambiguous. The GotFocus and LostFocus events
will tell you about focus changes for specific controls. You can use
these to track focus changes among your own controls.

Unfortunately, when one control loses focus, the LostFocus event
associated with that doesn't tell you which control is getting focus, nor
does the GotFocus event tell you which control lost focus. However, if
you're subscribed to the approprite events for all of your controls, then
you can track that information yourself.

Barring that, you can override the WndProc() method and watch for
WM_KILLFOCUS and WM_SETFOCUS messages. These include a handle to the
"other" control window, which you may be able to pass to
Control.FromHandle() to resolve back to the actual Control instance that's
relevant.

Pete
Jun 27 '08 #2
I am not sure whether I understand the question correctly.
However, Form has ActiveControl property, which can help to find
control in focus.

Does that help?

Kalpesh
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
18805
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
24
5232
by: delerious | last post by:
Hi, I am designing a web site that will that showcase a bunch of vacation pictures. It will have a banner and a navigation menu (consisting of 13 rectangular images that can be clicked). I am...
0
1361
by: Karuppasamy | last post by:
H I have created a Windows Application using C#. This Windows application makes a call to a Remoting Object which runs as a Windows Service. This Remoting Component makes a call to a Com+(Name :...
3
3399
by: arun venkatesan | last post by:
Hi, We use a TListView component in C++ Builder to enable the user make some selections. When the user makes a selection, the selected rows are highlighted in 'Blue'. Now, my application is...
0
2807
by: acharyaks | last post by:
Hi life saver, I am using excel component for the development. The purpose is to connect to excel through the odbc connection string. Then through the connection extract data into a dataset and...
0
1080
by: Dave | last post by:
Hello, I am writing an On-screen keyboard, similar to the one included in windows 2k and XP. The problem I am having is that I need my keyboard to never get the focus, but still be able to...
3
2254
by: windy | last post by:
I would like to change the backcolor inside the checkbox when the component is on focus, not the color of the text. Thanks a lot.
1
1943
by: Mex | last post by:
Hi Im using a Process component to run external application (FineOCR.exe) In StarInfo i set theProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; When the process...
2
6219
by: newlearner | last post by:
Hi all, is there any way to set focus for a HTML component from action class in JSF frame work. The Requirement is I validate a input text using a4j . if there is a validation error then i...
0
7228
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
7128
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
7332
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
7058
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
7502
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
4715
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
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1565
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
426
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.