![]() |
Mehrere TextBoxen "verketten"
Hallo!
Gibts in C# auch sowas ähnliches wie FindComponent unter Win32? Was ich vor habe: Ich habe auf einer Form mehere TextBoxen. Jede TextBox hat eine MaxLength zugewiesen bekommen. Wenn ich jetzt in eine TextBox was tippe und das Maximum erreiche, soll automatisch die nächste den Focus erhalten. Umgekehrt will ich das auch machen: Wenn ich Backspace drücke, obwohl das Feld bereits leer ist, so soll das vorherige den Focus erhalten. Das ganze soll dann so wie in meiner ![]() Dort habe ich das so gelöst:
Delphi-Quellcode:
Hier hat jedes Edit übrigens als Tag die Nummer des Edits. Also Edit4 hat im Tag 4. So erspare ich mir einen Schritt.
if (Length((Sender as TEdit).Text) = (Sender as TEdit).MaxLength) and ((Sender as TEdit).Tag < 11) then
begin a := (Sender as TEdit).Tag; repeat inc(a); until ((FindComponent('Edit'+IntToStr(a)) as TEdit).Enabled); (FindComponent('Edit'+IntToStr(a)) as TEdit).SetFocus; end; Wäre nett, wenn mir wer eine Idee gibt. Grüße Faux |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:42 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz