Click here to Skip to main content
15,903,385 members
Home / Discussions / C#
   

C#

 
GeneralRe: Browse all controls Pin
turbochimp2-Dec-04 5:08
turbochimp2-Dec-04 5:08 
GeneralProblem with string literals Pin
pchak2-Dec-04 4:18
pchak2-Dec-04 4:18 
GeneralRe: Problem with string literals Pin
turbochimp2-Dec-04 4:50
turbochimp2-Dec-04 4:50 
GeneralRe: Problem with string literals Pin
pchak2-Dec-04 5:30
pchak2-Dec-04 5:30 
Generalconnection path for database Pin
steve_rm2-Dec-04 4:18
steve_rm2-Dec-04 4:18 
GeneralRe: connection path for database Pin
turbochimp2-Dec-04 4:35
turbochimp2-Dec-04 4:35 
GeneralRe: connection path for database Pin
steve_rm2-Dec-04 5:20
steve_rm2-Dec-04 5:20 
Generalusing a TextBox without focus Pin
jjansen2-Dec-04 4:14
jjansen2-Dec-04 4:14 
Hi,

I have a user control that includes two other controls, one is a Panel and the other a TextBox (or actually, a user control inherited from a TextBox). The Panel can be used for mouse input (the position of a mouseclick and so on) and the TextBox is there for numerical input. What I want to achieve is that the user can type in a number in the TextBox without having to explicitly give focus to the TextBox first. Preferably, I'd like the TextBox to be filled without ever recieving the focus. I've been able to redirect the key input through the OnKeyDown and OnKeyUp of the user control to those of the TextBox, but it doesn't seem to get processed when the TextBox doesn't have the focus. What I'm desperately trying to prevent is having to catch and interpret every key high-up, for instance in ProcessCmdKey, and then set the text in the TextBox myself. What you're doing then is essentially rebuilding the functionality of a TextBox, which doesn't seem like a good idea.

So I though a good compromise would be to let the user control 'listen' for any key input and take that as a sign that the user wants to use the TextBox. Upon the first encountered key I give the focus to the TextBox and redirect all key input to it. Unfortunately, when the very first key reaches the TextBox, it DOES have the focus but the key still isn't shown. Although the Focused-property of the TextBox is true, somehow it doesn't seem to realise this yet deep down. Calling the TextBox' OnKeyDown twice doesn't help. Only the second key I press gets displayed.

Does anyone know why this occurs or how to circumvent it? Or perhaps someone has an entirely different approach to achieve the effect I'm aiming for, basically a TextBox that can take raw keyboard input but that doesn't need focus.

Thanks.

GeneralC# compact framework Yes/No MessageBox Pin
DanielFP2-Dec-04 3:50
DanielFP2-Dec-04 3:50 
GeneralRe: C# compact framework Yes/No MessageBox Pin
Dave Kreskowiak2-Dec-04 5:42
mveDave Kreskowiak2-Dec-04 5:42 
GeneralRe: C# compact framework Yes/No MessageBox Pin
Daniel P2-Dec-04 6:55
Daniel P2-Dec-04 6:55 
Generalfilling RichTextBox using MemoryStream Pin
Hovik Melkomian2-Dec-04 3:50
Hovik Melkomian2-Dec-04 3:50 
GeneralRe: filling RichTextBox using MemoryStream Pin
leppie2-Dec-04 4:47
leppie2-Dec-04 4:47 
GeneralRe: filling RichTextBox using MemoryStream Pin
Hovik Melkomian4-Dec-04 1:55
Hovik Melkomian4-Dec-04 1:55 
GeneralRe: filling RichTextBox using MemoryStream Pin
leppie4-Dec-04 2:23
leppie4-Dec-04 2:23 
GeneralRe: filling RichTextBox using MemoryStream Pin
Hovik Melkomian4-Dec-04 2:40
Hovik Melkomian4-Dec-04 2:40 
GeneralRe: filling RichTextBox using MemoryStream Pin
leppie4-Dec-04 3:33
leppie4-Dec-04 3:33 
GeneralRe: filling RichTextBox using MemoryStream Pin
Hovik Melkomian6-Dec-04 1:42
Hovik Melkomian6-Dec-04 1:42 
Generallibraries, DLL's, Wrappers Pin
Mridang Agarwalla2-Dec-04 2:50
Mridang Agarwalla2-Dec-04 2:50 
GeneralRe: libraries, DLL's, Wrappers Pin
turbochimp2-Dec-04 3:45
turbochimp2-Dec-04 3:45 
Generalviewing multiple image formats Pin
Mridang Agarwalla2-Dec-04 2:46
Mridang Agarwalla2-Dec-04 2:46 
Generalcontrols inside a datagrid Pin
Mridang Agarwalla2-Dec-04 1:36
Mridang Agarwalla2-Dec-04 1:36 
GeneralRe: controls inside a datagrid Pin
turbochimp2-Dec-04 2:46
turbochimp2-Dec-04 2:46 
GeneralRe: controls inside a datagrid Pin
Hugo Migneron2-Dec-04 4:04
Hugo Migneron2-Dec-04 4:04 
GeneralApplication winforms in InterNet Explorer - Problem Pin
crisyuri2-Dec-04 1:22
crisyuri2-Dec-04 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.