Página 1 de 1
Advice about setting a flag in a form, to be used inside a separate class
Publicado: Dom Nov 25, 2012 4:13 pm
por Guest
xHarbour doesn't seem to have a HB_setenv or a setEnv, so I tried
switching my Xailer project to Harbour, but am receiving errors.
Can you give me some advice on the following problem:
From a form, in a checkbox, I want to set a flag that later tells a
class whether or not to output trace/log messages while processing. The
DATA variable in the class is called bIsTrace.
So the idea is to set a variable from the form, perhaps a global appdata
variable or an environmental variable TRACE=ON/OFF, that the class can
use to determine whether the user wants trace messages.
I keep getting an error that the newsgroup doesn't take articles longer
than some number of bytes, even though the article + attachment is not
that big. So I'll try sending the screen print separate from the main body.
Advice about setting a flag in a form, to be used inside a separate class
Publicado: Dom Nov 25, 2012 4:20 pm
por Guest
Does the group accept attachments? It seemed to have been sent, but
after several minutes, it's not there.
Advice about setting a flag in a form, to be used inside a separate class
Publicado: Dom Nov 25, 2012 4:24 pm
por Guest
Here it is...
--
Advice about setting a flag in a form, to be used inside a separate class
Publicado: Dom Nov 25, 2012 4:26 pm
por Guest
....so the idea is to use the Trace button, to signal the class (when
it's instantiated later) to output log messages, e.g.
Local sPreProcessedBooleanExpression := ""
Local bIsTrace := FALSE
// ::SetTraceStatus()
bIsTrace := ::GetTraceStatus()
sPreProcessedBooleanExpression := PreProcessBooleanExpression(
sBooleanExpression )
If bIsTrace
WriteLog( "Original boolean expression: " + sBooleanExpression )
Endif
If bIsTrace
WriteLog( "Preprocessed boolean expression: " +
sPreProcessedBooleanExpression )
Endif
If !::IsWellFormedBooleanExpression( sPreProcessedBooleanExpression )
Return Self
Endif
If bIsTrace
WriteLog( "Generating Boolean Object " + Time() )
Endif
DEFAULT sBooleanExpression TO "xyz' + x'y'z + xy"
If ::HasAnyLiteralsFromAlphabet( sBooleanExpression )
::SetBooleanExpression( sBooleanExpression )
::PreProcessBooleanExpression( sBooleanExpression )
::sUsedVariables := ::CalculateUsedVariables(sBooleanExpression)
::PopulateTruthTableRows()
::PopulateTruthTableResults()
ASize( ::aSolutions, Len( ::sUsedVariables ) )
::aRowsEquatedToOne := ::GetOneMinTerms()
::aRowsEquatedToZero := ::GetZeroMinTerms()
Else // If the boolean expression has no variables, e.g. if it's
only a value like 'F = 0' or 'F = (1)'
// , then just populate with empty lists.
::sBooleanExpression := ::EvaluateNonVariableExpression(
sBooleanExpression )
::sUsedVariables := ""
::aTruthTableRows := {}
::aTruthTableResults := {}
::aSolutions := {}
::aRowsEquatedToOne := {}
::aRowsEquatedToZero := {}
Endif
Return Self
Advice about setting a flag in a form, to be used inside a separate class
Publicado: Dom Nov 25, 2012 8:41 pm
por Guest
Resolved. Instead of instantiating the Boolean Class from a button,
it's now instantiating during the creation of the form, and the Boolean
object is a property of the form. Then, if the checkbox is checked, the
change event will set the bIsTrace property of the Boolean object.
Will keep the project in xHarbour mode, until the Harbour issue can be
resolved.