Page 2 of 2
Posted: Sat Mar 22, 2008 5:52 am
by Antonio Linares
Silvio,
Here you have a working sample:
Code: Select all | Expand
#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
Posted: Sun Mar 23, 2008 12:55 am
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

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

Posted: Sun Mar 23, 2008 1:09 am
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

it is a graphic bug ?
Posted: Sun Mar 23, 2008 2:09 am
by Antonio Linares
Silvio,
In Vista is working fine.
We are going to test it in XP also.
Posted: Sun Mar 23, 2008 9:14 am
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 | Expand
#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
Posted: Sun Mar 23, 2008 9:48 am
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.
Posted: Mon Mar 24, 2008 11:16 am
by Enrico Maria Giordano
Did you try my sample? I'm using XP without noticed any problems.
EMG
Posted: Mon Mar 24, 2008 12:22 pm
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. ) )
Posted: Mon Mar 24, 2008 11:28 pm
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
Posted: Mon Mar 24, 2008 11:33 pm
by Silvio
perhaps the emg sample is easy to insert but I have
2 get
12 radio buttons
1 say
48 buttons
Posted: Mon Mar 24, 2008 11:36 pm
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.
Posted: Mon Mar 24, 2008 11:55 pm
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. ) )