Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Textbox in form not updated
Message
 
 
To
27/12/2002 14:08:24
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00736152
Message ID:
00736155
Views:
8
>Hi,
>I have a form with 10 textboxes. The form
>has a menu, with "print preview" being one
>of the functions in the menu. User can alter
>the contents in any of the textboxes. My problem
>is : when user makes changes to a textbox value and
>then immediately selects the "print preview" button,
>the last textbox that was altered does not get
>changed and shows only its original value (value
>before the change) in the preview window.
>
>My temporarily solution is after all the changes
>are made to the textboxes, user has to click the
>next record button and then prev record button once
>to get back to the same record. This way every textbox
>including the last one altered would get updated, and
>the user can print the new update record correctly.
>
>Could someone tell me how i can get the changed texboxes
>updated right when i select a menu function without
>going thru the extra step i am doing now?
>Thanks for any help.
>
>JW

See the code bellow to fix the problem. In some cases (like using hotkeys to activate buttons) the valid of textbox is not fired, thus the value is not updated.
* code from  06/06/2002 Vlad Grynchyshyn
	local oObj, nIndex, i
	if type('thisform.activecontrol.name')='C'
		oObj = .activecontrol
&& If it's a grid, we need to calculate the active control
		if upper(m.oObj.baseclass) == "GRID"
			nIndex = m.oObj.activecolumn
			for i=1 to m.oObj.columncount
				if m.oObj.columns(m.i).columnorder = m.nIndex
					nIndex = m.i
					exit
				endif
			endfor
			oObj = m.oObj.columns(nIndex)
			oObj = evaluate("m.oObj." + m.oObj.currentcontrol)
		endif

&& Check if control has different value than its ControlSource
		if proper(m.oObj.baseclass)='Textbox' and not empty(m.oObj.controlsource) ;
				and !(m.oObj.value==evaluate(m.oObj.controlsource))
			m.oObj.value = m.oObj.value && Updated:NN: 06/07/02
			lReturn = m.oObj.valid() && This is enough to write changes into ControlSource
			if (vartype(m.lReturn)='N' and m.lReturn = 0) or m.lReturn = .f.
				return .f.
			endif
		endif
	endif
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