How refresh a dialog ?

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Silvio,

Here you have a working sample:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg TITLE "Calculator"

   ACTIVATE DIALOG oDlg ;
      ON INIT BuildPages( oDlg )

return nil

function BuildPages( oDlg )

   local oPages := TPages():New( 0, 0, oDlg:nWidth(), oDlg:nHeight(), oDlg )
   local oDlg1, oDlg2

   oDlg:SetMenu( BuildMenu( oPages ) )
   
   oDlg:oClient = oPages
   oDlg:ReSize()

   DEFINE DIALOG oDlg1 STYLE WS_CHILD OF oPages

   @ 0.5, 1 BUTTON "+" OF oDlg1 SIZE 10, 10

   @ 3, 2 SAY "Normal" OF oDlg1
   
   oPages:AddPage( oDlg1 )

   DEFINE DIALOG oDlg2 STYLE WS_CHILD OF oPages

   @ 0.5, 1 BUTTON "Sin" OF oDlg2 SIZE 10, 10

   @ 3, 2 SAY "Scientific" OF oDlg2
   
   oPages:AddPage( oDlg2 )
   
   oPages:SetOption( 1 )
   
return nil

function BuildMenu( oPages )

   local oMenu
   
   MENU oMenu 2007
      MENUITEM "Type"
      MENU
         MENUITEM "Normal"     ACTION oPages:SetOption( 1 )
         MENUITEM "Scientific" ACTION oPages:SetOption( 2 )
      ENDMENU
   ENDMENU
   
return oMenu         
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

DearAntonio
thanks for this sample
but i compiled it and I think it not run ok for me



I must set the first dialog as a small calc

Image

when I select scentific it must open a dialog big ( into same dialog) as this image



Image
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Dear Antonio perhaps
I resolve it
sorry

I used setsize function

function BuildMenu( oPages ,oDlg)

local oMenu

MENU oMenu 2007
MENUITEM "Type"
MENU
MENUITEM "Normal" ACTION (oPages:SetOption( 1 ) , oDlg:setsize( 255, 245),oDlg:refresh())
MENUITEM "Scientific" ACTION (oPages:SetOption( 2 ), oDlg:setsize( 485, 245),oDlg:refresh())
ENDMENU
ENDMENU

return oMenu



But now when select a type not erased the old dialog



Image



it is a graphic bug ?
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Silvio,

In Vista is working fine.

We are going to test it in XP also.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Silvio wrote:DEAR EMG
Can you make an test small with move function please
for understand How I must make it
Here it is:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBtn

    LOCAL oGet1, oGet2

    LOCAL cVar1 := SPACE( 30 )
    LOCAL cVar2 := SPACE( 60 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET oGet1 VAR cVar1
    @ 1, 1 GET oGet2 VAR cVar2

    @ 3, 1 BUTTON oBtn PROMPT "Scientific";
           ACTION CHANGE( oDlg, oBtn, oGet1, oGet2 )

    ACTIVATE DIALOG oDlg;
             ON INIT oGet2:Hide()

    RETURN NIL


STATIC FUNCTION CHANGE( oDlg, oBtn, oGet1, oGet2 )

    IF oBtn:GetText() = "Scientific"
        oDlg:SetSize( 500, , .T. )
        oBtn:SetText( "Standard" )
        oGet1:Hide()
        oGet2:Show()
    ELSE
        oDlg:SetSize( 300, , .T. )
        oBtn:SetText( "Scientific" )
        oGet1:Show()
        oGet2:Hide()
    ENDIF

    RETURN NIL
EMG
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

EMG now the problem is another
Iask you that when i cannot create something as I asked.
Now Antonio founded the solution but perhaps in win xp there is a graphic bug.
Read please two thread on top.


Dear Antonio,
Iwait you for a solution.
Best Regards, Saludos

Falconi Silvio
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Did you try my sample? I'm using XP without noticed any problems.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Silvio,

Just modify the code this way and it paints fine in XP too:

MENUITEM "Normal" ACTION ( oPages:SetOption( 1 ), oDlg:SetSize( 255, 245, .T. ) )
MENUITEM "Scientific" ACTION ( oPages:SetOption( 2 ), oDlg:SetSize( 485, 245, .T. ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

dear antonio and emg
your samples run all, thanks
but now I several problem to insert your method on my sources.
it is no easy
1. there are many buttons in all two dialogs
2. I must setcheck the menu items
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

perhaps the emg sample is easy to insert but I have

2 get
12 radio buttons
1 say
48 buttons
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Silvio,

I suggest you to create the two dialogs ("normal" and "scientific") using resources. That way it will be easier for you.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Dear antonio
I try to insert emg method
it run ok but when I select scentific it create the dialog ok but on top of the screen
there is a function to say to dialog to create it to the center of the screen
i insert thid command


MENUITEM oItem[4] PROMPT cMenuStandard;
ACTION ( lStandard:=.t. , oDlg:SetSize( 255, 245 , .T. ))
MENUITEM oItem[5] PROMPT cMenuScientific;
ACTION ( lStandard:=.F. , oDlg:SetSize(485, 245 , .t. ) )
Best Regards, Saludos

Falconi Silvio
Post Reply