Thanks in advance,
Sheila Nelson
One method would be to emulate SelectAll by changing the background
color of the cells via ownerdraw.
Mike Orriss (m...@3kcc.co.uk)
http://www.3kcc.co.uk/notetree.htm
Sheila
Yes
> What I need is to give the user a
> select all option and then let them manually deselect a few so they have
> a quick and easy way to select say 80 out of 100 rows in a grid without
> having to manually select each one. Is there a better way to do this?
An alternative is to offer an Invert button so they just select the ones
that they don't want and then you toggle the records.
procedure TfrmMain.mnuEditSelectAllClick(Sender: TObject);
begin
with DBGrid1.Datasource.Dataset do
begin
BM := Bookmark;
DisableControls;
try
First;
while not eof do
begin
DBGrid1.SelectedRows.CurrentRowSelected := True;
next;
end;
finally
Bookmark := BM;
EnableControls;
end
end;
end;
procedure TfrmMain.mnuEditSelectNoneClick(Sender: TObject);
begin
with DBGrid1.Datasource.Dataset do
begin
BM := Bookmark;
DisableControls;
try
First;
while not eof do
begin
DBGrid1.SelectedRows.CurrentRowSelected := False;
next;
end;
finally
Bookmark := BM;
EnableControls;
end
end;
end
Herminio
Sheila L. Nelson wrote in message <36B1BB6C...@atgl.spear.navy.mil>...
>Can I assume that if I did it that way the grid control wouldn't
>recognize those rows as selected? What I need is to give the user a
>select all option and then let them manually deselect a few so they have
>a quick and easy way to select say 80 out of 100 rows in a grid without
>having to manually select each one. Is there a better way to do this?
>
>Sheila
>
>Mike Orriss wrote:
>
>> In article <36B0C897...@atgl.spear.navy.mil>, Sheila L. Nelson
>> wrote:
>> > How can I programmatically select all rows in a DbGrid when a user
>> > clicks a button?
>> >
>>
>> One method would be to emulate SelectAll by changing the background
>> color of the cells via ownerdraw.
>>
Sheila
Mike Orriss wrote:
> In article <36B1BB6C...@atgl.spear.navy.mil>, Sheila L. Nelson
> wrote:
> > Can I assume that if I did it that way the grid control wouldn't
> > recognize those rows as selected?
>
> Yes
>
> > What I need is to give the user a
> > select all option and then let them manually deselect a few so they have
> > a quick and easy way to select say 80 out of 100 rows in a grid without
> > having to manually select each one. Is there a better way to do this?
>
> An alternative is to offer an Invert button so they just select the ones
> that they don't want and then you toggle the records.
>