Subject Re: [IBO] Re: IB_Grid - multiple deletion
Author Ramil
Sorry, DataSet is also my variable. I have listed code in my common
inheritable data edit form.
Use (Sender as TIB_CustomActionUpdate).DataSource.Dataset instead of
DataSet.

You must assign DataSource property of IB_ActionDelete action before.
Good luck!

Glad to help,
Ramil

> Hi Ramil,

> It looks great! But i have some other stupid question: How can I
> override it? I have to put a TActionList in the form? From where you
> take the property Dataset from, I mean, (DataSet as TIB_Query), where
> is "Dataset"?

> Thank you for the answer!

> []s, Marco André

> --- In IBObjects@yahoogroups.com, Ramil <khabibr@m...> wrote:
>> Override the standard IB Update action IB_ActionDelete with some
> like
>> that:
>>
>> procedure TCommonDataSetForm.IB_ActionDelete1Execute(Sender:
> TObject);
>> var
>> i, SelCount: Integer;
>> TempStrings, SelBookMarks: TStringList;
>> begin
>> SelBookMarks:=TStringList.Create;
>> TempStrings:=TStringList.Create;
>> try
>> (DataSet as TIB_Query).SelectedBookmarks(SelBookMarks);
>> SelCount:=SelBookMarks.Count;
>> if SelCount>0 then
>> begin
>> TempStrings.Clear;
>> TempStrings.AddStrings(DataSet.ConfirmDeletePrompt);
>> DataSet.ConfirmDeletePrompt.Clear;
>> try
>> DataSet.ConfirmDeletePrompt.Add(
>> 'Want delete selected rows ('+
>> IntToStr(SelCount)+')'#10+'from the table
>> "'+RefInfoProps.Caption+'"?');
>> // RefInfoProps.Caption it's my own variable
>> DataSet.DisableControls;
>> TIB_Query(DataSet).IB_Transaction.AutoCommit:=False;
>> try
>> for i:=0 to Pred(SelCount) do
>> begin
>> if i=1 then
>> DataSet.ConfirmDeletePrompt.Clear;
>> DataSet.Bookmark:=SelBookMarks[i];
>> DataSet.Delete;
>> end;
>> (DataSet as TIB_Query).SelectAll(False);
>> finally
>> DataSet.EnableControls;
>> TIB_Query(DataSet).IB_Transaction.AutoCommit:=True;
>> TIB_Query(DataSet).IB_Transaction.CommitRetaining;
>> end;
>> finally
>> DataSet.ConfirmDeletePrompt.AddStrings(TempStrings);
>> end;
>> end else IB_ActionDelete1.ExecuteTarget(Sender);
>> finally
>> TempStrings.Free;
>> SelBookMarks.Free;
>> end;
>> end;
>>
>> > Hi All,
>>
>> > How can I delete multiple selected rows in a TIB_Grid?
>>
>> > Thank you!
>>
>> > [Como posso deletar várias linhas selecionadas em um TIB_Grid
> ?]
>>
>> > []s, Marco André