Update all controls of a dialog

Post Reply
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Update all controls of a dialog

Post by StefanHaupt »

Hi,

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

Stefan
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: Update all controls of a dialog

Post by Rimantas »

StefanHaupt wrote:Hi,

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

Stefan
Try oDlg:Update()

Regards !
Rimantas U.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Update all controls of a dialog

Post 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
R.F.
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Post 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.
Saludos
R.F.
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Post 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

     function main()
         ...
         OverrideAndExtend()
         ...
     return

Code: Select all

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

   ...
   /*refresh control in a dialog*/
   oDlg:RefreshDialog()
   /*refresh a page dialog*/
   oFolder:RefreshPages()
   ...
salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Many thanks for all tips, it´s working now javascript:emoticon(':D')
Very Happy
Post Reply