Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Da li je ovo bug ili sta? DbGrid, csDefault ...

[es] :: Pascal / Delphi / Kylix :: Da li je ovo bug ili sta? DbGrid, csDefault ...

[ Pregleda: 1863 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Shejn
Srbija

Član broj: 11830
Poruke: 232
*.static.beocity.net.



Profil

icon Da li je ovo bug ili sta? DbGrid, csDefault ...10.07.2007. u 11:33 - pre 204 meseci
E ovako,
ono sto je ideja je da kada odredjeni korisnik usvoji neku stavku, boja treba da joj se promeni u dbGridu.
Da bi ovo radilo treba da se postavi u OnFormCreate ili u OnFormShow

Code:

  dbGrid1.Columns.State := csDefault;
  dbGrid2.Columns.State := csDefault;


i zatim da se na gridu u okviru OnDrawDataCell odradi sledace :

Code:

  if (DataModul.stavkaQ.FieldByName('odlucio_stavka').AsString = Neko) ) then
  begin
    dbGrid2.Canvas.Font.Color := $0000BF00;
    dbGrid2.Canvas.Font.Style := dbGrid2.Canvas.Font.Style + [fsBold];
  end;

  dbGrid2.DefaultDrawDataCell(Rect, Field, State);


problem je da se onda raspored kolona promeni prema nekom rasporedu, i tu posle nema pomoci, to je to, nema sanse da se taj raspored promeni.

Ok, uzmem i promenim raspored kolona u Columns editor i dalje nista.
Ok, probam da otvarim dataseta pre ili posle postavljanja dbGrid1.Columns.State- a ali nema uticaja, nema rasporeda.
Ok, uzmem i promenim raspored kolona u samoj tabeli, but noooo, i dalje nista.
Ok, cisto reko da proverim uzmem i iskomentarisem:

Code:

//  dbGrid1.Columns.State := csDefault;
//  dbGrid2.Columns.State := csDefault;


i evo ga raspored po mom izboru ... ali ... sada nema promene boje posle usvajanja !!!
Ako postavim csCustomized umesto csDefault nema bojenja.


Help kaze:

Citat:

Determines whether the columns in the data grid are dependent on dataset fields.

type TDBGridColumnsState = (csDefault, csCustomized);
property State: TDBGridColumnsState;

Description

If State is set to csDefault, columns in the data grid are generated dynamically from information in the grid’s associated dataset. The appearance, order, and other properties of the columns are determined by the dataset fields. Changes made to the columns are reflected in the dataset fields, and vice versa.

If State is set to csCustomized, many properties of the data-grid columns are independent of the associated dataset. For example, a column’s title caption is, by default, the same as the associated field’s DisplayLabel property; if State is csCustomized, however, the column title’s Caption property and the field’s DisplayLabel property can be changed independently. In fact, a customized (or “persistent”) column need not be associated with a dataset field at all.

Note: If the Columns editor is used to configure data-grid columns, State is automatically set to csCustomized. Changing the State property at runtime deletes all existing columns.

ali ja u datasetu promenim raspored, znaci odradim select polj1, polj2, ... from ... a ne select * from .... u datasetu, ali se ono i dalje ne menja raspored.

Znam da je slucaj najverovatnije unikatan ali reko ajde bas da pitam, jel ovo bug ili sta ...




 
Odgovor na temu

viking13
Aleksandar Milanovic
SBB
Novi Beograd

Član broj: 131741
Poruke: 190
*.sbb.co.yu.



Profil

icon Re: Da li je ovo bug ili sta? DbGrid, csDefault ...10.07.2007. u 12:53 - pre 204 meseci
Citat:
Shejn: E ovako,
ono sto je ideja je da kada odredjeni korisnik usvoji neku stavku, boja treba da joj se promeni u dbGridu.


Imam jedno debilno pitanje.

Da li si ti uopste stavio DBGrid1.DefaultDrawing na False?

btw. Sad videh da koristiš OnDrawDataCell. Zaboravi lepo na to i koristi OnDrawColumnCell.
viking ®
 
Odgovor na temu

[es] :: Pascal / Delphi / Kylix :: Da li je ovo bug ili sta? DbGrid, csDefault ...

[ Pregleda: 1863 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.