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


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
Font.Color: = clYellow;
Brush.Color: = clBlack;
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];


Memory: 0.56 MB
Time: 0.024 c
2003-03-04 18:28
(w2k) How to close an application called exe in NT systems.

2003-04-15 06:10
Problem with dbchart

2003-04-19 02:03
HELP!!! How to make a character decoder on the table ???????

2003-04-14 17:58
The site storage area was robbed :)

2003-04-15 20:39
What is the string alignment ^ I?

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 Spanish 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
English French German Italian Portuguese Russian Spanish