Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stopping typed text in a combobox - can it be done?
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00564438
Message ID:
00564591
Views:
20
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

Hi Brian,

I have Input Classes in Download section here. It's not exactly, what you're asking, but you can borrow the idea.

Here is KeyPress event of my composite class:
lparameters nKeyCode, nShiftAltCtrl
local lcValue
lcValue=alltrim(this.value)
if nKeyCode=13 && Enter
	with this.parent.parent && Btcc_list
		.validate(m.lcValue)
		if .AllowAdd
			.Container1.AddRemove1.cmdAdd.click()
			.Container1.Command1.Refresh()
			.Container1.List1.Refresh()
		endif
	endwith
	nodefault
endif
And here is validate method in the form instance of this class:
lparameters tcValue
if len(m.tcValue) <> this.FieldLen
* Problem didn't fill the field
	=messagebox('You should type '+alltrim(str(this.FieldLen))+' digits only!',48,'Warning...')
	this.AllowAdd=.f.
	return 0
else
	return dodefault(m.tcValue)
endif
I'm also using InputMax property of the textbox...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform