Autor Beitrag
hibbert
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Di 08.07.03 15:14 
Hallo,
ich habe mir mal den Chat der Indy Demos angesehen und habe den etwas verändert. Ich habe anstatt des memos ein Richedit hingesetzt. Nun möchte ich gerne folgendes:

  • Wenn eine Nachricht vom Server kommt, soll die nachricht Blau sein
  • Wenn eine Nachricht von einem anderen User kommt, soll die Nachricht Grün sein
  • Wenn es eine Private Nachricht ist, soll die Nachricht Rot sein

Wie ich den Text des Richedits färbe weiß ich schon, aber wie erkenne ich, von wem die nachricht ist, und was für ein Nachrichten-Typ (Privat/öffentlich) es ist?

thx Hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
SpeedyGTD
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89



BeitragVerfasst: Di 08.07.03 21:38 
ich würde irgendwas vor die Nachricht setzen, zB § für normale, $ für Server und % für eine Private nachricht, wenn das dann ankommt nimmst du einfach den ersten buchstaben, überprüfst was es für einer ist und färbst daraufhin ein ;), das erste Zeichen müsste natürlich gelöscht werden ;)

_________________
...hab ich vergessen ;)
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mi 09.07.03 16:54 
Danke, ich glaube das lässt sich machen, nur wie entferne ich wieder das erste Zeichen?

thx hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mi 09.07.03 17:28 
Wie wäre es mit:

ausblenden Delphi-Quelltext
1:
StringVariable := copy(andereVariable, 2, Length(andereVariable)-1);					


andereVariable sollte auch ein String enthalten.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mi 09.07.03 17:51 
mhh, das zeichen was ich davor geschrieben habe wird trotzdem mit angezeigt irgendwas funzt da nicht

hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mi 09.07.03 19:26 
Also ich habe das gerade nochmal getestet.

Ein Button, ein Edit und ein Label auf ein Formular gesetzt und folgender Quellcode:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := copy(Edit1.Text, 2, Length(Edit1.Text)-1);
end;


Wenn du den Text im Editfeld belässt steht bei mir im Label: dit1 (E fehlt)

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mi 09.07.03 19:59 
Ich hab das dann mal mit ner Variable getestet und das funzt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject);
var a:string;
begin
a:=edit1.Text;
 Label1.Caption := copy(a, 2, Length(a)-1);
end;

vorher habe ich das zwar auch so gemacht, aber nur Gott weiß warum das nicht funktioniert hat :wink:

Danke

Hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej