410 Sonderspalten in Grids- F2-Fenstern » Historie » Version 11
[X] Jens M, 25.07.2017 10:14
1 | 9 | [E] Frank S | h1. Sonderspalten in Grids- / F2-Fenstern |
---|---|---|---|
2 | 1 | [X] Lutz G | |
3 | h1. CimColor per SQL |
||
4 | |||
5 | 7 | [E] Frank S | Auflistung weiterer Steuerfelder : [[prodat-v-x:Sonderfelder im SQL]] |
6 | bekannte CimFarb-Konstanten : [[prodat-v-x:CimColor]] (z.B. CimRed) |
||
7 | 1 | [X] Lutz G | 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 | 10 | [X] Jens M | ** *TCimColumnHandler.InitColumns* nach dem Öffnen des DataSet aufrufen |
28 | 3 | [E] Frank S | ** 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 | 11 | [X] Jens M | * ggf. die Spalte (z.B.: @abc_cimred@) mit *ins Grid* aufnehmen (Visibles false) |
38 | 1 | [X] Lutz G | |
39 | Beispiel: |
||
40 | <pre><code class="sql"> |
||
41 | SELECT 1, true AS CimGreen, false AS CimYellow, false AS CimRed -- Grün |
||
42 | UNION |
||
43 | SELECT 2, false, true, false -- Gelb |
||
44 | UNION |
||
45 | SELECT 3, false, false, true -- Rot |
||
46 | UNION |
||
47 | SELECT 4, true, true, false -- Grün (Gelb überstimmt) |
||
48 | UNION |
||
49 | SELECT 5, true, true, true -- Grün (Gelb und Rot überstimmt) |
||
50 | |||
51 | ORDER BY 1 |
||
52 | </code></pre> |
||
53 | |||
54 | |||
55 | |||
56 | h1. Ausführliche Beschreibung |
||
57 | |||
58 | {{collapse(Aufklappen) |
||
59 | |||
60 | h2. mögliche Felder |
||
61 | |||
62 | <pre> |
||
63 | CimRed CimYellow CimGreen CimBlue CimBrown CimGray |
||
64 | CimColor |
||
65 | 6 | [E] Frank S | CimBold CimItalic CimUnterline CimStrikeOut |
66 | 1 | [X] Lutz G | CimFontRed CimFontGreen |
67 | CimFormat |
||
68 | </pre> |
||
69 | |||
70 | * Gültigkeit: ganzzeilig |
||
71 | * Gültigkeit: Spalte oder Zelle mit Feldname als Präfix "field_format" (z.B. ak_nr_cimred) |
||
72 | * Auswertung: das erste Vorkommen (ungleich NULL, FALSE und '') hat immer Vorrang |
||
73 | ** es gilt die Erstellungsreihenfolge der Columns -> stimmt aber meistens mit der Reihenfolge der SQL-Felder überein (Daten aus Cache des Grids) |
||
74 | * doppelt gejoint möglich (cimred, cimred_1, cimred_2 bis cimred_3) |
||
75 | |||
76 | |||
77 | |||
78 | h2. Parameter für CimFormat (das Präfix "Cim" kann entfallen) |
||
79 | |||
80 | <pre> |
||
81 | CimRed CimYellow CimGreen CimBlue CimBrown CimGray + CimDarkRed CimOrange CimDarkOrange CimLightBlue CimDarkBlue |
||
82 | clBlack clMaroon clGreen clOlive clNavy clPurple clTeal clGray clSilver clRed clLime clYellow clBlue clFuchsia clAqua clLtGray clDkGray clWhite clMoneyGreen clSkyBlue clCream clMedGray clInfoBk clHotLight |
||
83 | CimColor |
||
84 | 6 | [E] Frank S | CimBold CimItalic CimUnterline CimStrikeOut |
85 | 1 | [X] Lutz G | CimFontRed CimFontGreen |
86 | CimFontName/Font |
||
87 | CimFontSize/Size |
||
88 | </pre> |
||
89 | |||
90 | * Mehrere Angaben per *Komma* getrennt. |
||
91 | * @'cimred=True'@, @'cimred'@ (nur für Booleanwerte und gilt als True) oder @'cimred=:ag_done'@ (Referenz auf Booleanspalte) |
||
92 | * ebefalls ganzzeilig und zellenweise möglich ("field_format -> ak_nr_cimred=True) |
||
93 | * ungültige/unbekannte Formatnamen werden ignoriert (nichts ins Log geschrieben, da je ein Aufruf pro gezeichneter Zelle) |
||
94 | |||
95 | |||
96 | |||
97 | h2. Werte für CimColor |
||
98 | |||
99 | * @CimRed CimYellow CimGreen CimBlue CimGray + CimOrange CimDarkOrange CimDarkRed CimDarkBlue@ |
||
100 | * @clBlack clGreen clGray clSilver clRed@ uvm. (siehe http://docwiki.embarcadero.com/Libraries/XE7/de/Vcl.Graphics.TColor) |
||
101 | * @'#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/) |
||
102 | * @'$BBGGRR'@, @'Dezimal'@ oder @Dezimal@ (TColor/Integer/Float) |
||
103 | * @x'BBGGRR'::INT@ = DB-seitig HEX zu INT konvertiert |
||
104 | |||
105 | |||
106 | |||
107 | h2. Datentypen der DB-Felder |
||
108 | |||
109 | * CimColor/Color = Integer oder Text |
||
110 | * CimFormat = Text |
||
111 | * CimFontName = Text (z.B. Arial oder Microsoft Sans Serif -> siehe charmap.exe) |
||
112 | * CimFontSize = Integer (Default = 9) |
||
113 | * alles Andere = Boolean oder ':field' (verlinkung mit anderem Booleanfeld) |
||
114 | |||
115 | |||
116 | |||
117 | h2. Beispiele |
||
118 | |||
119 | * Reihenfolge |
||
120 | |||
121 | <pre><code class="sql"> |
||
122 | SELECT 'rot ' AS a, true AS cimred, true AS cimgreen; |
||
123 | |||
124 | SELECT 'grün' AS a, true AS cimgreen, true AS cimred; |
||
125 | </code></pre> |
||
126 | |||
127 | * Zeile oder Zelle/Spalte |
||
128 | |||
129 | <pre><code class="sql"> |
||
130 | SELECT 1 AS a, 2 AS b, 3 AS c, true AS cimred, false AS b_cimred -- ganze Zeile |
||
131 | UNION |
||
132 | SELECT 1 AS a, 2 AS b, 3 AS c, false AS cimred, true AS b_cimred -- nur B |
||
133 | </code></pre> |
||
134 | |||
135 | * Konkatenieren für CimFormat |
||
136 | |||
137 | <pre><code class="sql"> |
||
138 | SELECT 1 AS a, concat_ws(',', |
||
139 | 'cimgreen', |
||
140 | IfThen(true, 'bold', null), |
||
141 | IfThen(false, 'fontsize=4', null) |
||
142 | ) AS CimFormat --'cimgreen,bold' AS CimFormat |
||
143 | </code></pre> |
||
144 | |||
145 | * Alles das Gleiche (mehrere Varianten zur Übergabe von CimRed) |
||
146 | |||
147 | <pre><code class="sql"> |
||
148 | SELECT 1 AS aaa, true AS xxx, |
||
149 | true AS cimred, --xxx AS cimred, |
||
150 | ':xxx' AS cimred, |
||
151 | concat_ws(',', |
||
152 | 'red', |
||
153 | 'cimred', |
||
154 | 'cimred=True', |
||
155 | 'cimred=:xxx', |
||
156 | IfThen(true, 'cimred', null) --IfThen(xxx, 'cimred', null) |
||
157 | ) AS cimformat |
||
158 | </code></pre> |
||
159 | |||
160 | * Definition der Farbwerte |
||
161 | |||
162 | <pre><code class="sql"> |
||
163 | SELECT |
||
164 | 'A' AS a, '$0000FF' AS a_cimcolor, |
||
165 | 'B' AS b, x'0000FF'::INT AS b_cimcolor, -- 255 AS b_cimcolor |
||
166 | 'C' AS c, '#FF0000' AS c_cimcolor, |
||
167 | 'D' AS d, 'clRed' AS d_cimcolor, |
||
168 | 'E' AS e, 'CimRed' AS e_cimcolor, |
||
169 | 'Z' AS z, NULL::INT AS z_cimcolor |
||
170 | </code></pre> |
||
171 | |||
172 | * Megademo |
||
173 | !CCHMegademo.png! |
||
174 | |||
175 | <pre><code class="sql"> |
||
176 | SELECT |
||
177 | a, b, c, a=1 AS CimRed, 'Size=5' AS a_CimFormat, |
||
178 | b=5 AS b_CimBlue, IfThen(b=8, x'FFAAFF'::INT, null)::INT AS b_CimColor, --IfThen macht aus dem INT ein DECIMAL |
||
179 | 'cimgreen,bold' AS c_CimFormat |
||
180 | FROM ( |
||
181 | SELECT 1 AS a, 2 AS b, 3 AS c |
||
182 | UNION |
||
183 | SELECT 4, 5, 6 |
||
184 | UNION |
||
185 | SELECT 7, 8, 9 |
||
186 | ) AS x |
||
187 | ORDER BY a |
||
188 | </code></pre> |
||
189 | |||
190 | * Megademo (vollständig) |
||
191 | |||
192 | <pre><code class="sql"> |
||
193 | SELECT |
||
194 | a, b, c, |
||
195 | |||
196 | a=1 AS CimRed, a=1 AS CimYellow, false AS CimGreen, false AS CimBlue, false AS CimGray, null::INT AS CimColor, |
||
197 | false AS CimBold, false AS CimItalic, false AS CimFontRed, false AS CimFontGreen, |
||
198 | null::VARCHAR AS CimFormat, |
||
199 | |||
200 | 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, |
||
201 | false AS a_CimBold, false AS a_CimItalic, false AS a_CimFontRed, false AS a_CimFontGreen, |
||
202 | 'Size=5' AS a_CimFormat, |
||
203 | |||
204 | 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, |
||
205 | false AS b_CimBold, false AS b_CimItalic, false AS b_CimFontRed, false AS b_CimFontGreen, |
||
206 | null AS b_CimFormat, |
||
207 | |||
208 | 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, |
||
209 | false AS c_CimBold, false AS c_CimItalic, false AS c_CimFontRed, false AS c_CimFontGreen, |
||
210 | concat_ws(',', 'cimgreen', IfThen(true, 'bold', null)) AS c_CimFormat --'cimgreen,bold' AS c_CimFormat |
||
211 | FROM ( |
||
212 | SELECT 1 AS a, 2 AS b, 3 AS c |
||
213 | UNION |
||
214 | SELECT 4, 5, 6 |
||
215 | UNION |
||
216 | SELECT 7, 8, 9 |
||
217 | ) AS x |
||
218 | ORDER BY a |
||
219 | </code></pre> |
||
220 | |||
221 | }} |
||
222 | |||
223 | --- |