Autor Beitrag
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 14.05.04 14:33 
Tag Leute. Ich hab im Forum gesucht aber nichts dazu gefunden und ich weis auch nicht, ob diese Frage hier hin gehört :wink:

Ich hab ein Memo,(Memo2) und dort will ich einen Text, der KEINE ZEILENUMBRÜCHE enthalten darf, vom user eingeben lassen. Ich hab versucht, das mit OnKeyDown zu machen:

ausblenden Quelltext
1:
2:
3:
if Key= VK_RETURN then begin
     entferne letztes zeichen von memo2.Text;
     end;


Aber WIE entferne ich das letzte Zeichen(was ja der CHAR für Zeilenumbruch sein sollte)? Und falls es einfacher geht, WIE? Kann ich die Zeilenumbrüche einfach in der Procedure entfernen, in der ich dann sowieso mit dem Memo2.Text arbeite?

THX im voraus!

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Fr 14.05.04 14:41 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Memo2KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then // #13 = Return 
    Key := #0;
end;

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
JayEff Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 14.05.04 14:49 
Geht nicht: habs erst so versucht
if Key = #13 then Key := #0;und dann so if Key= VK_RETURN then key:=VK_SPACE aber erst sagt er

[Fehler] Unit1.pas(116): Inkompatible Typen
und
[Fehler] Unit1.pas(117): Inkompatible Typen: 'Word' und 'Char'

und bei meiner Version(if key= VK_Return....) passiert garnichts, er macht trotzdem umbrüche. Helft mir!

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Fr 14.05.04 14:53 
Beachte bitte, das meine Variante im OnKeyPress-Ereignis steht und nicht im OnKeyDown!!!

Also bei mir hat das bis jetzt immer geklappt...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
JayEff Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 14.05.04 15:19 
UPS! das hatte ich über sehen. jetzt klappts, danke!

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Mo 17.05.04 06:47 
Bitte Bitte :D

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce