Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stopping typed text in a combobox - can it be done?
Message
From
04/10/2001 15:43:51
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00564438
Message ID:
00564462
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
>Ok, here is one for ya (VFP6 SP5):
>
>I've been asked to not only impose a limit on the number of typed characters in a combobox (style 0), but to also halt the ability to type any more after the limit is reached. Since comboboxes don't have a MaxLength, I'm using the InputMask, and setting CONFIRM appropriately in the When and Valid so they don't leave the field. No big deal. The issue comes with the fact that after the limit is reached, the users can keep typing, overwriting the last character. (I've also noticed that this occurs in textboxes as well.)
>
>Is there a property or setting I'm missing that prevents this? Or does this have to be coded in the InteractiveChange/Keypress?
>
>I'm trying to avoid being hit with the "Access doesn't do that" statement...
>
>Thanks,
>
>- Brian

Off top of head, here's a start (in keypress() event code)
if (this.selStart = this.maxLength - 1 and (len(alltrim(this.value)) = this.maxLength))
	nodefault
endif
You will need additional logic to allow arrow keys, delete key, and backspace key to pass on through. Also, you have to add a custom property to the class (maxLength).
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform