Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,

When a control is clicked, focus goes to it, but when another is clicked, control doesn't go to it. Please give me valuable answer.
Posted
Updated 30-Jul-12 4:20am
v3
Comments
Kenneth Haugland 30-Jul-12 5:10am    
You need to improve your question, what dosent follow: the Focus, you cant click the control, what do you mean?
Malli_S 31-Jul-12 10:25am    
It all depends on which type of control you are clicking on. Provide some more details.

Short answer:
Not all controls are focusable, some controls handle only mouse input, or no input at all. For example simple labels are also controls but they usually don't handle input at all.

Long Answer:
In a standard gui systems it works like this:
- Some controls can receive neither mouse nor keyboard input
- Some controls can receive only mouse input
- Some controls can receive only keyboard input
- Some controls can recieve both mouse and keyboard input

Keyboard focus is usually handled by the gui system, the gui control code, and your user code in cooperation. The gui controls have usually 2 flags: tabstop, and focusable. If the tabstop flag is on (and the focusable flag is also on), then the gui system is allowed to put the focus on your control when the user steps the focus by pressing the TAB key. If the control has the focusable flag on, then any code can explicitly put the focus on the control even if the tabstop flag is off that is used only by the gui system. This explicit focus change can be done by your code in response to whatever event, but it can be done by the control itself, for example in response to a mouse click (for example in case of a button). When you click a button the focus goes to the button, and this focus change in a good gui system is done by the button itself and not by the system because the control knows if it requires to focus in case of mouse click or not.
 
Share this answer
 
I do not understand your question.
Please explain what this means: "another is clicked Control doesnt go to it Enough" ?
 
Share this answer
 
Comments
enhzflep 30-Jul-12 8:42am    
Who's the muppet that 1 voted this answer?
+5 for counter-vote and the obvious question (nearly) all of us are asking ourselves!
[no name] 30-Jul-12 10:32am    
Well I would hazard a guess that the person felt that this was at best a comment or a question and not a solution.
Albert Holguin 30-Jul-12 10:36am    
Yeah, I didn't downvote this but it should probably be a comment.
Volynsky Alex 30-Jul-12 16:02pm    
Thank you very much enhzflep!
bbirajdar 30-Jul-12 10:43am    
I think this should be a comment and will downvote it... How in the word this can be a solution -- "I do not understand your question.
Please explain what this means: " ???????

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900