Page 1 of 1

Meaningless use of expression 'Logical'

Posted: Tue Sep 22, 2009 11:13 am
by camelot
Hi All,

I have Updated to the new Version FWH 9.08 and Harbour 2.0
During compilation i get the warning Meaningless use of expression 'Logical'

Example:
REDEFINE BTNBMP ::oBtn[14,1] ID 95 noborder;
RESOURCE "MGET1","","MGET11" OF ::oFld:aDialogs[1] ;
ACTION (IF(oSchl:Formular(oSchl:oSchlDbf), oSchl:BtnUpdate("STAMM"), .T. ),oSchl:oDlg:SetFocus()) ;
TOOLTIP "Formular-Texte" ;
MESSAGE "Formular-Texte in der ausgewählten Sprache"
::oBtn[14,2] := {|| IF(! ::oSchlDbf:lReadOnly .OR. ::oSchlDbf:sprache="DEUTSCH" , .T., .F.)}

this get the warning
ACTION (IF(oSchl:Formular(oSchl:oSchlDbf), oSchl:BtnUpdate("STAMM"), .T. ),oSchl:oDlg:SetFocus()) ;
but this works
ACTION (IF(oSchl:Formular(oSchl:oSchlDbf), oSchl:BtnUpdate("STAMM"), ),oSchl:oDlg:SetFocus()) ;

I will not change my complete sourcecode.
Have you any solution for me

Thanks in advance
camelot

Re: Meaningless use of expression 'Logical'

Posted: Sun Sep 27, 2009 11:50 pm
by ukoenig
Hello,

I think using Your syntax :
IF(! ::oSchlDbf:lReadOnly .OR. ::oSchlDbf:sprache="DEUTSCH" , .T., .F.)
it must be :
IIF(! ::oSchlDbf:lReadOnly .OR. ::oSchlDbf:sprache="DEUTSCH" , .T., .F.)

Best Regards
Uwe :lol:

Re: Meaningless use of expression 'Logical'

Posted: Mon Sep 28, 2009 9:55 am
by Detlef Hoefner
camelot,

if() or iif() is the same.

But the compiler is correct.
An action like '.t.' is meaningless, because it is no action.
You should write 'NIL' in case the second state of your if doesn't need an action.

ACTION (IF(oSchl:Formular(oSchl:oSchlDbf), oSchl:BtnUpdate("STAMM"), NIL ),oSchl:oDlg:SetFocus())

Regards,
Detlef

Re: Meaningless use of expression 'Logical'

Posted: Mon Sep 28, 2009 1:35 pm
by James Bott
I agree with Detlef, it should either be NIL or left blank.

James