Page 1 of 2

How refresh a dialog ?

Posted: Tue Mar 18, 2008 1:18 pm
by Silvio
I load a dialog
in this dialog I have a MENU pulldown where I can set a logic variable

before of this dialog thereis the variable lSmall

If lsmall
DIALOG
endif

IF Lbig
DIALOG
endif

ACTIVATE

If change the value of this logic variable How I can make to reload my application and reload the dialog ?

Re: How refresh a dialog ?

Posted: Tue Mar 18, 2008 2:15 pm
by Enrico Maria Giordano
oDlg:End()

and then

DEFINE DIALOG oDlg...

EMG

Posted: Tue Mar 18, 2008 2:53 pm
by Silvio
perhaps you not understand me

I made a menu
...
menuitem " scentific" action ( lstandard:=.f.,oDlg:refresh())
....
endmenu
where I must insert the command odlg:end() and define dialog ... ?

For me this is very difficult to understand...Perhaps it is time: here is rain

Posted: Tue Mar 18, 2008 3:01 pm
by Enrico Maria Giordano
You have to End() the current dialog and call the function that created it, the one with
If lsmall
DIALOG
endif

IF Lbig
DIALOG
endif

ACTIVATE
EMG

Posted: Wed Mar 19, 2008 1:43 am
by dutch
I've used multilanguage menu and change on the fly.
You must end menu and rebuild it again.

Regards,
Dutch

Code: Select all

   MEMVAR->Lang := cLang
   oMenu:End()
   BuildMenu( oWnd )
   oWnd:SetMenu( oMenu )

Posted: Wed Mar 19, 2008 8:08 am
by Enrico Maria Giordano
It seems that Silvio wants to modify the entire dialog. If that is true, it is easier to design a new dialog and alternatively End() the current and DEFINE the new.

EMG

Posted: Wed Mar 19, 2008 8:48 am
by Silvio
THansk Emg
I sent to Antonio the new msgcalc()

Posted: Wed Mar 19, 2008 7:24 pm
by driessen
Silvio,

Why don't you use some code like this :

Code: Select all

LOCAL cRet := .T.
LOCAL cCheck := .F.

DO WHILE cRet

   IF cCheck
      DEFINE DIALOG ...
   ELSE
      DEFINE DIALOG ...
   ENDIF
   ....
   REDEFINE CHECKBOX cCheck ID ... ON CHANGE (cRet:=.T.,oDlg:End())
   ....
   REDEFINE BUTTON ... ACTION (cRet:=.F.,oDlg:End())
   ....
   ACTIVATE ....

   IF !cRet
      EXIT
   ENDIF

ENDDO
The button is, of course, the END-button.

I use it often and it works fine.

Good luck.

Posted: Wed Mar 19, 2008 7:33 pm
by Silvio
NOOOOOOOOOOOOO

I want refresh the same dialog

sample :
open the WIN XP ( OR 2000) CALC.EXE

NOW YOU HAVE THE CALC STANDARD
OPEN THE SCENTIFIC CALC

i HOPE YOU UNDERSTAND ME NOW

Posted: Thu Mar 20, 2008 8:01 am
by Enrico Maria Giordano
Ok, then you have to play with Hide() and Show() methods of the controls and with the Move() method of the dialog.

EMG

Posted: Thu Mar 20, 2008 1:42 pm
by StefanHaupt
you can also use pages, one for the standard look and one for scientific look. Then you can easily change the look.

Posted: Fri Mar 21, 2008 11:36 am
by Silvio
DEAR EMG
Can you make an test small with move function please
for understand How I must make it

Posted: Fri Mar 21, 2008 3:22 pm
by Antonio Linares
Silvio,

Its the same way the folder works. It shows the active page and hides the previous one:

oDlg1:Hide(), oDlg2:Show()

Posted: Fri Mar 21, 2008 5:44 pm
by Silvio
Dear Antonio,
None friend understand what I want
If you load Windows Calc you can select scentific calc or stardard calc
I have msgcal ( calc standard) and I insert on a menu pulldown a selection to change the form of the dialog

IF lStandard // active standard calc
DEFINE DIALOG oDlg SIZE 255, 245 TITLE cTitle FONT oFont ICON oIco
ELSE
DEFINE DIALOG oDlg SIZE 485, 245 TITLE cTitle FONT oFont ICON oIco
ENDIF

I want only refresh the dialog and change the form iand esecute

DEFINE DIALOG oDlg SIZE 485, 245 TITLE cTitle FONT oFont ICON oIco


if lstandard is .f.


I hope you help me

Posted: Fri Mar 21, 2008 8:21 pm
by Antonio Linares
If you just want to change its size then you can use:

oDlg:SetSize( nWidth, nHeight )

To change its title use:

oDlg:SetText( "new title" )