Page 3 of 3

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Wed May 12, 2021 5:37 am
by rdonnay
Tom and Chris -

I had fears that this change could fail under some situations, in particular, the "parent".
I suggest, to prevent an error, that :parent be changed to :setParent().
I tested this with a very large application, but that may have been insufficient.

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Wed May 12, 2021 9:13 am
by skiman
Hi Tom,

I checked the :WhenHideEval method of some objects, and saw the difference for the dcstatusbar and the dcstatic. The dcstatic:WhenHideEval is using his own code, and is not changed by the modification of the _WhenHideEval function.

When I add the modifications to the DC_XbpStatic:WhenHideEval method, I have the same strange results as you noticed. A dcbrowse with a HIDE clause on a static doesn't show up anymore.

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Wed May 12, 2021 9:53 am
by skiman
Hi All,

The previous code I posted was wrong!

With my tests the code below seems to work for my application.

Code: Select all

STATIC FUNCTION _WhenHideEval( lEnable, lShow, lProtect, oXbp )
if IsMethod(oXbp,'PARENT') .AND. (!oXbp:parent:isVisible().or. oXbp:parent:isDerivedFrom('XbpTabPage').and.oXbp:parent:Minimized ))
	return oXbp
endif
...

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Wed May 12, 2021 11:58 am
by rdonnay
Chris -

I think you have the best solution.
Thank you.

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Wed May 12, 2021 2:00 pm
by hz_scotty

Code: Select all

...oXbp:parent:Minimized ))  <------
should be

Code: Select all

...oXbp:parent:Minimized )
correct ?

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Thu May 13, 2021 1:38 am
by Tom
Hi, Chris.

"PARENT" is not a method, but an iVar. So it should be:

Code: Select all

IsMemberVar(oXpb,"Parent")
Right?
Anyway, Roger mentioned using SetParent() would be better here. I'm waiting for his opinion.

Re: DCPushButtonXP is slow if I use the Hide option

Posted: Thu May 13, 2021 7:53 am
by rdonnay
Tom -

I never noticed that Chris didn't use IsMemberVar().
That should have been sufficient.
:parent is an iVar of each Xbase parts class and it was not implemented until 1.9.
There is a possibility that it may not be implemented in some classes.

Whereas :setParent() is a method of XbPartHandler the documentation states that it always returns an object.

XbpPartHandler:setParent()
Sets or returns the parent of the Xbase Part.

:setParent( [<oXbp>] ) --> oldParent
Parameters
<oXbp>
<oXbp> optionally specifies an Xbase Part as the parent of the object executing the method.

Return
This method returns the previous parent (Xbase Part) that was current before the method was called.

Description
The :setParent() method returns the parent of an Xbase Part or specifies a new parent. The parent is also an Xbase Part. In most cases it is the same as the return value of the function SetAppWindow() or a dialog. A parent defines a physical relationship between two Xbase Parts (the parent-child relationship). The object executing the :setParent() method is the child. Therefore, the following expression is always greater than 0:

AScan( self:setParent():childList(), self )

This expression illustrates that an Xbase Part always has a parent and that it is always contained in the child list of its parent. This relationship is significant when programming dialogs because the dialog and all of its elements are available, regardless of which one is referenced by a memory variable. When a reference to a dialog (XbpDialog) is contained in a memory variable oXbp, all of the Xbase Parts it contains as children are returned using oXbp:childList(). If the memory variable oXbp contains only the reference to a dialog element such as a pushbutton (XbpPushbutton), the dialog can be determined using oXbp:setParent() and the other dialog elements contained in the dialog (siblings) can be found using oXbp:setParent():childList().