Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi "const A = array of TArrays" = Gehirnmatsch (https://www.delphipraxis.net/141015-const-%3D-array-tarrays-%3D-gehirnmatsch.html)

turboPASCAL 30. Sep 2009 16:52


"const A = array of TArrays" = Gehirnmatsch
 
Hi,

Mir brummt es im Gehirn und die IDE schiert laufend ab.
Ich habe volgendes:

Delphi-Quellcode:
type
  TBtnColors = array [0..3] of COLORREF;
  TColorBntState = (cbsUp, cbsDown);
  TColorBtn = record
    TextColor: COLORREF; // <--<<
    Colors: array [cbsUp..cbsDown] of TBtnColors;
  end;
  TColorButtonColors = (cbcRed, cbcBlue, cbcSilver);

const
  BtnColorDef : array [cbcRed..cbcSilver] of TColorBtn =
  (  // Red
    (($D08C8CD2, $D050508A, $D007074C, $D014149D),
     ($D06F6FA9, $D04B4B64, $D01C1C2C, $D01F1F4A)
     ),
     // Blue
    (($D0D28C8C, $D08A5050, $D04C0707, $D09D1414),
     ($D0A96F6F, $D0644B4B, $D02C1C1C, $D04A1F1F)
     ),
     // Silver
    (($D0D2D2D2, $D08A8A8A, $D04C4C4C, $D09D9D9D),
     ($D0A9A9A9, $D0646464, $D02C2C2C, $D04A4A4A)
     )
  );
Jetzt möcht ich gern noch für jeden Button, pro Farbe ein TextColor mit hinterlegen.
Wo pack ich's hin ? :gruebel:

NickelM 30. Sep 2009 17:26

Re: "const A = array of TArrays" = Gehirnmatsch
 
Also ich würd das erstmal anders mit den Arrays deklarieren;

Delphi-Quellcode:
type
  TBtnColors = array [0..3] of COLORREF;
  TColorBntState = (cbsUp, cbsDown);
  TColorButtonColors = (cbcRed, cbcBlue, cbcSilver);
  TColorBtn = record
    TextColor: COLORREF; // <--<<
    Colors: array [TColorBntState] of TBtnColors;
  end;

const
  BtnColorDef : array [TColorButtonColors] of TColorBtn =
  (  // Red
    (($D08C8CD2, $D050508A, $D007074C, $D014149D),
     ($D06F6FA9, $D04B4B64, $D01C1C2C, $D01F1F4A)
     ),
     // Blue
    (($D0D28C8C, $D08A5050, $D04C0707, $D09D1414),
     ($D0A96F6F, $D0644B4B, $D02C1C1C, $D04A1F1F)
     ),
     // Silver
    (($D0D2D2D2, $D08A8A8A, $D04C4C4C, $D09D9D9D),
     ($D0A9A9A9, $D0646464, $D02C2C2C, $D04A4A4A)
     )
  );
Hm...eigentlich hast du es ja schon die $-Zahlen sind ja schon Farben :mrgreen:
TColorBtn steht doch für ein Button oder? und mit BtnColorDef machst du ja eine Ansammlung dieser Farben, für cbcRed, cbcBlue und cbcSilver.
So mit TextColor im Record hast du ja schon deine Textfarbe für den Button. Also weis ich nicht was du willst??
Oder hab ich das irgendwie voll falsch verstanden?

himitsu 30. Sep 2009 17:28

Re: "const A = array of TArrays" = Gehirnmatsch
 
Delphi-Quellcode:
ColorBtn = record
  TextColor: COLORREF; // <--<<
  Colors: array [cbsUp..cbsDown] of TBtnColors;
end;
Code:
(TextColor: {COLORREF};
*Colors: (({COLORREF}, {COLORREF}, {COLORREF}, {COLORREF}),
          ({COLORREF}, {COLORREF}, {COLORREF}, {COLORREF})))
und das ganze dann noch 3 Mal für Red, Blue und Silver wiederholt ... glaub ich


fang einfach klein an und arbeite dich dann nach außen hoch, bzw verschachtele das immer mehr

also
Delphi-Quellcode:
ColorBtn = record
  TextColor: TYP;
  Colors: TYP;
end;
=
Code:
(TextColor: CONST; Colors: CONST)

turboPASCAL 30. Sep 2009 17:49

Re: "const A = array of TArrays" = Gehirnmatsch
 
Zitat:

Zitat von himitsu
Delphi-Quellcode:
(TextColor: {COLORREF};
 Colors: (({COLORREF}, {COLORREF}, {COLORREF}, {COLORREF}),
          ({COLORREF}, {COLORREF}, {COLORREF}, {COLORREF})))

So hab ich es auch versucht, jedoch schaltet die IDE das Editorfenster auf "nur lesen"...

Irgend wie hab ich den Eintruck ich müsste Win mal neu starten. :gruebel:

NickelM 1. Okt 2009 03:10

Re: "const A = array of TArrays" = Gehirnmatsch
 
lol ne er meint es in der Form
Delphi-Quellcode:
const
  BtnColorDef : array [TColorButtonColors] of TColorBtn =
  (  // Red
    (
     TextColor: $000000; //Hier jeweils dein Farbencode :mrgreen:
     Colors:(($D08C8CD2, $D050508A, $D007074C, $D014149D),
     ($D06F6FA9, $D04B4B64, $D01C1C2C, $D01F1F4A))
    ),
     // Blue
    (
     TextColor: $000000; //Hier jeweils dein Farbencode :mrgreen:
     Colors:(($D0D28C8C, $D08A5050, $D04C0707, $D09D1414),
     ($D0A96F6F, $D0644B4B, $D02C1C1C, $D04A1F1F))
    ),
     // Silver
    (
     TextColor: $000000; //Hier jeweils dein Farbencode :mrgreen:
     Colors:(($D0D2D2D2, $D08A8A8A, $D04C4C4C, $D09D9D9D),
     ($D0A9A9A9, $D0646464, $D02C2C2C, $D04A4A4A))
    )
  );

turboPASCAL 1. Okt 2009 08:00

Re: "const A = array of TArrays" = Gehirnmatsch
 
Jo, meint er. :thumb:


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz