Subject Re: [IBO] multi-select
Author Geoff Worboys
> i want to copy records(more then one, but not all) from one
> 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.

OnMultiSelect is called when SelectAll or SelectRange is called for
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.

strs: TStringList
strs := TStringList.Create;
IB_Query.SelectedBookmarks( strs );
<do something with the list>

In your instance, wanting to copy records from one dataset to another,
I imagine something like...

for i := 0 to strs.Count - 1 do
// move the source dataset buffer position
// to the specific record for copying
IB_Query.BufferBookmark := strs[i];
// then setup the copy
<copy required fields>

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.


Geoff Worboys
Telesis Computing