_WhenHideEval in _dcclass.prg

This forum is for eXpress++ general support.
Post Reply
Message
Author
skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

_WhenHideEval in _dcclass.prg

#1 Post by skiman »

Hi,

It looks to me that there is a problem in the _WhenHideEval function. I solved it for me, so I don't expect any changes in eXPress++.

Just to be sure that I understand it correctly. My question is for the HIDE clause.

Suppose the following in a dialog.

A GET for a variable cName.
A checkbox with a HIDE {|| empty(cName) }

So at creation the checkbox is hidden.

If I'm correct, the HIDEBLOCK of the checkbox will never be evaluated?

Code: Select all

STATIC FUNCTION _WhenHideEval( lEnable, lShow, lProtect, oXbp )

IF Valtype(oXbp:whenBlock) = 'B'
  lEnable:= Eval(oXbp:whenBlock,oXbp)
  IF lEnable
    oXbp:enable()
  ELSE
    oXbp:disable()
  ENDIF
ENDIF

IF Valtype(oXbp:hideBlock) = 'B' .AND. oXbp:isVisible() ;     -------------------------------------> hidden at creation, so isvisible() will be False and it will never be executed????
      .AND. IIF(oXbp:parent:isDerivedFrom('XbpTabPage'),IIF(oXbp:parent:Minimized,.f.,.t. ),.t. )
  lShow := !Eval(oXbp:hideBlock,oXbp)
  IF lShow
    oXbp:show()
  ELSE
    oXbp:hide()
  ENDIF
ENDIF

IF Valtype(lProtect) == 'L' .AND. Valtype(oXbp:protectBlock) = 'B'
  lProtect := Eval(oXbp:protectBlock,oXbp)
ENDIF

RETURN oXbp
Maybe I'm wrong and I don't understand the logical flow of this, but it looks very strange to me.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: _WhenHideEval in _dcclass.prg

#2 Post by rdonnay »

The codeblock is evaluated when DC_GetRefresh(GetList) or DC_GetWhen(GetList) or DC_GetWhen(<oCheckBox>) or DC_GetRefresh(<oCheckBox>) is called.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: _WhenHideEval in _dcclass.prg

#3 Post by skiman »

Hi Roger,

Yes, I know. But only when isvisible() is true. I don't understand how it can get evaluated once isvisible() is False?
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: _WhenHideEval in _dcclass.prg

#4 Post by rdonnay »

I just noticed that the code you posted is not the same as the code in the latest release.

This was a fix that was made shortly after the build 268 release.
You will need to make this change and rebuild dclipx.dll by running build20.bat

Code: Select all

STATIC FUNCTION _WhenHideEval( lEnable, lShow, lProtect, oXbp )

IF Valtype(oXbp:whenBlock) = 'B'
  lEnable:= Eval(oXbp:whenBlock,oXbp)
  IF lEnable
    oXbp:enable()
  ELSE
    oXbp:disable()
  ENDIF
ENDIF

IF Valtype(oXbp:hideBlock) = 'B' ;
      .AND. IIF(oXbp:parent:isDerivedFrom('XbpTabPage'),IIF(oXbp:parent:Minimized,.f.,.t. ),.t. )

  lShow := !Eval(oXbp:hideBlock,oXbp)
  IF lShow .AND. !oXbp:isVisible()
    oXbp:show()
  ELSEIF !lShow .AND. oXbp:isVisible()
    oXbp:hide()
  ENDIF
ENDIF

IF Valtype(lProtect) == 'L' .AND. Valtype(oXbp:protectBlock) = 'B'
  lProtect := Eval(oXbp:protectBlock,oXbp)
ENDIF

RETURN oXbp
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: _WhenHideEval in _dcclass.prg

#5 Post by skiman »

Hi Roger,

That makes more sense.

I also have IsMethod(oXbp,'PARENT') added to the check.
Best regards,

Chris.
www.aboservice.be

Post Reply