Hi there,
I have an application in which a grid of 100 or more buttons are put on a
form in columns of 10.
All the buttons are within a panel.
They are added in runtime, and so they adopt a sensible tab value.
The tab key moves the focus down the column one by one, and the up and down
arrow keys work well.
What I would like to do, however, is allow the user to use the right/left
arrow keys to jump a column (i.e. current tab value +/- 10), and perhaps the
page down/up keys to move by +/- 50.
Presently these keys do the same as the tab key.
Help!
Cheers
Neil
VB.net Newbie 4 5804
Here's an idea. Not tested by any means, but...
Hold a hashtable of all your buttons as you add them at runtime. Add the
tabindex as the key and the control as the button. Then capture the
keypress event and figure out if you need to handle the arrow keys. If the
key pressed is an arrow look at the tabindex of the control, figure out what
the tabindex of the control you want to move to is. Look up the new
tabindex in the hashtable to find the control. Then set the focus onto the
control that is returned from the hashtable.
Something along these lines: (I don't have an editor to test w/ right now)
Dim HT as new HashTable
For ii as integer = 0 to 100
Dim Btn as New Button
'Setup the button and add to form
HT.Item.Add(btn.tabindex, btn)
AddHandler Btn.KeyDown, Address Btn_KeyDownEvent
Next
Private Sub Btn_KeyDownEvent(sender as object, e as Sometypeofeventhandler)
'Check for the key that was press, I think it is e.key or something like
that
dim ButtonPressed as Button = DirectCast(sender, Button)
dim NewIndex as Integer
'if key was right arrow then.....
NewIndex = ButtonPressed.TabIndex +50
'Do checking to make sure it's not too low or too high
dim NewButton as Button = directcast(HT.item(NewIndex), Button)
NewButton.Focus
End Sub
This code is far from perfect, but it should get you going in the right
direction.
good luck
Chris
"Neil Wallace" <ro*******************@virgin.net> wrote in message
news:31*************@uni-berlin.de... Hi there,
I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel.
They are added in runtime, and so they adopt a sensible tab value. The tab key moves the focus down the column one by one, and the up and down arrow keys work well.
What I would like to do, however, is allow the user to use the right/left arrow keys to jump a column (i.e. current tab value +/- 10), and perhaps the page down/up keys to move by +/- 50. Presently these keys do the same as the tab key.
Help!
Cheers
Neil VB.net Newbie
Here's an idea. Not tested by any means, but...
Hold a hashtable of all your buttons as you add them at runtime. Add the
tabindex as the key and the control as the button. Then capture the
keypress event and figure out if you need to handle the arrow keys. If the
key pressed is an arrow look at the tabindex of the control, figure out what
the tabindex of the control you want to move to is. Look up the new
tabindex in the hashtable to find the control. Then set the focus onto the
control that is returned from the hashtable.
Something along these lines: (I don't have an editor to test w/ right now)
Dim HT as new HashTable
For ii as integer = 0 to 100
Dim Btn as New Button
'Setup the button and add to form
HT.Item.Add(btn.tabindex, btn)
AddHandler Btn.KeyDown, Address Btn_KeyDownEvent
Next
Private Sub Btn_KeyDownEvent(sender as object, e as Sometypeofeventhandler)
'Check for the key that was press, I think it is e.key or something like
that
dim ButtonPressed as Button = DirectCast(sender, Button)
dim NewIndex as Integer
'if key was right arrow then.....
NewIndex = ButtonPressed.TabIndex +50
'Do checking to make sure it's not too low or too high
dim NewButton as Button = directcast(HT.item(NewIndex), Button)
NewButton.Focus
End Sub
This code is far from perfect, but it should get you going in the right
direction.
good luck
Chris
"Neil Wallace" <ro*******************@virgin.net> wrote in message
news:31*************@uni-berlin.de... Hi there,
I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel.
They are added in runtime, and so they adopt a sensible tab value. The tab key moves the focus down the column one by one, and the up and down arrow keys work well.
What I would like to do, however, is allow the user to use the right/left arrow keys to jump a column (i.e. current tab value +/- 10), and perhaps the page down/up keys to move by +/- 50. Presently these keys do the same as the tab key.
Help!
Cheers
Neil VB.net Newbie
Thanks Chris,
I'll give it a go.
Neil
Chris, Master of All Things Insignificant wrote: Here's an idea. Not tested by any means, but...
Hold a hashtable of all your buttons as you add them at runtime. Add the tabindex as the key and the control as the button. Then capture the keypress event and figure out if you need to handle the arrow keys. If the key pressed is an arrow look at the tabindex of the control, figure out what the tabindex of the control you want to move to is. Look up the new tabindex in the hashtable to find the control. Then set the focus onto the control that is returned from the hashtable. Something along these lines: (I don't have an editor to test w/ right now) Dim HT as new HashTable
For ii as integer = 0 to 100 Dim Btn as New Button 'Setup the button and add to form HT.Item.Add(btn.tabindex, btn) AddHandler Btn.KeyDown, Address Btn_KeyDownEvent Next
Private Sub Btn_KeyDownEvent(sender as object, e as Sometypeofeventhandler) 'Check for the key that was press, I think it is e.key or something like that dim ButtonPressed as Button = DirectCast(sender, Button) dim NewIndex as Integer 'if key was right arrow then..... NewIndex = ButtonPressed.TabIndex +50 'Do checking to make sure it's not too low or too high dim NewButton as Button = directcast(HT.item(NewIndex), Button) NewButton.Focus End Sub
This code is far from perfect, but it should get you going in the right direction.
good luck Chris
"Neil Wallace" <ro*******************@virgin.net> wrote in message news:31*************@uni-berlin.de... Hi there,
I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel.
They are added in runtime, and so they adopt a sensible tab value. The tab key moves the focus down the column one by one, and the up and down arrow keys work well.
What I would like to do, however, is allow the user to use the right/left arrow keys to jump a column (i.e. current tab value +/- 10), and perhaps the page down/up keys to move by +/- 50. Presently these keys do the same as the tab key.
Help!
Cheers
Neil VB.net Newbie
Thanks Chris,
I'll give it a go.
Neil
Chris, Master of All Things Insignificant wrote: Here's an idea. Not tested by any means, but...
Hold a hashtable of all your buttons as you add them at runtime. Add the tabindex as the key and the control as the button. Then capture the keypress event and figure out if you need to handle the arrow keys. If the key pressed is an arrow look at the tabindex of the control, figure out what the tabindex of the control you want to move to is. Look up the new tabindex in the hashtable to find the control. Then set the focus onto the control that is returned from the hashtable. Something along these lines: (I don't have an editor to test w/ right now) Dim HT as new HashTable
For ii as integer = 0 to 100 Dim Btn as New Button 'Setup the button and add to form HT.Item.Add(btn.tabindex, btn) AddHandler Btn.KeyDown, Address Btn_KeyDownEvent Next
Private Sub Btn_KeyDownEvent(sender as object, e as Sometypeofeventhandler) 'Check for the key that was press, I think it is e.key or something like that dim ButtonPressed as Button = DirectCast(sender, Button) dim NewIndex as Integer 'if key was right arrow then..... NewIndex = ButtonPressed.TabIndex +50 'Do checking to make sure it's not too low or too high dim NewButton as Button = directcast(HT.item(NewIndex), Button) NewButton.Focus End Sub
This code is far from perfect, but it should get you going in the right direction.
good luck Chris
"Neil Wallace" <ro*******************@virgin.net> wrote in message news:31*************@uni-berlin.de... Hi there,
I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel.
They are added in runtime, and so they adopt a sensible tab value. The tab key moves the focus down the column one by one, and the up and down arrow keys work well.
What I would like to do, however, is allow the user to use the right/left arrow keys to jump a column (i.e. current tab value +/- 10), and perhaps the page down/up keys to move by +/- 50. Presently these keys do the same as the tab key.
Help!
Cheers
Neil VB.net Newbie This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: FredSP |
last post by:
I have a client who wishes to use the Enter Key and/or Arrow Keys, as well as
the Tab Key, to navigate between Fields in a Windows form.
Is this possible using C# in Visual Studio 2000 ?
|
by: skipc |
last post by:
Hi,
I am stuck... I've got a popup window that displays a list in table
format with links on the bottom to navigate the list <prev> 1 2 3 ...
<next>
When I demo'd to the users... they...
|
by: Neil Wallace |
last post by:
Hi there,
I have an application in which a grid of 100 or more buttons are put on a
form in columns of 10.
All the buttons are within a panel.
They are added in runtime, and so they adopt a...
|
by: Phil Galey |
last post by:
I have a Panel control docked on all sides on a form and the panel control
contains a PictureBox. I'm using the KeyDown event of the form to respond to
the and keys for resizing the image and the...
|
by: Gil |
last post by:
hello.
i would like to navigate my form with arrow keys by jumping to the next
control or previous control when ever i hit the up,down, left or right
key.
this works fine as long as i do not...
|
by: perse981 |
last post by:
Hi
I need to know how, if even possible, to enable the user of my program to control the Size and Posisiton of the circle I have Drawn on the form by using the Enter Key (to increase size), Shift...
|
by: boopsboops |
last post by:
Hi thescripts people, I hope I'm in the right forum for Visual Basic Dotnet (VS 2005).
I am trying to make a custom control in which you can nudge a point around using the arrow keys. Actually,...
|
by: Andrus |
last post by:
I have combobox column in DataGridView.
Up and down error keys should be used to navigate previous and next row in
grid.
For this I override them in ProcessCmdKey() event.
When combobox...
|
by: divingIn |
last post by:
Hi,
I have created a textbox like google suggest(or like yahoomail) that shows results using ajax as you type in. Now i am showing the results in a dynamic table under the textbox inside a div. But...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |