Hello Roger,
is it possible to have automatic disabled childs, if the parent is disabled about his WHEN-Block?
Sample:
I have a DCSTATIC Groupbox with 20 DCGETS on it. Now i would expect, that they are disabled, if the whenblock of the DCSTATIC is .f.
This would help much in complex dialogs.
Is this possible?
Question about automatic disabling childs
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Question about automatic disabling childs
-----------------
Greetings
Markus Walter
Greetings
Markus Walter
Re: Question about automatic disabling childs
This should already work the way you suggest.
Are you saying that it does not?
Are you saying that it does not?
The eXpress train is coming - and it has more cars.
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Re: Question about automatic disabling childs
Hi Roger,
please test the following:
and press the Button. The first DCGET (without his own when clause) will not be disabled.
please test the following:
Code: Select all
#include "dcdialog.ch"
function Appsys()
return NIL
procedure main()
local getlist := {}, getoptions := {}, lRet, oStatic, cVar1 := space(10), cVar2 := (10), cVar3 := (10), lAktiv := .t.
@ 3,3 DCSTATIC TYPE XBPSTATIC_TYPE_GROUPBOX SIZE 20, 4 OBJECT oStatic WHEN {|| lAktiv}
@ 1, 1 DCGET cVar1 PARENT oStatic
@ 2, 1 DCGET cVar2 PARENT oStatic WHEN {|| lAktiv}
@ 9, 3 DCGET cVar3
@ 10, 3 DCPUSHBUTTON SIZE 10, 2 CAPTION "um" ACTION {|| if(lAktiv, lAktiv := .f., lAktiv := .t.), dc_getrefresh() }
DCGETOPTIONS TITLE "Test"
DCREAD GUI TO lRet OPTIONS getoptions FIT
RETURN
-----------------
Greetings
Markus Walter
Greetings
Markus Walter
Re: Question about automatic disabling childs
This appears to be a bug or a limitation of the Xbase++ XbpStatic class.
I tried several tests and could not make it work correctly.
I tried several tests and could not make it work correctly.
The eXpress train is coming - and it has more cars.
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Re: Question about automatic disabling childs
Hi,
not nice to hear. This would be very handy witj complex screens.
What do you think about the idea to look from the Child: If one of the parent is disabled, it should be diabled, too?
not nice to hear. This would be very handy witj complex screens.
What do you think about the idea to look from the Child: If one of the parent is disabled, it should be diabled, too?
-----------------
Greetings
Markus Walter
Greetings
Markus Walter
Re: Question about automatic disabling childs
Ok, here is your fix:
Replace the METHOD XbpStatic:WhenHideEval in _DCCLASS.PRG with the below code.
Rebuild dclipx.dll by running build19.bat.
Replace the METHOD XbpStatic:WhenHideEval in _DCCLASS.PRG with the below code.
Rebuild dclipx.dll by running build19.bat.
Code: Select all
METHOD DC_XbpStatic:WhenHideEval( lEnable, lShow, lProtect )
LOCAL i, aChildList := ::childList()
IF Valtype(::whenBlock) = 'B'
lEnable:= Eval(::whenBlock,self)
IF lEnable
::enable()
FOR i := 1 TO Len(aChildList)
IF IsMethod(aChildList[i],'whenHideEval')
IF IsMemberVar(aChildList[i],'whenBlock') .AND. Valtype(aChildList[i]:whenBlock) == 'B'
aChildList[i]:whenHideEval( lEnable, lShow, lProtect )
ELSEIF IsMethod(aChildList[i],'enable')
aChildList[i]:enable()
ENDIF
ELSEIF IsMethod(aChildList[i],'enable')
aChildList[i]:enable()
ENDIF
NEXT
ELSE
::disable()
FOR i := 1 TO Len(aChildList)
IF IsMethod(aChildList[i],'disable')
aChildList[i]:disable()
ENDIF
NEXT
ENDIF
ENDIF
IF Valtype(::hideBlock) = 'B'
lShow := !Eval(::hideBlock,self)
IF lShow
IF !::isVisible()
::show()
ENDIF
ELSE
IF ::isVisible()
::hide()
ENDIF
ENDIF
ENDIF
IF Valtype(lProtect) == 'L' .AND. Valtype(::protectBlock) = 'B'
lProtect := Eval(::protectBlock,self)
ENDIF
RETURN self
The eXpress train is coming - and it has more cars.
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Re: Question about automatic disabling childs
Hello Roger,
thanks. That seems to work. Will this be part of the next build?
thanks. That seems to work. Will this be part of the next build?
-----------------
Greetings
Markus Walter
Greetings
Markus Walter
Re: Question about automatic disabling childs
Yes, this will be in the next build.
The eXpress train is coming - and it has more cars.