Page 1 of 3

DCPushButtonXP is slow if I use the Hide option

Posted: Thu May 06, 2021 11:36 am
by PedroAlex
Hi Roger!
I hope you're well.

I have noticed that if I use the HIDE Option in the DcPushBuutonXP command, the button's reaction is very slow.
This takes performance and speed away from touch keyboards and gives an aspect of slowness.
If you have 10 buttons without the HIDE option, you can click on all of them, as the reaction speed is normal.
but if the buttons have the HIDE option, the reaction is very slow.
Can you please check this situation.

many Thanks..

eXpress 267 and xB 2.0.1176

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Thu May 06, 2021 11:40 pm
by Tom
Did you try any HIDE clause (like just {||.T.} or {||.F.}, without any other conditions)? Maybe the evaluation of the codeblock takes so much time - (cascading iterations and dependencies). I can't confirm DCPUSHBUTTONXPs are slow with HIDE clause. They must be a little slower when getting painted since ownerdrawing is used, but not that much. Can you track on a button how often the HIDE clause is evaluated?

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Fri May 07, 2021 5:54 am
by rdonnay
I agree with Tom.
You need to test your hide code block.

The below code is very simple and contains nothing that should affect the performance.

Code: Select all

METHOD DC_XbpPushButtonXP:WhenHideEval( lEnable, lShow, lProtect, nMode )

IF Valtype(::whenBlock) = 'B' .AND. ::parent:isEnabled()
   lEnable := Eval(::whenBlock,self)
   IF lEnable
     IF !::isEnabled()
       ::enable()
     ENDIF
   ELSE
     IF ::isEnabled()
       ::disable()
     ENDIF
   ENDIF
ENDIF

IF Valtype(::hideBlock) = 'B'
   lShow := !Eval(::hideBlock,self)
   IF lShow
      ::show()
   ELSE
      ::hide()
   ENDIF
ENDIF

IF Valtype(::protectBlock) = 'B'
  lProtect := Eval(::protectBlock,self)
ENDIF

RETURN self

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Fri May 07, 2021 8:53 am
by PedroAlex
I thank you in advance for your availability.

But it turns out that I register a performance deficit when I use the Hide option in DCPushButtonXP.
My scenario is as follows, I have an application for bars and restaurants that has more than 500 buttons divided into tabs.
When I use the option "Hide" in the command "DcpushButtonXP" the application is very slow.
The application installed on an Intel J1900 processor, which is the most common in POS, is very slow and impossible to use.
Attached is an example that reproduces the problem.
If you disable the Hide option, everything is OK.

Not long ago there was also an evident slowness in creating the buttons, but Roger did an optimization and the problem was solved.

Try use this sample and try to be fast to click the buttons ..

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Fri May 07, 2021 9:39 am
by rdonnay
Your problem is not the HIDE clause.
It is a problem in the ACTION that is causing the slowness.
This was reported by another customer earlier this year because it only showed on some slow computers.
That problem was fixed in the attached file.

Copy _DCXBUTT.PRG to your \exp20\source\dclipx folder.
Rebuild DCLIPX.DLL by running BUILD20.BAT

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Sat May 08, 2021 1:15 am
by PedroAlex
Roger,

Did you execute the sample I sent as an attachment?
The buttons have no "action" option!
Try clicking on several buttons in a row and quickly!
you will see that there is a very slow delay.
Then remove the HIDE options and test again.
The button's behavior is totally different, fast, normal ..
Can anyone else test run this sample and confirm if it identifies the situation?

Many Thanks!

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Sat May 08, 2021 6:07 am
by rdonnay
Did you rebuild your dclipx.dll with the file I sent?

What version of Xbase++ are you using?
Do you need me to send you a dclipx.dll ?

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Sat May 08, 2021 8:23 am
by PedroAlex
Roger,
Of course I compiled dclipx.
Doesn't this behavior happen to you?
My Xbase version is 2.0.1185

Do me a favor and watch the attached video and test it with the attached program sample.

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Sat May 08, 2021 10:09 am
by rdonnay
Your program has 1040 owner-drawn pushbuttons and each one has a hide code block.

It means that every time you click a button, 1040 code blocks need to be run and each button needs to be redrawn.
This is a lot of owner-drawn objects to manage.

I made the below change to _DCXBUTT.PRG and it appears to fix the problem:

Code: Select all

METHOD DC_XbpPushButtonXP:WhenHideEval( lEnable, lShow, lProtect, nMode )

IF Valtype(::whenBlock) = 'B' .AND. ::parent:isEnabled()
   lEnable := Eval(::whenBlock,self)
   IF lEnable
     IF !::isEnabled()
       ::enable()
     ENDIF
   ELSE
     IF ::isEnabled()
       ::disable()
     ENDIF
   ENDIF
ENDIF

IF Valtype(::hideBlock) = 'B' .AND. ::parent:isVisible() ;
      .AND. IIF(::parent:isDerivedFrom('XbpTabPage'),IIF(::parent:Minimized,.f.,.t. ),.t. )
   lShow := !Eval(::hideBlock,self)
   IF lShow
      ::show()
   ELSE
      ::hide()
   ENDIF
ENDIF

IF Valtype(::protectBlock) = 'B'
  lProtect := Eval(::protectBlock,self)
ENDIF

RETURN self


Re: DCPushButtonXP is slow if I use the Hide option

Posted: Sat May 08, 2021 10:44 am
by PedroAlex
It's much better now.
Thank you so much.