Page 1 of 1

Update all controls of a dialog

PostPosted: Fri Jan 20, 2006 11:27 am
by StefanHaupt
Hi,

how can update all controls of a dialog ? oDlg:Refresh() does not work.

Stefan

Re: Update all controls of a dialog

PostPosted: Fri Jan 20, 2006 11:32 am
by Rimantas
StefanHaupt wrote:Hi,

how can update all controls of a dialog ? oDlg:Refresh() does not work.

Stefan


Try oDlg:Update()

Regards !

Re: Update all controls of a dialog

PostPosted: Fri Jan 20, 2006 11:53 am
by Enrico Maria Giordano
StefanHaupt wrote:Hi,

how can update all controls of a dialog ? oDlg:Refresh() does not work.

Stefan


Try adding UPDATE clause to the controls you want to refresh. Or use a loop through oDlg:aControls to refresh any single control.

EMG

PostPosted: Fri Jan 20, 2006 5:32 pm
by R.F.
Resuming:

1) Add the UPDATE clause to all your controls in your dialog:

REDEFINE GET oGet VAr xVar blah blah blah UPDATE
REDEFINE CHECKBOX oChk blah blah blah UPDATE

2) Whenever you want perfrom an update of all the controls inside a dialog, simply do a oDlg:Update(), and you are done.

3) Rember: the oDlg:Update() only works over the controls which have the UPDATE clause included.

PostPosted: Fri Jan 20, 2006 9:01 pm
by carlos vargas
I Use this modification to class in fivewin, only work with xharbour

at begin of the application
call the procedure OverrideAndExtend()

example
Code: Select all  Expand view
     function main()
         ...
         OverrideAndExtend()
         ...
     return


Code: Select all  Expand view
PROCEDURE OverrideAndExtend()
   OVERRIDE METHOD DispBegin IN CLASS TWindow WITH KDispBegin
   OVERRIDE METHOD DispEnd   IN CLASS TWindow WITH KDispEnd

   EXTEND CLASS TFOLDER  WITH METHOD RefreshPages
   EXTEND CLASS TFOLDER  WITH METHOD GoFirstControl
   EXTEND CLASS TDIALOG  WITH METHOD RefreshDialog   
RETURN

STATIC FUNCTION KDispBegin()
   LOCAL SELF := HB_QSelf()
RETURN SELF

STATIC FUNCTION KDispEnd()
   LOCAL SELF := HB_QSelf()
RETURN NIL


STATIC FUNCTION RefreshDialog( nPos )
   LOCAl Self := HB_QSelf()

   aeval( ::aControls, { |oCtrl| oCtrl:Refresh() } )
        if nPos <> NIL .and. valtype( nPos ) = "N"
          ::aControls[ nPos ]:SetFocus()
        endif

RETURN NIL

STATIC FUNCTION RefreshPages()
   LOCAl Self := HB_QSelf()
   LOCAL oPage

   FOR EACH oPage IN ::aDialogs
      aeval( oPage:aControls, { |oCtrl| oCtrl:Refresh() } )
   NEXT

RETURN NIL

STATIC FUNCTION GoFirstControl()
   LOCAL SELF := HB_QSelf()
   
   ::aDialogs[1]:aControls[1]:SetFocus()

RETURN NIL



example of use
Code: Select all  Expand view
   ...
   /*refresh control in a dialog*/
   oDlg:RefreshDialog()
   /*refresh a page dialog*/
   oFolder:RefreshPages()
   ...


salu2
carlos vargas
Code: Select all  Expand view

PostPosted: Mon Jan 23, 2006 9:02 am
by StefanHaupt
Many thanks for all tips, it´s working now javascript:emoticon(':D')
Very Happy