410 Sonderspalten in Grids- F2-Fenstern » Historie » Version 5
[E] Frank S, 12.10.2016 16:29
1 | 1 | [X] Lutz G | h1. Sonderspalten in Grids- F2-Fenstern |
---|---|---|---|
2 | |||
3 | h1. CimColor per SQL |
||
4 | |||
5 | Auflistung weiterer Steuerfelder : [[Sonderfelder im SQL]] |
||
6 | bekannte CimFarb-Konstanten : [[CimColor]] (z.B. CimRed) |
||
7 | Entwicklungs-Tickets : {{collapse(Aufklappen) |
||
8 | #6977 Weitere Farben zur Hervorhebung: CimColor in Grids |
||
9 | #5495 CIM-Farben in Assistenten und dynam. Oberflächen verfügbar machen |
||
10 | #6109 Joined Columns in CimColumnHandler integrieren |
||
11 | }} |
||
12 | |||
13 | Farben per SQL in Prodat werden per Spaltenname und BOOL an bestimmten Oberflächen erzeugt. |
||
14 | Mehrere gleichartige Spaltenbezeichnungen werden interpretiert und bei True dargestellt. |
||
15 | -Gelb gewinnt vor Grün, Rot gewinnt vor Gelb und Grün.- Feldreihenfolge: der Erste mit True gewinnt |
||
16 | |||
17 | Verfügbare Farben: |
||
18 | * CimRed CimYellow CimGreen CimBlue CimBrown CimGray |
||
19 | |||
20 | Verfügbare Oberflächen: |
||
21 | 4 | [E] Frank S | * F2 und F4 |
22 | 1 | [X] Lutz G | * tabellarische Oberflächen (EditTable) |
23 | * Assistenten (Stand 06.2016: bei Einigen schon vorhanden, aber soll demnächst bei Allen dran > http://redmine.prodat-sql.de/issues/5495) |
||
24 | * SQL - abfragen |
||
25 | 2 | [X] Daniel S | * und überall, wo der *TCimColumnHandler* angebunden ist |
26 | 3 | [E] Frank S | ** TCimColumnHandler in Oberfläche, Propertie zuweisen, EnableColor |
27 | ** TCimColumnHandler.InitColumns nach dem Öffnen des DataSet aufrufen |
||
28 | ** Grid.OnCustomDrawCell mit "CimColumnHandlerFSL.RowStyle(ACanvas, AViewInfo);" "Bestücken" |
||
29 | |||
30 | In weiter Oberflächen einbauen: |
||
31 | * [[prodat-v-x:CimColumnHandler]] auf Form legen |
||
32 | ** GridView und Query angeben |
||
33 | ** in Options das EnableColor aktivieren |
||
34 | * Events anhängen |
||
35 | ** nach Query.Load > @CimColumnHandler1.InitColumns;@ |
||
36 | ** in GridView.OnCustomDrawCell > @CimColumnHandler1.RowStyle(ACanvas, AViewInfo);@ |
||
37 | 1 | [X] Lutz G | |
38 | Beispiel: |
||
39 | <pre><code class="sql"> |
||
40 | SELECT 1, true AS CimGreen, false AS CimYellow, false AS CimRed -- Grün |
||
41 | UNION |
||
42 | SELECT 2, false, true, false -- Gelb |
||
43 | UNION |
||
44 | SELECT 3, false, false, true -- Rot |
||
45 | UNION |
||
46 | SELECT 4, true, true, false -- Grün (Gelb überstimmt) |
||
47 | UNION |
||
48 | SELECT 5, true, true, true -- Grün (Gelb und Rot überstimmt) |
||
49 | |||
50 | ORDER BY 1 |
||
51 | </code></pre> |
||
52 | |||
53 | |||
54 | |||
55 | h1. Ausführliche Beschreibung |
||
56 | |||
57 | {{collapse(Aufklappen) |
||
58 | |||
59 | h2. mögliche Felder |
||
60 | |||
61 | <pre> |
||
62 | CimRed CimYellow CimGreen CimBlue CimBrown CimGray |
||
63 | CimColor |
||
64 | CimBold CimItalic |
||
65 | CimFontRed CimFontGreen |
||
66 | CimFormat |
||
67 | </pre> |
||
68 | |||
69 | * Gültigkeit: ganzzeilig |
||
70 | * Gültigkeit: Spalte oder Zelle mit Feldname als Präfix "field_format" (z.B. ak_nr_cimred) |
||
71 | * Auswertung: das erste Vorkommen (ungleich NULL, FALSE und '') hat immer Vorrang |
||
72 | ** es gilt die Erstellungsreihenfolge der Columns -> stimmt aber meistens mit der Reihenfolge der SQL-Felder überein (Daten aus Cache des Grids) |
||
73 | * doppelt gejoint möglich (cimred, cimred_1, cimred_2 bis cimred_3) |
||
74 | |||
75 | |||
76 | |||
77 | h2. Parameter für CimFormat (das Präfix "Cim" kann entfallen) |
||
78 | |||
79 | <pre> |
||
80 | CimRed CimYellow CimGreen CimBlue CimBrown CimGray + CimDarkRed CimOrange CimDarkOrange CimLightBlue CimDarkBlue |
||
81 | clBlack clMaroon clGreen clOlive clNavy clPurple clTeal clGray clSilver clRed clLime clYellow clBlue clFuchsia clAqua clLtGray clDkGray clWhite clMoneyGreen clSkyBlue clCream clMedGray clInfoBk clHotLight |
||
82 | CimColor |
||
83 | CimBold CimItalic |
||
84 | CimFontRed CimFontGreen |
||
85 | CimFontName/Font |
||
86 | CimFontSize/Size |
||
87 | </pre> |
||
88 | |||
89 | * Mehrere Angaben per *Komma* getrennt. |
||
90 | * @'cimred=True'@, @'cimred'@ (nur für Booleanwerte und gilt als True) oder @'cimred=:ag_done'@ (Referenz auf Booleanspalte) |
||
91 | * ebefalls ganzzeilig und zellenweise möglich ("field_format -> ak_nr_cimred=True) |
||
92 | * ungültige/unbekannte Formatnamen werden ignoriert (nichts ins Log geschrieben, da je ein Aufruf pro gezeichneter Zelle) |
||
93 | |||
94 | |||
95 | |||
96 | h2. Werte für CimColor |
||
97 | |||
98 | * @CimRed CimYellow CimGreen CimBlue CimGray + CimOrange CimDarkOrange CimDarkRed CimDarkBlue@ |
||
99 | * @clBlack clGreen clGray clSilver clRed@ uvm. (siehe http://docwiki.embarcadero.com/Libraries/XE7/de/Vcl.Graphics.TColor) |
||
100 | * @'#RRGGBB'@ oder @'#RGB'@ (HTML/CSS, siehe Tabelle mit RGB-Farbwerten https://meta.wikimedia.org/wiki/Wiki_color_formatting_help http://html-color-codes.info/webfarben_hexcodes/) |
||
101 | * @'$BBGGRR'@, @'Dezimal'@ oder @Dezimal@ (TColor/Integer/Float) |
||
102 | * @x'BBGGRR'::INT@ = DB-seitig HEX zu INT konvertiert |
||
103 | |||
104 | |||
105 | |||
106 | h2. Datentypen der DB-Felder |
||
107 | |||
108 | * CimColor/Color = Integer oder Text |
||
109 | * CimFormat = Text |
||
110 | * CimFontName = Text (z.B. Arial oder Microsoft Sans Serif -> siehe charmap.exe) |
||
111 | * CimFontSize = Integer (Default = 9) |
||
112 | * alles Andere = Boolean oder ':field' (verlinkung mit anderem Booleanfeld) |
||
113 | |||
114 | |||
115 | |||
116 | h2. Beispiele |
||
117 | |||
118 | * Reihenfolge |
||
119 | |||
120 | <pre><code class="sql"> |
||
121 | SELECT 'rot ' AS a, true AS cimred, true AS cimgreen; |
||
122 | |||
123 | SELECT 'grün' AS a, true AS cimgreen, true AS cimred; |
||
124 | </code></pre> |
||
125 | |||
126 | * Zeile oder Zelle/Spalte |
||
127 | |||
128 | <pre><code class="sql"> |
||
129 | SELECT 1 AS a, 2 AS b, 3 AS c, true AS cimred, false AS b_cimred -- ganze Zeile |
||
130 | UNION |
||
131 | SELECT 1 AS a, 2 AS b, 3 AS c, false AS cimred, true AS b_cimred -- nur B |
||
132 | </code></pre> |
||
133 | |||
134 | * Konkatenieren für CimFormat |
||
135 | |||
136 | <pre><code class="sql"> |
||
137 | SELECT 1 AS a, concat_ws(',', |
||
138 | 'cimgreen', |
||
139 | IfThen(true, 'bold', null), |
||
140 | IfThen(false, 'fontsize=4', null) |
||
141 | ) AS CimFormat --'cimgreen,bold' AS CimFormat |
||
142 | </code></pre> |
||
143 | |||
144 | * Alles das Gleiche (mehrere Varianten zur Übergabe von CimRed) |
||
145 | |||
146 | <pre><code class="sql"> |
||
147 | SELECT 1 AS aaa, true AS xxx, |
||
148 | true AS cimred, --xxx AS cimred, |
||
149 | ':xxx' AS cimred, |
||
150 | concat_ws(',', |
||
151 | 'red', |
||
152 | 'cimred', |
||
153 | 'cimred=True', |
||
154 | 'cimred=:xxx', |
||
155 | IfThen(true, 'cimred', null) --IfThen(xxx, 'cimred', null) |
||
156 | ) AS cimformat |
||
157 | </code></pre> |
||
158 | |||
159 | * Definition der Farbwerte |
||
160 | |||
161 | <pre><code class="sql"> |
||
162 | SELECT |
||
163 | 'A' AS a, '$0000FF' AS a_cimcolor, |
||
164 | 'B' AS b, x'0000FF'::INT AS b_cimcolor, -- 255 AS b_cimcolor |
||
165 | 'C' AS c, '#FF0000' AS c_cimcolor, |
||
166 | 'D' AS d, 'clRed' AS d_cimcolor, |
||
167 | 'E' AS e, 'CimRed' AS e_cimcolor, |
||
168 | 'Z' AS z, NULL::INT AS z_cimcolor |
||
169 | </code></pre> |
||
170 | |||
171 | * Megademo |
||
172 | !CCHMegademo.png! |
||
173 | |||
174 | <pre><code class="sql"> |
||
175 | SELECT |
||
176 | a, b, c, a=1 AS CimRed, 'Size=5' AS a_CimFormat, |
||
177 | b=5 AS b_CimBlue, IfThen(b=8, x'FFAAFF'::INT, null)::INT AS b_CimColor, --IfThen macht aus dem INT ein DECIMAL |
||
178 | 'cimgreen,bold' AS c_CimFormat |
||
179 | FROM ( |
||
180 | SELECT 1 AS a, 2 AS b, 3 AS c |
||
181 | UNION |
||
182 | SELECT 4, 5, 6 |
||
183 | UNION |
||
184 | SELECT 7, 8, 9 |
||
185 | ) AS x |
||
186 | ORDER BY a |
||
187 | </code></pre> |
||
188 | |||
189 | * Megademo (vollständig) |
||
190 | |||
191 | <pre><code class="sql"> |
||
192 | SELECT |
||
193 | a, b, c, |
||
194 | |||
195 | a=1 AS CimRed, a=1 AS CimYellow, false AS CimGreen, false AS CimBlue, false AS CimGray, null::INT AS CimColor, |
||
196 | false AS CimBold, false AS CimItalic, false AS CimFontRed, false AS CimFontGreen, |
||
197 | null::VARCHAR AS CimFormat, |
||
198 | |||
199 | false AS a_CimRed, false AS a_CimYellow, false AS a_CimGreen, false AS a_CimBlue, false AS a_CimGray, null::INT AS a_CimColor, |
||
200 | false AS a_CimBold, false AS a_CimItalic, false AS a_CimFontRed, false AS a_CimFontGreen, |
||
201 | 'Size=5' AS a_CimFormat, |
||
202 | |||
203 | false AS b_CimRed, false AS b_CimYellow, false AS b_CimGreen, b=5 AS b_CimBlue, b=5 AS b_CimGray, IfThen(b=8, x'FFAAFF'::INT, null) AS b_CimColor, |
||
204 | false AS b_CimBold, false AS b_CimItalic, false AS b_CimFontRed, false AS b_CimFontGreen, |
||
205 | null AS b_CimFormat, |
||
206 | |||
207 | false AS c_CimRed, false AS c_CimYellow, false AS c_CimGreen, false AS c_CimBlue, false AS c_CimGray, null::INT AS c_CimColor, |
||
208 | false AS c_CimBold, false AS c_CimItalic, false AS c_CimFontRed, false AS c_CimFontGreen, |
||
209 | concat_ws(',', 'cimgreen', IfThen(true, 'bold', null)) AS c_CimFormat --'cimgreen,bold' AS c_CimFormat |
||
210 | FROM ( |
||
211 | SELECT 1 AS a, 2 AS b, 3 AS c |
||
212 | UNION |
||
213 | SELECT 4, 5, 6 |
||
214 | UNION |
||
215 | SELECT 7, 8, 9 |
||
216 | ) AS x |
||
217 | ORDER BY a |
||
218 | </code></pre> |
||
219 | |||
220 | }} |
||
221 | |||
222 | --- |