View Full Version : How to make a NumericStepper non-selectable?
chrishosch
05-04-2004, 03:22 PM
I'm worried that the NumericStepper in my application may cause problems with the user. The stepper arrows work and they enter the information into my dataHolder just fine. But the problem arises when the user attempts to enter the number manually by selecting the number and typing in a new value. If the user does not hit 'enter' after typing the new value, it will not enter into my dataHolder, and will instead use the previous value.
So is there a way to disable the ability to select the numbers and type in new values in the NumericStepper? I've made several attempts, but so far no luck. I don't want to have to add instructions to my page that say "Be sure to hit enter!" or something like that, but I need to make it as fool-proof as possible. Any ideas?
Thanks,
Chris
Cyanide
05-04-2004, 06:35 PM
It appears that the editable and selectable properties have no effect on the this component. So here's a little work around. Just make a new symbol the size of the editable area. Make it a button type symbol. Place it on a new layer above the layer that contains your numericStepper and cover the area you do not want to be selectable with the newly created button symbol. Then set the button's enabled property to false and set it's _alpha property to 0 (you can't make it invisible because invisible objects do not affect the stage). This prevents the user from editing the number in the numeric stepper.
Alternatively, you could warn the user that entering numbers manually without hitting enter will cause errors.
chrishosch
05-05-2004, 10:52 AM
Well, that sort of works. However if one were to user the arrows to change the quantity, a cursor appears in the window and the user can then use the keyboard to manipulate the values in the stepper. Of course the majority of users would probably not even bother with that if they need to use the arrows first. But I don't like to put much faith in the user not to screw something up royally. :)
I'll use Cyanide's solution for now, but any other ideas are most welcome.
Chris
Cyanide
05-05-2004, 07:54 PM
You could also make your own numeric stepper. It's not a very complicated component. It wouldn't take much time to do exactly the same thing on your own and yours would be much more customizable than the numericStepper component. For some reason the built in components don't seem to make use of properies like "editable" and "selectable".
If you made one yourself you could make the text box uneditable and since it wouldn't automaticly put a cursor in the text box your problem would be solved.
Interrobang
12-23-2005, 03:03 AM
This is certainly too late to help the original poster, but it works for me:
<stepper_instance>.inputField.editable = false;
This seems to have the desired effect. Manual edits are disabled, but scripted controllers like the stepper buttons can still update the field.
(As a rule, when you need to hack an MM component, try examining an instance in the debugger. This will give important clues to its inner structure, so you can attempt workarounds like this.)
Hope this helps someone!
=jimA=
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.