Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 7, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: Using Tab key (or right-arrow) in Datagrid
Janet Thomas
Posts: 2
 
Using Tab key (or right-arrow) in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jun 07 6:34 AM
I have a datagrid where each row is a shipping destination and each column is a rate based on weight. Using in-line editing. When a user changes a rate in a column on the row, they want to tab to the next column on that row. What happens now is the tab key causes the onedited event to be fired but the focus doesn't move to the next column. Has anyone solved this? If not with using the tab key, then perhaps the right-arrow key?
(SLX 6.2.4 but going to V7.1 soon)
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Using Tab key (or right-arrow) in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jun 07 2:00 PM
The datagrid is pretty locked, so chances are if you're seeing a bug or a weird behavior it'll either be "fixed" in the next version or you'll just have to live with it. Upgrading is always a good option as the grid typically does get improvements between versions but even then there's no guarantee.

If right-arrow did work and the grid did by some chance have the OnKeyPress event, you could trap the Tab key then send the right-arrow instead. Essentially both keys would behave the same. OnKeyPress doesn't exist even in v7 so you may be able to use OnChangeNode or OnEdited to automatically move to the next column in the current row. Sad thing is I'm not even sure you can programmatically change focus because .Selection takes a recordId but I don't believe you can select single columns though I'd hope to be mistaken.
[Reply][Quote]
Janet Thomas
Posts: 2
 
Re: Using Tab key (or right-arrow) in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jun 07 5:38 AM
I had the same thought. OnEdited is firing so if I could: 1. figure out what column I was on, 2. check if they have pressed right arrow or tab, and 3. then move the focus to column+1, that would work. Unfortunately I can figure out how I can do any of these things!
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Using Tab key (or right-arrow) in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jun 07 9:36 AM
OnEditing in conjunction with OnEdited is most likely your best bet. You're given PrimaryKeyValue, FieldName, and Value properties. I store Value in a temp variable right off the bat because that allows me to go back to the "last known good" value if something were to mess up. The only real issue with this is you're using FieldName then you have to almost hardcode the next column to go to. The only other decent event that gives you the Column is OnFormatColumnText but I'm not exactly sure if that'll fire at the right time.

I'm also not exactly sure how you would change focus to the next column. I know there's the selection property but it only allows a keyfield parameter, which is the primary key. There's both the .Nodes and .SelectedNodes collections with the .Selected and .Index properties that should be helpful. SelectedNodes should give you the current node in focus but what I'm not clear on is if Index is based on that collection. If .Index applies strictly to selectednodes, then adding 1 to it and selecting that node won't work. You would then have to loop through the entire Nodes like this:

For (index = 0) To (Grid.Nodes.Count - 1)
If Grid.Nodes.Item(index).Selected Then
' Capture index for later
End If
Next
Grid.Nodes.Item(index).Selected = false
Grid.Nodes.Item(index + 1).Selected = true

There are problems with this method though. SelectedNodes implies that more than one node can be selected, unlike a treeview. This means you'll either have to grab the first selected node or the last one, as most likely these would be where the focus is. The other problem is I'm not sure if you need to unselect the current node, so I placed that in the second-to-last line. Lastly I'm not sure if you can trap the Tab or Right arrow keys so you may have to just automatically jump to the next column when done editing. That isn't necessarily a bad thing though. If you have time, you may want to see if looping through SelectedNodes will give you an .Nodes based index because it'll always be faster than looping through .Nodes (this is literally every column in every single row, possibly invisible columns as well).

In theory that is how it should work, but I've never done this kind of advanced stuff and I believe the .Nodes collection is only present in 7.0 grids but it may have been introduced in 6.2.
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Using Tab key (or right-arrow) in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Jun 07 9:16 AM
As Jeremy points out, we don't have a lot of control here......even in 7.

Still having trouble with RMB click on the grid versus LMB...throw in Group Headers and you'll see what I mean..at least we have more grid event handling in 7.01.

I believe it's Right Arrow to move to the next column FROM a selected cell......
but I wouldn't look to doing this automatically. Let the grid and user control the mouse clicks, you simply react to the OnEdited or OnEditing events.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/7/2025 11:53:42 AM