Moderador: Moderadores
asimoes escreveu:Tem como desabilitar/habilitar todos os componentes de tela inclusive botões com uma simples chamada por aEval ?
//------------------------------------------------------------------------------------------------------------------
FUNCTION LockUnlockControls( oDlg, lOper )
LOCAL o
If Hb_IsObject( oDlg )
If Hb_IsLogical( lOper )
For Each o In oDlg:aControls
Try
If lOper
// habilitar
If ! o:enabled()
o:enable()
Endif
Else
// desabilitar
If o:enabled()
o:disable()
Endif
Endif
Catch
// caso algum controle não tenha os métodos enable() / disable()
End Try
Next
oDlg:refresh()
Endif
Endif
RETURN NIL
//------------------------------------------------------------------------------------------------------------------
2019-02-19 11:35 UTC+0300 Alexander Kresin <alex@...>
* source/gtk/hcwindow.prg
* source/winapi/hcwindow.prg
* New function hwg_GetItemByName( arr, cName ) has been added, which looks for
an object in an array by the object's name (:objname), for example:
oDlg := GetItemByName( HDialog():aModalDialogs, "ODLG1" )
oFont := GetItemByName( HFont():aFonts, "OFONTBOLD" )
FUNCTION hwg_CreateGetList( oDlg )
LOCAL i, j, aLen1 := Len( oDlg:aControls ), aLen2
FOR i := 1 TO aLen1
IF __ObjHasMsg( oDlg:aControls[i], "BSETGET" ) .AND. oDlg:aControls[i]:bSetGet != Nil
AAdd( oDlg:GetList, oDlg:aControls[i] )
ELSEIF !Empty( oDlg:aControls[i]:aControls )
aLen2 := Len( oDlg:aControls[i]:aControls )
FOR j := 1 TO aLen2
IF __ObjHasMsg( oDlg:aControls[i]:aControls[j], "BSETGET" ) .AND. oDlg:aControls[i]:aControls[j]:bSetGet != Nil
AAdd( oDlg:GetList, oDlg:aControls[i]:aControls[j] )
ENDIF
NEXT
ENDIF
NEXT
RETURN Nil
LOCAL aControls := oWnd:aControls, oItem
FOR EACH oItem IN aControls
IF oItem:bSize != NIL
Eval( oItem:bSize, oItem, hwg_Loword( lParam ), hwg_Hiword( lParam ) )
ENDIF
NEXT
For n:=1 to len(HDialog:aControls)
HDialog:aControls[n]:Disable()
Next
For n:=1 to len(ThisForm:aControls)
ThisForm:aControls[n]:Disable()
Next
FOR EACH oElemento IN ThisForm:aControls
IF Hb_IsObject( oElemento )
oElemento:disable()
ENDIF
NEXT
AEval( HDialog:aControls, { | e | e:Disable() } )
METHOD GUIEnable() INLINE AEval( ::aGuiButtons, { | oElement | oElement[ 3 ]:Enable() } )
METHOD GUIDisable() INLINE AEval( ::aGuiButtons, { | oElement | oElement[ 3 ]:Disable() } )
Itamar M. Lins Jr. escreveu:O problema em ficar insistindo em tecnologias obsoletas gera um cansaço extra.
Usuários vendo este fórum: Nenhum usuário registrado online e 3 visitantes