Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
InteractiveChange not registering in time
Message
De
23/01/2002 16:21:58
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
InteractiveChange not registering in time
Divers
Thread ID:
00609321
Message ID:
00609321
Vues:
46
Hi All,

I hope someone has gone through this before and can offer some insight.

I've created a form with a grid that helps users to build a simplified custom query. In my last column there is a combobox with the values "And" and "Or".

I want require that the user use either "And" or "Or" before they can add another line in the grid. Additionally if they select either "And" or "Or" then I want to add another line automatically. From the combobox's InteractiveChange event I call a method I created called AddQuery to add the line to the Query cursor (curQuery). I also call this method from an "Add" button on the form.

The AddQuery method calls another method I created named VerifyRow that verifies that the entry has at least the minimum amount of information to be valid.

My problem occurs in the VerifyRow method where I check to see that an "And" or "Or" value exists in the entry. It is triggered by the combobox's InteractiveChange event so I know that a value was selected. However,the "If Empty(curQuery.AndOr)" returns a .T. to signify that the field is empty.

The "And/Or" combobox is bound to the curQuery.AndOr field. When I use the debugger to step through and setup a "Watch" on curQuery.AndOr, it shows that curQuery.AndOr IS populated with the correct value. So why does the "If Empty(curQuery.AndOr)" evaluate to TRUE if it is not?

I've since worked around the problem, still this is very puzzling to me and would like to know if anyone has had a similar occurance or an explination.

The code for the 3 referenced methods/events are included below.

Thanks in advance for all your help.

Aloha,

James


The combobox's InteractiveChange event contains:
If This.Value = "AND" or This.Value = "OR"
  ThisForm.QueryAdd()
EndIf
The .QueryAdd() method contains the following code:
*!* Verify that the row contains enough information
If !ThisForm.VerifyRow()
  Return
EndIf

*!* Append blank record to curQuery
Select curQuery
Append Blank
The .VerifyRow() method contains the following code:
Local llRetVal, lcMsg

*!* Inits
llRetVal = .T.
lcMsg = ""

Select curQuery
Go Bottom

*!* Check to see if there is an AND/OR clause 
*!* present in the last record.
*!* If not, display a message to the user and bail out
If Empty(curQuery.AndOr) 
	=MessageBox("AND/OR value is required for this action", 0,"Query builder")
	llRetVal = .F.
	RETURN llRetVal
EndIf

*!* Check to see that the minimum values are present
*!* Minimum values include: Field, Operator & Value

If Empty(curQuery.Field) or Empty(curQuery.Oper) or Empty(curQuery.Value)
	lcMsg = "The following columns require values:" + Chr(13) 
	lcMsg = IIf(Empty(curQuery.Field), lcMsg + Chr(13) + "Field column", lcMsg)
	lcMsg = IIf(Empty(curQuery.Oper), lcMsg + Chr(13) + "Operator column", lcMsg)
	lcMsg = IIf(Empty(curQuery.Value), lcMsg + Chr(13) + "Value column", lcMsg)
  
	*!* Display error message to the user
	=MessageBox(lcMsg, 0, "Query Builder")

	llRetVal = .F. && Ensure the return value is correct
EndIf

Return llRetVal
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform