Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Bases";
Current archive: 2003.05.01;
Download: [xml.tar.bz2];

Down

How to select current row in dbgrid? Find similar branches


ksa   (2003-04-11 13:40) [0]

There is a DbGrig, I would like to highlight the current row in color, if you set the dgRowSelect property, then if you scroll the grid to the right and click on a cell, the grid automatically scrolls to the first column.



Abrams   (2003-04-11 13:45) [1]

Handle DBGridDrawColumnCell event
and write something like that there:

if gdSelected in state then
with DBGrid.Canvas do
begin
Font.Color: = clYellow;
Brush.Color: = clBlack;
end;
DBGrid.DefaultDrawDataCell (Rect, Column.Field, State);



ksa   (2003-04-12 08:45) [2]

The problem is that the condition (gdSelected in state) is executed only on the current cell, and I need to select the entire line ...



ЮЮ   (2003-04-12 09:34) [3]

Variant 1. In AfterScroll-e DataSet, remember the value of the key field, and in DrawDataCell-e DBGrid, we store this value with the value of the key field of the record being drawn



Шаман   (2003-04-12 10:42) [4]

And even easier to put InfoPower 3000, the good of the cracks under it is dark, and it is pleasant to the eye and there is no need to strain for nothing.



Цук   (2003-04-12 10:44) [5]

Option Yu is not the best because Pressing Page Down or Page Up or while scrolling with the mouse wheel moves the cursor and the bar remains.



Alexandr   (2003-04-12 11:13) [6]

enjoy your health

type THackDBGrid = class (TDBGridEh) property DataLink; property UpdateLock; end; procedure TForm1.MyGetCellParams (Sender: TObject; Column: TColumnEh; AFont: TFont; var Background: TColor; State: TGridDrawState); var Selected: Boolean; begin if INI1.currentLine then begin Selected: = THackDBGrid (Sender) .Datalink. Active and (THackDBGrid (sender). Row - 1 = THackDBGrid (sender) .Datalink.ActiveRecord); if selected then begin BackGround: = INI1.FonCurrentLine; end; end; end;



grusty   (2003-04-13 13:29) [7]

Abrams is absolutely right. The only thing you need is to set the Options / dgRowSelect property to True in DBGrid. Then the whole line will be highlighted.
Another option is to download the EhLib library, where there is an excellent DBGridEh component and handle the OnDrowColumnCell event as follows:

if Rect.Top = DBGridEh2.CellRect (DBGridEh2.Col, DBGridEh2.Row) .Top then DBGridEh2.Canvas.Brush.Color: = clAqua;
DBGridEh2.DefaultDrawColumnCell (Rect, DataCol, Column, State);



Pages: 1 whole branch

Forum: "Bases";
Current archive: 2003.05.01;
Download: [xml.tar.bz2];

Top









Memory: 0.57 MB
Time: 0.023 c
We answer immediately.
Axill
2003-04-14 13:48
2003.05.01
Gentlemen, please help! Transfer!


We answer immediately.
Sergo
2003-04-15 11:21
2003.05.01
BIOS


We answer immediately.
tv
2003-04-21 10:58
2003.05.01
TreeView & Unicode


We answer immediately.
- = DeMoH = -
2003-04-13 14:58
2003.05.01
Help with Excel !!!


We answer immediately.
Cybermozg
2003-04-19 13:50
2003.05.01
How to clean the resources?





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Español swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish