Autor Beitrag
saxe66
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 104



BeitragVerfasst: Di 29.04.03 17:54 
Wiedermal ne sicher einfache Frage für den Profi ...
Wie schaffe ich es, dass das aktive Edit-Element mit einer beliebigen Farbe
hervorgehoben wird ?


Vielen Dank...
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Di 29.04.03 18:06 
Hallo saxe66!

Machs am besten anhand der 2 Ereignisse OnEnter und OnExit:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TMainForm.EditEnter(Sender: TObject);
begin
  if Sender is TEdit then
    (Sender as TEdit).Color := clRed;
end;

procedure TMainForm.EditExit(Sender: TObject);
begin
  if Sender is TEdit then
    (Sender as TEdit).Color := clWindow;
end;
Gruß wulfskin!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Di 29.04.03 18:08 
Du könntest das so machen:

Du erstellst eine Prozedur (EditEnter) in die schreibst du:(sender as TEdit).color = {die Farbe die du willst};
und noch eine Prozedur (EditExit)(Sender as TEdit).color = clwhite;
Die Prozedur EditEnter musst du allen Editfeldern als OnEnter-Ereignis zuweisen, die EditExit als OnExit-Ereignis;

Sollte funktionieren!

[Edit]Da war wohl jemand schneller als ich. :? [/Edit]

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
saxe66 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 104



BeitragVerfasst: Di 29.04.03 19:43 
Titel: Danke
Vielen Dank für die schnellen Antworten ...

Gruß, saxe66