Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very heavy Grid navigation problems.

Status
Not open for further replies.

Qwark

Programmer
Sep 26, 2000
59
NL
Hello,

I use a grid in my application. It is read-only. The user must select whole rows just like a list box (that works). I can use the mouse for grid navigation (scrolling etc.). But I want use the arrow keys to for grid navigation.
Up: select the record up
Down: select the record down
Right: select the cell right (so i can scroll in my grid)
Left: select the cell left
I work with .KeyPress of the textboxes in the grid control and then activate a cell with .ActivateCell.
All is working till that the scrollbar is going to scroll.
On this moment i have made a special methode in my form wich handels the keypress of the textboxes central. For the left key I used the following:
xxx.grdPersonen.ActivateCell(xxx.grdPersonen.ActiveRow, xxx.grdPersonen.ActiveColumn-1)

I am waiting for your proffesional advise,

Qwark
 
Qwark,

Check out the 'DoScroll' method of the grid.

Otherwise use navigation through your table with skip and refresh the grid.

HTH,

Weedz
veld4663@exact.nl
 
Thanks Weedz, but I haved try DoScroll already. It doesn't work with doscorll i can't activate a cell or a row. Then I have try KeyPress in combination with .activatecell (activeRow and activeColumn) and that is working better. But not correctly.
For example:
A grid has a lot of textboxes. In a textbox I can use the arrow keys to scoll in the textbox it self. Now I have changes that with the keypress event and it works. But as I say when i push the same arrowkey again and again until the scrollbar must going to scroll. I can't activate the correct cell.

It sounds quite simple but I think it isn't maybe it is because I am a beginner.

Qwark
 
Qwark, Weedz also proposed the way to use skip and grid refresh methods. This is nice way, indeed. WHen arrow up - skip -1, arrow down - skip. To refresh, use grid.column(index).SetFocus, where index is index of the column currently focused by arrows. In addition, you might allow to move columns, so you should use columnorder property of column to set focus corrcetly to required column.

Hope this helped.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Sorry,

Guys I gona try it now. Maybe skip work better. But I though i can't move columns in that way. But Vlad give me his explatation. So with both threads i hope to solve the problem.

Qwark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top