Accessing Data

TeeGrid .NET for Microsoft Visual Studio .NET.
Post Reply
Curt K.
Newbie
Newbie
Posts: 6
Joined: Wed Jan 22, 2020 12:00 am

Accessing Data

Post by Curt K. » Tue Jan 28, 2020 4:04 pm

I purchased the TGrid based upon all the demos, and tried them out and decided to purchase thinking that all the "standard" (compared to .net's data grid) data access routines would be similar. Unless I'm looking in the wrong place, there isn't any replication of the winforms .net data grid access, and it's very frustrating attempting to deal with user input and then refresh the data underneath.

For example, I'm querying data from a web service every minute. I'd like to make it appear seamless to the user so if they've selected a row, after the data is refreshed, if the data within the row is still there (not deleted, but updated) I'd like to re-select the row. Both as a row indicator and row highlight (full row select).

As a test, I've attempted to select row 1 no matter what the user clicks on using the code below. The grid will show other full row selects and keep the row "indicator" at 1. What I would expect to happen is that the row indicator stays at row 1 (the grid does this), AND the row selection stays at row 1 (grid does not do this). I'm OK with calling a line of code that selects the row, but unable to find that code.

All or part of the lines of code below will set the row indicator (far left "navigation" column) to row 1 (as expected), but the user can click on any other rows and the whole row is selected (would expect the row selected to go back to row 1).

private void Selected_Changed(object sender, EventArgs e)
{
GridMain.Selected.ChangeSelection(null, 1, Keys.Enter);
GridMain.Selected.FullRow = true;
sel = GridMain.Grid.Current.Selected;
GridMain.Selected.ChangeSelection(sel.Column, 1, Keys.Enter);
GridMain.Select();
}


The above code is just a test, but what I really want is when the data is refreshed, I'm going to look up the object that was previously selected (before the refresh), and then re-select the row (if the underlying data in the new object exists) after the refresh. I don't want the default row (probably row 0) highlighted, but the row indicator positioned at the found object row. They should both be pointing at or highlighting the same row.

Hope that makes sense.

thanks,
Curt

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Accessing Data

Post by Christopher » Thu Jan 30, 2020 3:59 pm

Hello Curt,
The above code is just a test, but what I really want is when the data is refreshed, I'm going to look up the object that was previously selected (before the refresh), and then re-select the row (if the underlying data in the new object exists) after the refresh. I don't want the default row (probably row 0) highlighted, but the row indicator positioned at the found object row. They should both be pointing at or highlighting the same row.

Hope that makes sense.
It makes sense, but I'm afraid I'm not as sure of what you want to achieve as I would be if I could see the issue - does one of the TeeGrid examples you've looked at also show this behaviour (or can be modified to do so)?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Curt K.
Newbie
Newbie
Posts: 6
Joined: Wed Jan 22, 2020 12:00 am

Re: Accessing Data

Post by Curt K. » Thu Jan 30, 2020 4:21 pm

Hi Christopher,

Thanks for the answer.

My take is the TeeGrid rows/columns are all "integer" based (with no direct access to the bound data object(s), so when you link into an event, you get the row or column integer, and can't get directly to the bound object.

What I'm doing is grabbing data, displaying it (with various paint events) and then every minute or so refreshing the data (new bound objects coming off of a web service). What data (bound object) was at row index 5 before a refresh is no longer at index 5. So I need to look up my object get a piece of data that can be used to re-select the row the user had selected and then re-select it programmatically after the refresh. I have figured out how to do this, but was a little clumsy using row indexes. I've turned off the ability to sort on columns because the indexes won't match up I'm assuming (haven't had a chance to confirm)? I'm assuming the row index is always the index into the bound List (for example if the user sorts on a different column, is the new grid row index still pointing to index of the underlying List<> object?, or is it simply row 1 = index 0, no matter the order of the underlying list). Unfortunately I made the mistake that switching to the TeeGrid from the DataGrid would be easy due to a lot of similarity, and that hasn't been the case.

Thanks,
Curt

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Accessing Data

Post by Christopher » Thu Jan 30, 2020 4:34 pm

Hello Curt,

Okay, glad to hear you've got the row reselect to work.

TeeGrid is not a clone of the standard .NET grid plus extras, it has a slightly different way of working which we hope you will find easy and intuitive after a while. At the same time, we are very open to suggestions for new features, so if there's anything you'd like to see in TeeGrid please don't hesitate to add it to our issue tracker.

You've come to the right place for support issues though. Of course we do what we can to resolve issues that have been explained to us in text, but there's nothing like code examples for getting precisely and quickly to the issues at hand. Do please feel free to query us with any difficulties you may find!
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply