How refresh a dialog ?

Postby Antonio Linares » Sat Mar 22, 2008 5:52 am

Silvio,

Here you have a working sample:
Code: Select all  Expand view
#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
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Sun Mar 23, 2008 12:55 am

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

Postby Silvio » Sun Mar 23, 2008 1:09 am

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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Sun Mar 23, 2008 2:09 am

Silvio,

In Vista is working fine.

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sun Mar 23, 2008 9:14 am

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  Expand view
#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
Enrico Maria Giordano
 
Posts: 8701
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Silvio » Sun Mar 23, 2008 9:48 am

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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Enrico Maria Giordano » Mon Mar 24, 2008 11:16 am

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8701
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Mar 24, 2008 12:22 pm

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
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Mon Mar 24, 2008 11:28 pm

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

Postby Silvio » Mon Mar 24, 2008 11:33 pm

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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Mon Mar 24, 2008 11:36 pm

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
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Mon Mar 24, 2008 11:55 pm

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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 53 guests