Autor Beitrag
whitef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Sa 29.11.08 11:41 
hallo, wollte mal anfragen wie ich verhindern kann, dass man bei gedrückter Enter Taste in einer TEdit in die nächste zeile rutscht.

Meine TEDit soll nur einzeilig sein.... immer...

mfg
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Sa 29.11.08 11:45 
Im OnKeyDown-Ereignis den Wert VK_RETURN abfangen und Key auf 0 setzen. Könnte auch im KeyPress-Ereignis funktionieren, dann Key = #13

_________________
Na denn, dann. Bis dann, denn.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 29.11.08 11:48 
Ein TEdit ist doch einzeilig. Ein TMemo ist mehrzeilig.
whitef Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Sa 29.11.08 12:41 
mh stimmt... bei der standard, sry hab nicht gedacht das die JVEdit die ich benutze sowas seltenes kann ;)
naja hintergrund ist, dass ich dass hier hab:

beim einfügen in die editbox (onchange) kopiere ich schon den inhalt in die string "ttext"
und logischerweise soll er bei enter folgendes auslösen:

ausblenden Delphi-Quelltext
1:
2:
3:
if Key = #13 then begin
Edit1.Text := TText;
ShellExecute(Handle, nil'C:\Program Files\blabla.exe', PChar(Edit1.Text), nil, SW_SHOW);


problem ist nur das eine leerzeile miteingefügt wird und man den text nicht mehr sieht...

doof sowas...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19314
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 29.11.08 12:49 
Mit Trim entfernst du Leerzeichen und Leerzeilen am Anfang und Ende eines Strings ;-).
whitef Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Sa 29.11.08 22:43 
sry war nicht JVEdit sondern TransEdit.... man man, bin heute morgen ein wenig zu früh aufgewacht... hehe

also das mit Trim ist ja schon und gut, brachte mir aber nicht bei LeerZEILEN.

Naja meine Lösung nun:

Ich löschte diese TransEdit und machte ne stink normale TEdit rein. Die Farbe passte ich so gut es ging dem hintergrund an und bei tastendrück auf enter, kommt bei dieser komponente keine Leerzeile hinzu... sozusagen wieder downgegradet :D

das wars...

:CLOSED:
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: Sa 29.11.08 23:08 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for i:= MyEdit.lines.count-1 downto 0 do
begin
  if trim(MyEdit.lines[i]) = '' then
    MyEdit.Lines.Delete(i);
end;

?

Sollte alle leeren Zeilen löschen (habs grad freihändig geschrieben, kA obs so durch den compiler geht)

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

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 29.11.08 23:38 
Ja, wie es mit der ursprünglichen Komponente vermutlich richtig geht hat user profile iconalzaimar ja bereits geschrieben, aber daran bestand ja anscheinend wenig Interesse. Deshalb habe ich auch darauf verzichtet noch mehr zu schreiben vorhin. ;-)