Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
StateZipCountryObj Class Forcing the Country field change.
Message
From
07/07/2000 12:37:35
Gil Munk
The Scarborough Group, Inc.
Baltimore, Maryland, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
StateZipCountryObj Class Forcing the Country field change.
Miscellaneous
Thread ID:
00389570
Message ID:
00389570
Views:
44
Hi everyone,

I have a table (and view) that has a country field. I have the StateZipCountryObj working just fine except for one little ol thing:
The value of the country textbox is ALWAYS set and therefore the lIschanged value ALWAYS returns TRUE and I always get asked if I want to save the changes even if I just switched from the list page to the properties page and back. Annoying.
So I decide to modify the class code in the SetCountryZip method to test if the State's field value has changed using GetFldState(cField, cAlias). I obtain cfield and cAlias from the controlsource of cblState.combobox. This works fine when all this executes on the page activate but when the last line in the method executes ( txlZipCode.SetInputMask(v_States.cCountry) ) the ControlSource is cleared when the method reexecutes the GetFldState function errors with no calias and no cfield.

So, what I want is NOT to have the country textbox value changed unless the state is changed or the country is empty when the state has a value. Any help would be appreciated.

Here's the modified SetCountryZip Method:
*--- Set the Country display ---*
IF This.cblStates.ComboBox.Value = ' '
*------------------------------------------
*--- No item is selected in the State box,
*--- so blank out the country field
*------------------------------------------
This.cblCountry.TextBox.Value = ''
ELSE

*--- My Added Code; was just: This.cblCountry.TextBox.Value = v_States.cCountry

lcStateFieldSource = This.cblStates.ComboBox.ControlSource
lcStateField = SUBSTR(lcStateFieldSource, AT(".", lcStateFieldSource)+1)
lcStateAlias = SUBSTR(lcStateFieldSource, 1, AT(".", lcStateFieldSource)-1)

if EMPTY(This.cblCountry.TextBox.Value) OR ;
(GetFldState(lcStateField, lcStateAlias) = 2 OR ;
GetFldState(lcStateField, lcStateAlias) = 4)
This.cblCountry.TextBox.Value = v_States.cCountry
ENDIF
ENDIF
*--- Set the zip code InputMask ---*
This.txlZipCode.SetInputMask(v_States.cCountry)
Gil Munk


"If a nation expects to be ignorant and free, it expects what never was and never will be." - Thomas Jefferson
Next
Reply
Map
View

Click here to load this message in the networking platform