Hi!

Taking a randomly focused control on a form, how can you check to see if it
is a text-input control? I.e. a control that accepts input from the user.
What I want to do is add a text character to the control, but only if it can
hold text. For example if a button is focused, adding the char to this
controls Text-property would change the name of the button, which I don't
want...

1. What controls are "text-input" controls in CF?
Textbox, Combobox, NumericUpDown?, DomainUpDown?, more?

2. How can you determin if a control is of this type?
It must be done in the framework somewhere since typing a character in the
SIP when a button is focused won't change it's name, while doing the same
when a textbox is focused will add the character to the text...

3. Would it be the same in the full framework?

/ Peter

Re: [Q] How can you see if you can add text to a control? by Marauderz

Marauderz
Thu Feb 26 03:56:17 CST 2004

Off my head in VB.Net I'd do something like this

dim oControl as Control
for each oControl in me.Controls
if oControl is TypeOf(TextBox) then
'Do Textbox stuff
elseif -----
'and so on and so forth
end if
next

Should work....

But I think it'll take some work to get the currently focused control of a
form. =P


"Peter B" <peter@data.se> wrote in message
news:OJapi9D$DHA.1452@TK2MSFTNGP09.phx.gbl...
> Hi!
>
> Taking a randomly focused control on a form, how can you check to see if
it
> is a text-input control? I.e. a control that accepts input from the user.
> What I want to do is add a text character to the control, but only if it
can
> hold text. For example if a button is focused, adding the char to this
> controls Text-property would change the name of the button, which I don't
> want...
>
> 1. What controls are "text-input" controls in CF?
> Textbox, Combobox, NumericUpDown?, DomainUpDown?, more?
>
> 2. How can you determin if a control is of this type?
> It must be done in the framework somewhere since typing a character in the
> SIP when a button is focused won't change it's name, while doing the same
> when a textbox is focused will add the character to the text...
>
> 3. Would it be the same in the full framework?
>
> / Peter
>
>



Re: [Q] How can you see if you can add text to a control? by Peter

Peter
Thu Feb 26 04:55:13 CST 2004

Hi Marauderz!

Thanks for your help and ideas. The equivalent in C# is:
using System.Windows.Forms;

if( sender is TextBox || sender is ComboBox )
{
// bla bla
}

regards,

Peter


"Marauderz" <marauderz$P4M@marauderzstuff.com.invalid> wrote in message
news:OD9VK7E$DHA.2660@TK2MSFTNGP10.phx.gbl...
> Off my head in VB.Net I'd do something like this
>
> dim oControl as Control
> for each oControl in me.Controls
> if oControl is TypeOf(TextBox) then
> 'Do Textbox stuff
> elseif -----
> 'and so on and so forth
> end if
> next
>
> Should work....
>
> But I think it'll take some work to get the currently focused control of a
> form. =P
>
>
> "Peter B" <peter@data.se> wrote in message
> news:OJapi9D$DHA.1452@TK2MSFTNGP09.phx.gbl...
> > Hi!
> >
> > Taking a randomly focused control on a form, how can you check to see if
> it
> > is a text-input control? I.e. a control that accepts input from the
user.
> > What I want to do is add a text character to the control, but only if it
> can
> > hold text. For example if a button is focused, adding the char to this
> > controls Text-property would change the name of the button, which I
don't
> > want...
> >
> > 1. What controls are "text-input" controls in CF?
> > Textbox, Combobox, NumericUpDown?, DomainUpDown?, more?
> >
> > 2. How can you determin if a control is of this type?
> > It must be done in the framework somewhere since typing a character in
the
> > SIP when a button is focused won't change it's name, while doing the
same
> > when a textbox is focused will add the character to the text...
> >
> > 3. Would it be the same in the full framework?
> >
> > / Peter
> >
> >
>
>