Home   Help Search Login Register  

Author Topic: Check number of letters in CT_EDIT  (Read 455 times)

0 Members and 1 Guest are viewing this topic.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Check number of letters in CT_EDIT
« on: 07 Oct 2003, 19:06:51 »
I was wondering if there's a way to see if there's been written anything in a CT_EDIT field. Perhaps check the number of letters or something ???

:cheers: Cheers! :cheers:

:beat: *Gets Shot* :beat:

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Check number of letters in CT_EDIT
« Reply #1 on: 08 Oct 2003, 08:02:15 »
OK, I'll explain in more detail:

What I'm trying to do is a dialog where the player chooses the amount of players("hotseat" in OFP) and then, in the same dialoge, writing in the names in a CT_EDIT field. What I want is to check if the amount of players, say 4, have written their names in the correct CT_EDIT field, and if they have not, for example p1, p2, p3 has written in the right but p4 has written in p6's field, an error will come up.
Anyone have any ideas?

:beat: *Gets Shot* :beat:

Offline Spinor

  • Members
  • *
  • I'm a llama!
    • The chain of command
Re:Check number of letters in CT_EDIT
« Reply #2 on: 08 Oct 2003, 13:48:12 »
To check if anything has been entered into an edit field, you simply test for
ctrlText id != ""
e.g. with a waiting command (to capture the input instantly) like:

@ctrlText id != _old
hint "Text entered"

To check for the length of the entered string is possible (with constraints),
but very tricky. In essence, you have capture every entering of a character
with somethin like:

_length = 0

#NewCheck
_old = ctrlText id
@ctrlText id != _old
_length = _length + 1; hint format["Length: %1", _length]
goto "NewCheck"

This is not foolproof, though: Using Backspace will mess it up.