Subject | Bookmarks and Grids |
---|---|
Author | staff@belding |
Post date | 2001-02-12T02:01:32Z |
Hello All
I have an IB_Grid with an IB_Query for its datasource. I am using the
OrderingItems and OrderingLinks of the query object to allow users to sort
the grid's columns. This is all OK.
If a grid row is selected and a reorder is done the selected row changes. I
would like to have the selected row persist through a column reorder.
Perhaps using a bookmark is best here. Now the question is which query or
grid event
is best to use first capture the existing selected row and secondly to tell
the query to return to a saved bookmark. Perhaps the
event I want is the Queries OnOrderingChange?
Looking at this event, it is called twice after a title button is pressed.
The first call is done when the Query.Active is false. But the
Query.Bookmark points to the existing selected row. The second call has
Query.Active true and can be used to set the Query.bookmark.
Here is code for the event.
procedure Form1.qrGridQueryOrderingChange(IB_Dataset : TIB_Dataset);
begin {called twice on each ordering change, once acitve=False, once
active=True}
{my conditions for entry}
with qrGridQuery do
begin
if not Active then
begin
desiredBookmark := bookmark;
Exit;
end:{not Active}
bookmark := desiredBookmark;
end;{with ..}
end;{OrderingChange}
The volume of data in the grid is small. With D5 and IBO 3.6Ce Test3 this
works.
Is there a better way to achieve my goal?
Am I inviting problems assuming the OnOrderingChange event always will work
this way?
I tried using event Grid event OnTitleClick to captur the bookmark of the
prior select row but when this event is called the Query.Bookmark of the
selected row is the null string.
Regards and thanks
Russell
I have an IB_Grid with an IB_Query for its datasource. I am using the
OrderingItems and OrderingLinks of the query object to allow users to sort
the grid's columns. This is all OK.
If a grid row is selected and a reorder is done the selected row changes. I
would like to have the selected row persist through a column reorder.
Perhaps using a bookmark is best here. Now the question is which query or
grid event
is best to use first capture the existing selected row and secondly to tell
the query to return to a saved bookmark. Perhaps the
event I want is the Queries OnOrderingChange?
Looking at this event, it is called twice after a title button is pressed.
The first call is done when the Query.Active is false. But the
Query.Bookmark points to the existing selected row. The second call has
Query.Active true and can be used to set the Query.bookmark.
Here is code for the event.
procedure Form1.qrGridQueryOrderingChange(IB_Dataset : TIB_Dataset);
begin {called twice on each ordering change, once acitve=False, once
active=True}
{my conditions for entry}
with qrGridQuery do
begin
if not Active then
begin
desiredBookmark := bookmark;
Exit;
end:{not Active}
bookmark := desiredBookmark;
end;{with ..}
end;{OrderingChange}
The volume of data in the grid is small. With D5 and IBO 3.6Ce Test3 this
works.
Is there a better way to achieve my goal?
Am I inviting problems assuming the OnOrderingChange event always will work
this way?
I tried using event Grid event OnTitleClick to captur the bookmark of the
prior select row but when this event is called the Query.Bookmark of the
selected row is the null string.
Regards and thanks
Russell