Manditory Edit box

For questions about using Classic.

Post » Sat Oct 16, 2010 5:57 am

I want to be able to pop up some sort of input box (e.g. like the edit box) that the player has to fill in with a value before being able to do anything else. It's for an inventory function so time scale =0 won't work for this since it is already zero, but there is inventory functionality happening (e.g. dragging and dropping items around). I also want to have it limit the input to a number. I don't want to check whether the input is a number, but instead I just want to disallow typing letters entirely, such that trying to type letters will not work (e.g. hitting a letter while typing will not make the letter appear).
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Sat Oct 16, 2010 10:06 am

Place your events that concern the inventory in a group and make another event ewhich deactivates the group unless a number is specified.
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Sun Oct 17, 2010 1:44 am

Thanks, but that doesn't take care of the second part. I don't want them to be able to type letters in the edit box at all
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Sun Oct 17, 2010 2:22 am

I can't think of a reasonable way to make an editbox accept only numbers, without using Python. So, here's a way with Python:

EditBox: On text changed
[code:1au5r3n3]if len(EditBox.Text) > 0 and not EditBox.Text.isdigit():
EditBox.Undo()
EditBox.ClearUndo()[/code:1au5r3n3]

The python script would just be indented within the 'On text changed' condition. This makes use of, and basically takes away from the user, the ability to undo changes in the Editbox.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Sun Oct 17, 2010 2:40 am

Hmm good idea. Is it possible to disable keyboard keys? I could try doing that too.
B
11
S
2
G
3
Posts: 283
Reputation: 1,968


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest