Otto
http://www.atzwanger-software.com/fw/me ... trocp.html
Code: Alles auswählen
static aDates, aLog
function Main()
local oWnd, oFont, oBrw, oFont2, oFont3
local oPanel
local oItemTitle
local aItems
SET DATE GERMAN
SET CENTURY ON
SetGetColorFocus()
aItems := { ;
{ "Personalize", "Customize your lock screen and user tile" }, ;
{ "Users", "Change your account or add new ones" }, ;
{ "Wireless", "Turn wireless and airplane mode on or off"}, ;
{ "Notifications", "Choose if apps notify you" }, ;
{ "Privacy", "Control how apps use your personal info" }, ;
{ "General", "Change time zone and keyboard settings" }, ;
{ "Search", "Pick what/where you want to search" }, ;
{ "neu", "neu" } }
// variables for gets
aDates := Array( Len( aItems ) )
AEval( aDates, { |u,i| aDates[ i ] := Date() - i * 20 } )
aLog := Array( Len( aItems ) )
AFill( aLog, .t. )
DEFINE FONT oFont NAME "Segoe UI Light" SIZE 0, -52
DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0, -32
DEFINE FONT oFont3 NAME "Segoe UI Light" SIZE 0, -16
DEFINE WINDOW oWnd STYLE nOr( WS_POPUP, WS_MAXIMIZE ) ;
COLOR RGB( 170, 170, 170 ), CLR_WHITE
@ 32, 60 SAY "Control Panel" FONT oFont SIZE 300, 100 PIXEL OF oWnd
@ 9 * 14, 7 * 8 XBROWSE oBrw COLUMNS 1, 2 ARRAY aItems CELL ;
FONT oFont2 SIZE 400, -20 PIXEL NOBORDER OF oWnd
oBrw:oDataFonts := { oFont2, oFont3 }
SetXBrowseForCP( oBrw, .t., .t. )
@ 32, 480 SAY oItemTitle PROMPT oBrw:aRow[ 1 ] FONT oFont SIZE 300, 100 PIXEL OF oWnd UPDATE
oBrw:bChange := { || oItemTitle:Refresh(), oPanel:GoToPage( oBrw:aCols[ 1 ]:Value ) }
// Panel Controls
oPanel := TScrollPanel():New( oBrw:nTop, oBrw:nLeft + oBrw:nWidth + 20, ;
GetSysMetrics( 1 ) - 20, GetSysMetrics( 0 ) - 10, oWnd, .t. )
oPanel:bLClicked := { || oPanel:SetFocus() }
SetControls( oPanel, aItems, oFont2, oFont3 )
Eval( oBrw:bChange )
oBrw:SetFocus()
ACTIVATE WINDOW oWNd MAXIMIZED ;
ON CLICK oWnd:End()
RELEASE FONT oFont, oFont2, oFont3
return nil
//----------------------------------------------------------------------------//
function SetXbrowseForCP( oBrw, lVScroll, lAutoWidth, oFont ) // we shall include it in libraray
local oWnd, oSort, aSort
DEFAULT lVScroll := .f., lAutoWidth := .f.
WITH OBJECT oBrw
:lRecordSelector := .f.
:lHeader := .f.
:lHScroll := .f.
:lVScroll := lVScroll
:nStretchCol := 1
:bClrStd := { || { RGB( 170, 170, 170 ), CLR_WHITE } }
:bClrSel := ;
:bClrSelFocus := { || { CLR_WHITE, RGB( 34, 177, 76 ) } }
:SetColor( "B/W*" )
:aCols[ 1 ]:SetColsAsRows( :aCols )
:CreateFromCode()
:nRowHeight += 10
if lAutoWidth
:nWidth := :aCols[ 1 ]:nWidth + 1 + If( :lVScroll, 16, 0 )
endif
END
return oBrw
//----------------------------------------------------------------------------//
static function SetControls( oPanel, aItems, oFont2, oFont3 )
local aItem, n := 1
local nRow := 50
for Each aItem in aItems
nRow := SetControlPage( oPanel, aItem, nRow, oFont2, oFont3, n++ )
nRow += 30
next
oPanel:SetRange()
return nil
//----------------------------------------------------------------------------//
static function SetControlPage( oPanel, aItem, nRow, oFont2, oFont3, nItem )
local oCtrl
oPanel:SetPage( aItem[ 1 ], nRow )
@ nRow, 20 SAY aItem[ 1 ] SIZE 400,40 PIXEL OF oPanel FONT oFont2 TRANSPARENT
nRow += 50
@ nRow, 20 SAY aItem[ 2 ] SIZE 400,30 PIXEL OF oPanel FONT oFont3 TRANSPARENT
nRow += 40
@ nRow, 20 SAY "Enter Date" SIZE 400,25 PIXEL OF oPanel FONT oFont3 TRANSPARENT
nRow += 30
@ nRow, 200 GET aDates[ nItem ] SIZE 100,25 PIXEL OF oPanel FONT oFont3
nRow += 30
@ nRow, 20 SAY "Enter Choice" SIZE 400,25 PIXEL OF oPanel FONT oFont3 TRANSPARENT
nRow += 30
@ nRow, 200 SWITCH aLog[ nItem ] OF oPanel SIZE 60,20 PIXEL
nRow += 35
nRow += 30 // MARGIN
return nRow
//----------------------------------------------------------------------------//