Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cifcombobox
Message
From
31/07/1999 23:03:23
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Cifcombobox
Miscellaneous
Thread ID:
00248639
Message ID:
00248639
Views:
45
One of my favorite controls is the cIfcombobox. It's simplicity and elegance make it a favorite control among my users, too. The problem with it, though, is when you cancel out of adding a value "on the fly". Even if you cancel the buffer gets changed, and the bizobj asks you if you want to save the changes, even if nothing else has changed.
This is inconvenient if you don't want to cancel out of everything, but you do want to cancel adding a new value in the combobox.

Here's what I suggest:

In the lostfocus() event, if the user cancels use the setfldstate function to trick the bizobj that the field never changed. Simple!

*-- Add the new entry
lcID = DoForm(this.cFormName, this.DisplayValue)
IF !EMPTY(lcID)
this.Requery()
this.Value = lcID
ELSE
this.DisplayValue = ""
this.cSearchString = ""
*----------------------------------------------------
*-- Trick foxpro into thinking nothing has changed
*----------------------------------------------------
lcFieldName = JUSTEXT(This.controlsource)
lcAlias = JUSTSTEM(This.controlsource)
=SETFLDSTATE(lcFieldName , 3, lcAlias)
*----------------------------------------------------
RETURN .F.
ENDIF
ENDIF
Next
Reply
Map
View

Click here to load this message in the networking platform