Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to traverse controls
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00980286
Message ID:
00980486
Vues:
45
Gerard,
I did not look really hard for this feature, but I do not recall ever hearing anything about it. The reson I wrote the code that I posted was because I needed it for a custom IP address control, with the same feel as the control M$ uses in Windows. I created my control by using 4 text boxes. When it came time to navigate between the 4 textboxes in the same control I wanted additional navigation control using "." and arrow keys.

May I ask why you want to allow the user to navigate with arrows? (it is not the M$ way <s>)

Einar

>Hi Einar..
>
>I thought there would have been a switch or some flag somewhere ..
>
>Thanks
>Gerard
>
>
>>Gerard,
>>I don't think there is anything built in, but you can create your own code something like this:
>>
>>private void txtIp0_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
>>{
>>	int iPos = this.txtIp0.SelectionStart;
>>
>>	if (iPos == 3)
>>	{
>>		this.txtIp1.Focus();
>>	}
>>	else if ((iPos != 0) && ((e.KeyCode == Keys.Decimal) || (e.KeyCode == Keys.OemPeriod)))
>>	{
>>		this.txtIp1.Focus();
>>	}
>>	else if ((iPos == this.txtIp0.TextLength) && (e.KeyCode == Keys.Right))
>>	{
>>		this.txtIp1.Focus();
>>	}
>>}
>>
>>I wrote this for a custom IP adress control. In the last else if I check if the arrow key was clicked and move focus to the next control.
>>
>>Hope this helps.
>>
>>Einar
>>>Hi.
>>>The default way of gong through controls on a screen seems to be by pressing the 'Tab' key.
>>>
>>>Is there a way of changing this behaviour so that I can hit the Enter Key and the Up/Down arrows to tab through controls on a form ?
>>>
>>>Regards,
>>>
>>>Gerard
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform