Subject | Re: [IBO] multi-select |
---|---|
Author | Geoff Worboys |
Post date | 2001-05-04T02:32:21Z |
> i want to copy records(more then one, but not all) from oneOnMultiSelect is called when SelectAll or SelectRange is called for
> ib_grid into another one that looks on a different table.
> i've found the onmultiselect-method in the ib_query but
> couldn't find out how to use it.
the query. Which will happen on a grid when you have IndicateSelected
set to true and the user hold the Shift (or Ctrl+Shift for all) key
down while left clicking (to select) or right clicking (to unselect) a
range of records.
However I suspect this is not what you are specifically looking for...
TIB_Query has an array property Selected[] which allows you to
set/detect whether a particular row (by row number) has been selected.
It also has a method SelectedBookmarks that allows you to a fill a
string list with bookmarks of all records that were selected. eg.
var
strs: TStringList
begin
strs := TStringList.Create;
try
IB_Query.SelectedBookmarks( strs );
<do something with the list>
finally
strs.Free;
end;
end;
In your instance, wanting to copy records from one dataset to another,
I imagine something like...
for i := 0 to strs.Count - 1 do
begin
// move the source dataset buffer position
// to the specific record for copying
IB_Query.BufferBookmark := strs[i];
// then setup the copy
DestinQuery.Insert;
<copy required fields>
DestinQuery.Post;
end;
If there is likely to be a large number of records, you may be better
off performing the insert using a separate DSQL component setup
specifically to insert using parameters, and then refresh the
destinquery when all the inserts are done.
HTH
Geoff Worboys
Telesis Computing