Autor Beitrag
Morpheus1572
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Mi 04.06.08 15:20 
Hmmm... ich hab keine idee deswegen nach langer zeit mal wieder ne frage. (ich wüßte auch nicht wonach ich hier suchen sollte deswegen nicht schimpfen bitte)

ich habe ein TEdit-Feld (Edit1) in dem ich eine Bestimmte Eingabe erwarte. ohne diese gibt es keinen freigeschalteten 'Weiter'-Button:

in dem feld muss (!) 'AG' stehen, gefolgt von einer 2stelligen zahl. Z.B. AG89. Ich habe keine idee womit ich das prüfe und wie ich das realisiere. ist sicher keine große sache, nehme ich an. Achja, die Zahl kann varieren 0-99 aber AG ist fest.

Hoffe ich bin in dem bereich hier richtig, ansonsten bitte verschieben. :?

Gruß Morph.


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mi 04.06.2008 um 16:44
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mi 04.06.08 15:43 
Irgendwie so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
    Button1.Enabled :=  (Length(Edit1.Text) = 4)      and
                        (Edit1.Text[1] = 'A')         and
                        (Edit1.Text[2] = 'G')         and
                        (Edit1.Text[3] in ['0'..'9']) and
                        (Edit1.Text[4] in ['0'..'9']);
nagel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 708

Win7, Ubuntu 10.10

BeitragVerfasst: Mi 04.06.08 16:17 
Wobei sich dir Frage stellt, wieso das AG überhaupt mit eingegeben werden muss, wenn es sowieso immer dabei ist. Reicht dann nicht einfach die Eingabe der zweistelligen Zahl?
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Mi 04.06.08 19:35 
@Marc.: Danke. ich wusste doch es ist simpel! :oops:

@Nagel: Ja, du hast recht. könnte mann auch machen.... dann würde man sogar die ganze überprüfung mit groß- und kleinschreibung sparen...

Klasse und thx schon mal. ich werde das gleich mal umsetzen.

Gruß Morph.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mi 04.06.08 20:49 
user profile iconMorpheus1572 hat folgendes geschrieben:

@Nagel: Ja, du hast recht. könnte mann auch machen.... dann würde man sogar die ganze überprüfung mit groß- und kleinschreibung sparen...

Die musst Du nicht extra prüfen. Es reicht vor dem Check den Text via Uppercase() oder Lowercase() entsprechend in Groß- oder Kleinbuchstaben umwandeln.

Oder so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
    Button1.Enabled :=  (Length(Edit1.Text) = 4)                         and
                        ((Edit1.Text[1] = 'A') or (Edit1.Text[1] = 'a')) and
                        ((Edit1.Text[2] = 'B') or (Edit1.Text[2] = 'b')) and
                        (Edit1.Text[3] in ['0'..'9'])                    and
                        (Edit1.Text[4] in ['0'..'9']);
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Mi 04.06.08 22:28 
Stimmt auch. ich werde mal beides probieren. ich habe noch ne frage und will keinen neuen eintrag deswegen aufmachen, da es direkt hiermit im zusammenhang steht.

wenn die bedingung nicht erfüllt ist soll der cursor (fokus) weiterhin bei Edit1 bleiben. mit edit1.focused klappt das nicht. was mache ich falsch?

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

hat sich erledigt. :oops:

Edit1.SetFocus; ist der Befehl. Wer lesen kann ist klar im Vorteil...

Gruß Morph.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 04.06.08 22:39 
Moin!

Markierst du den Thread noch entsprechend, wenn dein Problem gelöst ist? Danke. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Do 05.06.08 08:55 
@ Narses: Aber klar doch. wollte nur ausprobieren ob es funzt. ;-) Vielen Dank für die Unterstützung.