Autor Beitrag
Dude566
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Mo 04.05.09 13:11 
Müsste die Abfrage nicht auch unter dem zugehörigen Panel stehen, sonst passiert ja auch keine Änderung beim wiederholten Klicken.

_________________
Es gibt 10 Gruppen von Menschen: diejenigen, die das Binärsystem verstehen, und die anderen.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 04.05.09 13:22 
Gibts eigentlich von Delphi 2009 auch eine abgespeckte Version?
Ich frag mich nämlich schon häufiger, wo man als Anfänger eine mehrere hundert € teure Software herbekommt... Schule? Arbeit?

_________________
PROGRAMMER: A device for converting coffee into software.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 04.05.09 13:24 
Nein. Es scheint aber wieder etwas in der Überlegung zu sein, wie man aus den letzten Antworten zu der Diskussion zu dem Thema in der DP sehen kann:
www.delphipraxis.net/post1028922.html
neocox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mo 04.05.09 13:25 
school, wir dürfen ab und zu nachmittag zum üben ran
Dude566
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Mo 04.05.09 13:35 
Und wir müssen in der Schule mit Delphi 5 arbeiten. :roll:

_________________
Es gibt 10 Gruppen von Menschen: diejenigen, die das Binärsystem verstehen, und die anderen.
neocox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mo 04.05.09 13:56 
hih not macht erfinderisch:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm11.Panel2Click(Sender: TObject);
begin
Panel2.Font.Color := clRed;
end;

procedure TForm11.Panel2DblClick(Sender: TObject);
begin
Panel2.Font.Color := clWindowText;
end;


1x klich = rot, doppelklick = schwarz ;)
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 04.05.09 14:00 
user profile iconneocox hat folgendes geschrieben Zum zitierten Posting springen:
1x klich = rot, doppelklick = schwarz ;)

Nagut, wenn das so gewünscht ist.. eine Umschaltung mit normalem Klick ginge auch, siehe oben.

Dann nimm aber auch schwarz, und nicht WindowText - sonst bist du an die Farbeinstellungen von Windows gebunden, und könnte u.U. auch grün oder so sein.

_________________
PROGRAMMER: A device for converting coffee into software.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mo 04.05.09 14:00 
deine abfrage funktioniert im Prinzip so:
ausblenden Delphi-Quelltext
1:
if ?.font.color = Rot then ?.Font.Color := Black else ?.Font.Color := Rot;					


Edit:
Obwohl ich gerade gesehn habe das Jeanicke es auch schon beantwortet hat.
;)
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 04.05.09 14:06 
Oder schön OOP:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
type
  TForm11 = class(TForm)
    ...
  private
    FIsRed: Boolean;
    procedure SetRed(const Value: Boolean);
  ...
  public
    property IsRed: Boolean read FIsRed write SetRed;
    ...
  end;

...

procedure TForm11.SetRed(const Value: Boolean);
const Colors: array[Boolean] of TColor = (clBlack,clRed);
begin
  if FIsRed <> Value then
    begin
      FIsRed := Value;
      Panel2.Font.Color := Colors[FIsRed];
    end;
end;

...

procedure TForm11.Panel2Click(Sender: TObject);
begin
  IsRed := not IsRed;
end;
neocox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mo 04.05.09 14:11 
user profile iconthepaine91 hat folgendes geschrieben Zum zitierten Posting springen:
deine abfrage funktioniert im Prinzip so:
ausblenden Delphi-Quelltext
1:
if ?.font.color = Rot then ?.Font.Color := Black else ?.Font.Color := Rot;					
ähm, is das falsch? ich versteh das grad so:

wenn es rot ist, mach es schwarz, sonst rot --> aber es soll sich ja nur ändern beim klick

Moderiert von user profile iconNarses: Zitat repariert
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 04.05.09 14:12 
Ja, das gehört ja auch in den Klick. Und beim Klick wird dann jeweils die andere Farbe genommen.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 04.05.09 14:12 
Dann schreib es auch in das Click-Ereignis ;)
neocox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mo 04.05.09 14:45 
naja für n neuling wie mich muss ma immer noch alles ganz genau beschreiben ;)
Dude566
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Mo 04.05.09 14:49 
Es ist doch wohl logisch das die Abfrage auch in das OnClick Event des Buttons kommt, genauso wie wenn du damit z.B. ne ShowMessage ausgeben willst sobald der Button gedrückt wird.

Den hier www.christian-stelzm...rials_crashkurs.html habe ich dir übrigens schonmal ans Herz gelegt.

_________________
Es gibt 10 Gruppen von Menschen: diejenigen, die das Binärsystem verstehen, und die anderen.
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Di 05.05.09 18:55 
user profile iconneocox hat folgendes geschrieben Zum zitierten Posting springen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm11.Panel2Click(Sender: TObject);
begin
Panel2.Font.Color := clRed;
end;

procedure TForm11.Panel3Click(Sender: TObject);
begin
Panel3.Font.Color := clRed;


if panel2.font.color=clRed
     then do nothing                              //sehr süß ;) wie wäre es, wenn du nicht abfragst ob der Button clRed ist, sondern ob er NICHT clRed ist?
else panel2.font.color := clWindowText;

end;



ausblenden Delphi-Quelltext
1:
2:
3:
4:
if not (panel2.font.color = clRed) then
  Panel2.font.Color := clRed 
else 
  panel2.Font.Color := clWindowText



//Edit: Nummer 400 :dance:
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Di 05.05.09 19:08 
Und da das anscheinend unter gegangen ist, zitier ich mich nochmal selbst..

user profile iconXentar hat folgendes geschrieben Zum zitierten Posting springen:
Dann nimm aber auch schwarz, und nicht WindowText - sonst bist du an die Farbeinstellungen von Windows gebunden, und könnte u.U. auch grün oder so sein.

_________________
PROGRAMMER: A device for converting coffee into software.
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: Di 05.05.09 20:37 
Also ich würde das Ganze auch mit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if not (Panel2.font.color=clRed) then 
  Panel2.font.color := clRed
else
  Panel2.font.color := clBlack;

machen.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 05.05.09 20:46 
Wozu negieren :?: Warum nicht direkt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if Panel2.Font.Color = clRed then 
  Panel2.font.color := clBlack
else
  Panel2.font.color := clRed;
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mi 06.05.09 06:46 
Ich versteh auch nicht ganz warum dieser abschnitt noch 5 mal wiederholt wird.
Letzendlich habt ihr meinen Vorschlag zwar rein optisch verändert von der Logik ist es aber das selbe. ^^
Und das negieren versteh ich auch nicht so ganz.
Das dies in ein Buttonclick... event kommt war für mich i-wie selbstverständlich.

mfg nic