Home   Help Search Login Register  

Author Topic: Dialogs, a question.  (Read 688 times)

0 Members and 1 Guest are viewing this topic.

Offline KTottE

  • Former Staff
  • ****
Dialogs, a question.
« on: 02 Jan 2003, 14:22:06 »
Righto, I wonder if any of you lot have a (simple) way of limiting the amount of input in an edit box (CT_EDIT)?

I know I can probably do a work around, but I'd rather not, so I wonder if there's an easy way of limiting the number of letters and numbers in an edit field. (Got two edit fields, one for letters, one for numbers, max 2 in each)

*rolls off*
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline uiox

  • Contributing Member
  • **
Re:Dialogs, a question.
« Reply #1 on: 02 Jan 2003, 18:17:46 »
Only one idea, 2 fields, one for input letter one by one, and a second with the text. And for manage this an array.

Like 60' computers...  ::)

For me most part of entries are solve by combos and buttons. What do you want exactly?

Offline KTottE

  • Former Staff
  • ****
Re:Dialogs, a question.
« Reply #2 on: 02 Jan 2003, 18:51:44 »
Erm, I'd appriciate it if you'd read my posts before answering, this is the second time today you pretty much repeat what I said ;D

I have
Two edit fields.
Edit 1 will take two letters
Edit 2 will take two numbers

One submit button (OK) which will execute a script that gets the numbers and letters from Edit 1 and Edit 2.

What I need
Something to limit the number of characters a player can input in Edit 1 and Edit 2.
Maximum of 2 letters or 2 numbers (depending on edit field).

How do I stop a player from entering more than two letters into an edit field?
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline uiox

  • Contributing Member
  • **
Re:Dialogs, a question.
« Reply #3 on: 02 Jan 2003, 20:12:57 »
For letters

One field and a second field

MyoneField = ctrltext idcofOneField

? MyOneField != "" : MyArray = MyArray + MyOnefield ; TextOfSecondField = TextOfSecondField + MyOneField ; ctrlSettext [idcofOneField,""] ; ctrlsettext [idcOfSecondField,TextOfSecondField ]

? count Myarray > 2 : ctrlEnable [idcOfMyOnefield, false]

For numbers

You can convert string to num with this :

TheNumberString = ctrlText 100

TheNumber = -1
Code: [Select]
("TheNumber = " + TheNumberString ) ForEach  [0] ("TheNumber = " + TheNumberString ) ForEach  


? theNumber > 99 :ctrlEnable [100, false]

Or you can do the same for number and do a filter, don't know if  ? stringA == stringB works but with array works.

Sorry if I'm not clear, it's my English and .... my nature
« Last Edit: 02 Jan 2003, 20:19:28 by uiox »

Offline KTottE

  • Former Staff
  • ****
Re:Dialogs, a question.
« Reply #4 on: 02 Jan 2003, 21:36:45 »
? count Myarray > 2 : ctrlEnable [idcOfMyOnefield, false]

What will that do exactly?
Will it disable the player from entering more letters, or will it disable the entire control and therefore clearing the contents out?
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline uiox

  • Contributing Member
  • **
Re:Dialogs, a question.
« Reply #5 on: 03 Jan 2003, 15:17:42 »
I do some test :

If you desable a ct_edit you cannot entry but if you assign a value you see it.

This works :

; 100004 idc of the edit field, 1000012 idc for show value
_text = ""
ctrlenable [100012,false]
_Z = 0

#MainLoop
~0.1

? _Z < 3 : ctrlSetText  [100012,_Text  ]
? (ctrltext 100004  != "") : _Text = _Text + ctrltext 100004 ; ctrlSetText  [100004,""] ; _z =_z +1

?   (ctrlVisible 100004) : goto "Mainloop"

For a better effect I have put the 2 field at the same place, only one minor problem the cursor is always left.

The array is not useful in fact.

Offline KTottE

  • Former Staff
  • ****
Re:Dialogs, a question.
« Reply #6 on: 03 Jan 2003, 15:24:24 »
;D

I'll work something out then, thanks for your help anyways.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"