Programmatically selecting a row |
Post Reply |
Author | |
John31
Groupie Joined: 08 December 2005 Location: United States Status: Offline Points: 70 |
Post Options
Thanks(0)
Posted: 02 February 2006 at 1:57pm |
Is it possible to select a row programmatically? For example: The user is looking a record that is near the bottom of the list and has scrolled to get there. The user deletes this record. I can get the view to stay the same by restoring the TopRowIndex to the value it was before the Populate routine. However, if the user hits an arrow key the rc jumps to the top of the list. I have tried the following but it does not work as the row selected value goes back to false.
Any Ideas? lTopIndex = RC1.TopRowIndex ' loop through all report records
|
|
Regards
John Layton |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Try setting the ReportControl.FocusedRow
|
|
John31
Groupie Joined: 08 December 2005 Location: United States Status: Offline Points: 70 |
Post Options
Thanks(0)
|
Mario Did you mean FocusedRow? This does not highlight the record either. Any other ideas?
|
|
Regards
John Layton |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
I just tried this:
Set wndReportControl.FocusedRow = wndReportControl.Rows(8) and it both focuses and selects the row. Is this not what you want? |
|
John31
Groupie Joined: 08 December 2005 Location: United States Status: Offline Points: 70 |
Post Options
Thanks(0)
|
I got this to work some of the time. Here is my dilemma, I think. The records in the ReportControl are pulled from a DB and then sorted various ways depending on user input. I then send a command to my server using the record id for each selected column to delete. When I get the server response it sends me back list of records that it has deleted which is the sRecID string in the code above. I have no problem finding the records to delete using the code above. Finding the relative row to set focus back to is what the problem is. I can store the last index of the last removed record and then find this row. However, given that the ReportRows are sorted there is no guarantee that the row associated with the last index -1 is near the row that was just deleted. Does this make sense or am I confusing everyone.
|
|
Regards
John Layton |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Maybe you should use ReportRows.FindRow method to find the Row, then get its index. You should get the Row index and not the Record index ans the Record index will remain the same.
|
|
John31
Groupie Joined: 08 December 2005 Location: United States Status: Offline Points: 70 |
Post Options
Thanks(0)
|
I think I figured a faster way to do it but I need to know if I can LOCK the report control so they cannot click anything else until the process is complete? Is there a way to do this?
|
|
Regards
John Layton |
|
John31
Groupie Joined: 08 December 2005 Location: United States Status: Offline Points: 70 |
Post Options
Thanks(0)
|
This works great if the user has not selected another record between delete and the server reply
' get the current top row to use later |
|
Regards
John Layton |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Maybe you can first delete the record from your database, then after the delete is finished you can delete it from the ReportControl.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |