> > > > When you do IsNumber(Val(...)), you actually want the new behaviour I > > want to implement: checking if a string can be safely converted to what > > you want. In the new syntax, you will directly do IsNumber(...). > > > > The IsDigit(), IsLetter()... functions are not concerned by the change. > > > > IsNull() will be kept unchanged. > > > > Then, please tell me what you are testing exactly with these lines: > > > > Events.module: IF rResult!rerunenabled = TRUE AND IF > > IsDate(rResult!lastrun) THEN > > It appears to be just a test if the db record field has a date value in > it, instead of an empty value. >
If rResult!lastrun is a database date field, then you must replace IsDate(...) par Not IsNull(...). If rResult!lastrun is not a date field, then IsDate() was always returning False, so now it will works as expected. > > Events.module: IF IsBoolean(sValue) THEN sValue = > > Main.DisplayBool(sValue) Events.module: IF IsBoolean(sCond) THEN sCond > > = Main.DisplayBool(sCond) Events.module: ELSE IF IsBoolean(vResult) > > THEN > > --- > PUBLIC SUB CheckCondition(sValue AS Variant, sOperand AS String, sCond > AS Variant, OPTIONAL bMute AS Boolean) AS Boolean > > DIM bReturn AS Boolean > > IF IsBoolean(sValue) THEN sValue = Main.DisplayBool(sValue) > IF IsBoolean(sCond) THEN sCond = Main.DisplayBool(sCond) > --- > > CheckConditions(), has variants as arguments. > If the variant sValue is a Boolean, then change it to a string value > with "True" "False" as content, so that conversion and compare tests > (below) after that can be more generic. > You must replace all "IsBoolean(x)" by "TypeOf(x) = gb.Boolean". Same remark actually for IsShort(), IsInteger(), IsFloat(), IsDate() and IsObject(). > --- > SELECT sOperand > CASE "=" > IF Comp(sValue, sCond) = 0 THEN bReturn = TRUE > CASE "<>" > IF sValue <> sCond THEN bReturn = TRUE > CASE ">" > IF CFloat(Replace(sValue, ",", ".", gb.String)) > > CFloat(Replace(sCond, ",", ".", gb.String)) THEN bReturn = TRUE > CASE "<" > IF CFloat(Replace(sValue, ",", ".", gb.String)) < > CFloat(Replace(sCond, ",", ".", gb.String)) THEN bReturn = TRUE > CASE ELSE > IF Main.bEventsDebug THEN Main.WriteDebugLog(("[Events] 2c. > Unsupported operand '" & sOperand & "' found!")) > END SELECT > IF Main.bEventsDebug AND IF NOT bMute THEN > Main.WriteDebugLog(("[Events] 2c. Check condition '") & sValue & " " & > sOperand & " " & sCond & "' = " & Main.DisplayBool(bReturn)) > RETURN bReturn > > CATCH > IF Main.bEventsDebug THEN Main.WriteDebugLog(("[Events] 2c. Invalid > comparison in CheckCondition() routine!")) > RETURN FALSE > > END > --- > > > Mail.module: IF IsString(Main.GlobalVar["Minute"]) THEN > > Main.GlobalVar["Minute"] = Val(Main.GlobalVar["Minute"]) > > Just seems to be checks to see if the variant value from that collection > isn't empty, to prevent errors. So use 'Not IsNull()' instead. > > > CDenon.class: IF IsInteger(sValue) THEN > > CDenon.class: IF IsInteger(sValue) THEN > > TRY sValue = Val(sValue) > IF IsInteger(sValue) THEN > sValue = sValue + 80 > ELSE > IF UCase(sValue) = "OFF" THEN sValue = 99 > ENDIF > > To see if sValue contains a decibel value -18...80 , or on/off/up/down. Now IsInteger() really tests if a string can be converted to an integer. But the simpler is replacing IsInteger(sValue) by TypeOf(sValue) = gb.Integer. > > > FConditionEditor.class: IF IsBoolean(vVal) THEN > > TRY vVal = Main.GlobalVar[Right(tvVariables.Current.Key, > Len(tvVariables.Current.Key) - 4)] > IF IsBoolean(vVal) THEN > sVal = Main.DisplayBool(vVal) > ELSE > sVal = vVal > ENDIF > > vVal can be strings, numbers or booleans, if its a boolean, change it to > "True", "False", otherwise just a T or nothing is shown in TableView. Use "TypeOf(vVal) = gb.Boolean". > > > FDebug.class: IF IsBoolean(vValue) THEN > > Same here. > Same change. > > FTriggerEditor.class: IF IsBoolean(Main.GlobalVar[cmbVariables.Text]) > > THEN > > FTriggerEditor.class: ELSE IF NOT > > IsNumber(Main.GlobalVar[cmbVariables.Text]) THEN > > If value is a boolean, disable compare checkboxes <, > , on form, just > have = and <> enabled, if it's a number allow, < and > too as operand > for trigger rules in my event/trigger editor. You must replace "IsNumber(...)" by "TypeOf(...) > gb.Boolean And TypeOf(...) <= gb.Float" (i.e. check the type of the variant against all possible number datatypes). Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user