Change the Scale of a Window from within the window?
Posted: Sat Feb 02, 2013 11:10 am
Is it possible to change the scale of a window by incrementing the scale from within the window?
Press a button (or test a condition) and have the window resize while it is open?
Something like:
Press a button (or test a condition) and have the window resize while it is open?
Something like:
Code: Select all
#INCLUDE "dcdialog.ch"
PROC appsys
return
FUNCTION MAIN()
local aScale[5], GetOptions, GetList[0]
AFILL(aScale, 1.2)
aScale[5] := .F.
@ 1,1 DCSAY "Some Text On The Screen" SAYSIZE 20
@ 3,1 DCPUSHBUTTON CAPTION "Dummy Button" SIZE 12,1.5
@ 10,1 DCPUSHBUTTON CAPTION "<<" SIZE 3,1 ;
TOOLTIP "make window smaller" ;
ACTION {|| WindowRescale(0,@aScale) ;
, DC_GetRefresh(getlist) }
@ 10,4 DCPUSHBUTTON CAPTION ">>" SIZE 3,1 ;
TOOLTIP "make window larger" ;
ACTION {|| WindowRescale(1,@aScale) ;
, DC_GetRefresh(getlist) }
DCGETOPTIONS ;
SAYWIDTH 50 ;
SCALEFACTOR aScale ;
AUTORESIZE
DCREAD GUI FIT ADDBUTTONS OPTIONS GetOptions
RETURN NIL
*--------------
FUNCTION WindowRescale(nOpt,aScale)
local nCurSize, nNewSize
nCurSize := aScale[1]
IF nOpt==0
nNewSize := nCurSize - 0.1
nNewSize := MAX(nNewSize, 0.9 )
AFILL(aScale,nNewSize)
aScale[5] := .F.
ELSE // nOpt==1
nNewSize := nCurSize + 0.1
nNewSize := MIN(nNewSize, 2.0 )
AFILL(aScale,nNewSize)
aScale[5] := .F.
ENDIF
RETURN aScale