Tenemos un problema con el tDockPnel, ya que el momento de cambiar el tamaño de la ventana, los iconos del encabezado del panel, no se alinean a la derecha, si no que conservan la posición inicial.
El problema surge cuando utilizarmos la clausula
- Code: Select all Expand view RUN
- :lLeftImgs := .F.
- Code: Select all Expand view RUN
#include "Fivewin.ch"
#include "colores.ch"
#include "tgraph.ch"
#include "ribbon.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Static oWindow
Static nWAncho
Static nWAlto
Static nCol
Static nRow
Static oFont
Static oFontB
Static oFontD
Static oFont1
Static oFont2
Static oFont3
Static oFont4
Static oFontE
Static oFontS
Static oFontCtrl
Static cPathApp
Static oDock1
Static oDock2
Static oDock3
Static oDock4
Static oDock5
Static cText := ""
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function Main()
local cFont := "Liberation Mono" //TAHOMA //CALIBRI //SEGOE UI SYMBOL
SetResDebug( .T. )
//? JPEGLee()
cPathApp := cFilePath( GetModuleFileName( GetInstance() ) )
FErase( cPathApp + "Checkres.txt" )
DEFINE FONT oFont NAME cFont SIZE 0,-11
DEFINE FONT oFontB NAME cFont SIZE 0,-14 BOLD //ARIAL NARROW
DEFINE FONT oFont1 NAME cFont SIZE 0,-11 BOLD
DEFINE FONT oFontE NAME cFont SIZE 0,-14
DEFINE FONT oFont2 NAME cFont SIZE 0,-16
DEFINE FONT oFont3 NAME cFont SIZE 0,-20 //BOLD
DEFINE FONT oFont4 NAME "CALIBRI" SIZE 0,-16
DEFINE FONT oFontCtrl NAME cFont SIZE 0, -9 BOLD
DEFINE FONT oFontS NAME "FIXEDSYS" SIZE 0,-12
TestDockPnel()
oFont:End()
oFont1:End()
oFont2:End()
oFont3:End()
oFont4:End()
oFontB:End()
oFontE:End()
oFontCtrl:End()
oFontS:End()
Checkres()
Return nil
//----------------------------------------------------------------------------//
/*
FUNCTION JPEGLee()
#pragma __binarystreaminclude "..\bitmaps\olga1.jpg" | RETURN %s*/
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Static Function TestDockPnel()
local nCol
local nRow
TDockPnel():lAllowMove := .T.
nWAncho := 600
nWAlto := 400
nCol := Int( ( GetSysMetrics( 0 ) - nWAncho ) / 2 )
nRow := Int( ( GetSysMetrics( 1 ) - nWAlto ) / 2 ) // + 2
DEFINE WINDOW oWindow FROM nRow, nCol TO nWAlto + nRow, nWAncho + nCol ; //MDI ;
PIXEL TITLE "Test TDockPnel Control - " + FWVERSION ;
COLOR CLR_WHITE, Rgb( 182, 182, 182 )
CreaDocks()
ACTIVATE WINDOW oWindow // ON INIT CreaDocks()
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function CreaDocks()
oDock1 := TDockPnel():New( oWindow )
WITH OBJECT oDock1
:SetHeightCaption( 40 )
:SetCoors( { | o | 10 }, { | o | 10 }, ;
{ | o | Int( o:oWnd:nHeight / 2 ) + 54 }, ;
{ | o | Int( o:oWnd:nWidth / 2 ) - XEVal( o:nLeft, o ) } )
:SetCaption( { | o | "Title" } )
:SetColors( METRO_RED, CLR_WHITE, Rgb( 88, 88, 88 ), CLR_HGRAY )
:SetFont( oFont4 )
:SetBorderSize( 1 )
:SetImgsFiles( { { "..\bitmaps\16x16\panel.bmp", ;
{ || oDock1:aBtnBmps[ 1 ]:SetImages( if( oDock1:lSelected, "..\bitmaps\16x16\panel.bmp", "\Fwh\bitmaps\16x16\check.bmp" ) ), ;
oDock1:lSelected := !oDock1:lSelected }, "ToolTip" } } )
:SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := Test1( o, nT, nL, nH, nW ) } )
:bRClicked := { || MsgInfo( oDock1:oWnd:aControls[ 1 ]:ClassName() ) }
//
// Controls predefined in :oPnelH ( interior Panel )
//
:lBottomH := .T.
:SetTypeCtrl( 2 )
:SetHeightCtrl( 32 )
:SetColorsCtrl( CLR_WHITE, METRO_OLIVE )
:aRectText := { 8, 60 }
:cTitH := "Control Title - " + if( :lBottomH, "TOP", "BOTTOM" )
:Activate()
END
oDock2 := TDockPnel():New( oWindow )
WITH OBJECT oDock2
:SetHeightCaption( 40 )
:SetCoors( { | o | XEval( o:oWnd:aControls[ 1 ]:nTop, o ) }, ;
{ | o | XEval( o:oWnd:aControls[ 1 ]:nRight, o ) + 10 }, ;
{ | o | XEval( o:oWnd:aControls[ 1 ]:nBottom, o ) }, ;
{ | o | Int( o:oWnd:nWidth / 2 ) + XEval( o:nLeft, o ) - 40 } )
:SetCaption( { | o | "Login Process" } )
:SetColors( CLR_WHITE, METRO_AMBER, METRO_AMBER, CLR_WHITE )
:SetBorderSize( 1 )
:SetFont( oFont4 )
:lLeftImgs := .F.
:SetImgsFiles( { { "..\bitmaps\16x16\options.bmp", { | o | MyPopupMnu( o ) }, "ToolTip" } } )
:SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := Test3( o, nT, nL, nH, nW ) } )
:bRClicked := { || MsgInfo( oDock2:oPnelH:aControls[ 1 ]:ClassName() ) }
:Activate()
END
oDock3 := TDockPnel():New( oWindow )
WITH OBJECT oDock3
:SetHeightCaption( 40 )
:SetCoors( { | o | XEval( o:oWnd:aControls[ 2 ]:nBottom, o ) + 10 }, ;
{ | o | 10 }, ;
{ | o | Int( o:oWnd:nHeight / 2 ) + XEval( o:oWnd:aControls[ 2 ]:nHeight, o ) - 94 }, ;
{ | o | XEVal( o:oWnd:aControls[ 2 ]:nRight, o ) } )
:SetCaption( { | o | "Title" } )
:SetBorderSize( 4 )
:SetColors( CLR_WHITE, METRO_RED, Rgb( 88, 88, 88 ), CLR_WHITE )
:SetFont( oFont4 )
:SetImgsFiles( { { "..\bitmaps\16x16\min.bmp", ;
{ || oDock1:aBtnBmps[ 1 ]:SetImages( if( oDock1:lSelected, "\Fwh\bitmaps\16x16\panel.bmp", "\Fwh\bitmaps\16x16\check.bmp" ) ), ;
oDock1:lSelected := !oDock1:lSelected }, "ToolTip" } } )
:SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := Test2( o, nT, nL, nH - 1, nW, 4 ), ;
Test2( o, nT, oB:nRight + 2, nH - 1, nW - 2, 1 ) } )
:bRClicked := { || MsgInfo( oDock1:oWnd:aControls[ 1 ]:ClassName() ) }
:Activate()
END
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function Test1( oP, nT, nL, nH, nW )
local oBrw
local oBar
local aData := { { "JAN", 1000, 1200, 900, 400, 700, 400 }, ;
{ "FEB", 1100, 1300, 1000, 500, 800, 500 }, ;
{ "MAR", 1050, 1800, 1900, 700, 1400, 1600 }, ;
{ "APR", 1825, 1975, 1850, 675, 1100, 1425 }, ;
{ "MAY", 2000, 1670, 1550, 675, 1100, 1425 }, ;
{ "JUN", 0970, 1025, 1100, 675, 1100, 1425 }, ;
{ "JUL", 1150, 1600, 1750, 675, 1100, 1425 }, ;
{ "AUG", 1250, 1700, 1850, 675, 1100, 1425 }, ;
{ "SEP", 1150, 1320, 1450, 675, 1100, 1425 }, ;
{ "OCT", 1250, 1700, 1850, 675, 1100, 1425 }, ;
{ "NOV", 1250, 1700, 1850, 675, 1100, 1425 }, ;
{ "DEC", 1250, 1700, 1850, 675, 1100, 1425 } ;
}
@ nT, nL XBROWSE oBrw ;
SIZE 0, 0 OF oP PIXEL ;
DATASOURCE aData ;
COLUMNS 1, 2, 3, 4, 5, 6 ;
HEADERS "MONTH", "USA", "EUROPE", "ASIA", "OTHERS", "REST" ;
AUTOSORT LINES STYLE FLAT // NOBORDER
WITH OBJECT oBrw
:lRecordSelector := .F.
:lHScroll := .F.
:lVScroll := .F.
:l2007 := .F.
:nStretchCol := 1
:lFitGridHeight := .T.
:nHeaderHeight := 32
:nRowHeight := 27
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bClrRowFocus := { || { CLR_BLACK, RGB( 185, 220, 255 ) } }
:bClrStd := { || { Rgb( 88, 88, 88 ), CLR_WHITE } }
:nColorPen := CLR_HGRAY
:bClrHeader := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
:lFullGrid := .T.
:SetFont( oFontCtrl )
AEVal( :aCols, { | o | o:cEditPicture := "999,999.99", o:nWidth := Int( o:oBrw:nWidth / 6 ) }, 2, Len( :aCols ) )
AEVal( :aCols, { | o | o:oHeaderFont := oFont1 } )
:CreateFromCode()
END
Return oBrw
//----------------------------------------------------------------------------//
Static Function Test2( oP, nT, nL, nH, nW, nType )
local oGraph
local aVals1
local aVals2
local aVals3
local aCols := { ;
{ "MONTH", 'C', 3, 0 }, ;
{ "USAS", 'N', 4, 0 }, ;
{ "EUROS", 'N', 4, 0 }, ;
{ "ASIAS", 'N', 4, 0 }, ;
{ "USAC", 'N', 4, 0 }, ;
{ "EUROC", 'N', 4, 0 }, ;
{ "ASIAC", 'N', 4, 0 } }
local aData := { { "JAN", 1000, 1200, 900, 400, 700, 400 }, ;
{ "FEB", 1100, 1300, 1000, 500, 800, 500 }, ;
{ "MAR", 1050, 1800, 1900, 700, 1400, 1600 }, ;
{ "APR", 1825, 1975, 1850, 675, 1100, 1425 }, ;
{ "MAY", 2000, 1670, 1550, 675, 1100, 1425 }, ;
{ "JUN", 0970, 1025, 1100, 675, 1100, 1425 }, ;
{ "JUL", 1150, 1600, 1750, 675, 1100, 1425 }, ;
{ "AUG", 1250, 1700, 1850, 675, 1100, 1425 }, ;
{ "SEP", 1150, 1320, 1450, 675, 1100, 1425 }, ;
{ "OCT", 1250, 1700, 1850, 675, 1100, 1425 }, ;
{ "NOV", 1250, 1700, 1850, 675, 1100, 1425 }, ;
{ "DEC", 1250, 1700, 1850, 675, 1100, 1425 } ;
}
DEFAULT nT := 2
DEFAULT nL := 2
DEFAULT nH := oP:nHeight - 4
DEFAULT nW := oP:nWidth - 4
DEFAULT nType := 1
if !File( cPathApp + "SALECOST.DBF" )
DBCREATE( cPathApp + "SALECOST.DBF", aCols, "DBFCDX", .T., "SC1" )
FW_ArrayToDBF( aData )
else
DbUseArea( .F., "DBFCDX", cPathApp + "SALECOST.DBF", "SC1", .T., .F. )
endif
GO TOP
@ nT, nL GRAPH oGraph SIZE Int( nW / 2 ) - 2, nH PIXEL OF oP ;
TITLE "Sales and Costs" ;
XVALUES YVALUES LEGENDS
//oGraph:lBorders := .T.
oGraph:lViewVal := .T.
oGraph:nType := nType
oGraph:SetColor( oP:nClrText, oP:nClrPane )
oGraph:cTitY := SC1->MONTH
//oGraph:l3D := .T.
aVals1 := { SC1->USAS, SC1->EUROS }
aVals2 := { SC1->USAC, SC1->EUROC }
ADD SERIE TO oGraph SERIE aVals1 LEGEND "Sales" COLOR METRO_OLIVE
ADD SERIE TO oGraph SERIE aVals2 LEGEND "Costs" COLOR METRO_STEEL
SET Y LABELS OF oGraph TO { "USA", "EUROPE" } //, "ASIA" }
oGraph:nMaxVal := 2000
oGraph:SetArrayFonts( { oFont4, oFont, oFont1, oFont, oFontB, oFontE, oFont1, oFont1, oFontB } )
if nType = 1 .or. nType = 2
//oGraph:SetYVals( { "A", "N", "V", "O", "J" } )
oGraph:nXRanges := 8
oGraph:nMaxVal := 3000
endif
Return oGraph
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function MyPopupMnu( o )
local oMnu
local nRow := o:nTop + Int( o:nHeight / 2 )
local nCol := o:nLeft + Int( o:nWidth / 2 )
MENU oMnu POPUP 2013 ;
COLORSELECT METRO_STEEL, METRO_STEEL, CLR_WHITE ;
COLORMENU CLR_WHITE, CLR_BLUE ;
COLORSEPARATOR METRO_STEEL ;
COLORLEFT CLR_WHITE ;
FONT oFont4
MENUITEM "Save Prompt" ACTION cText := oDock2:SetCaption()
MENUITEM "Change Prompt" ACTION oDock2:SetCaption( "New Caption" + CRLF + "Second Line" )
MENUITEM "Restore Prompt" ACTION oDock2:SetCaption( cText )
SEPARATOR
MENUITEM "Change Colors Panel Main" ACTION oDock2:ChangeColorsP( { || CLR_RED }, { || CLR_WHITE } )
MENUITEM "Change Colors Panel Controls" ACTION oDock2:ChangeColorsH( { || CLR_WHITE }, { || CLR_RED } )
SEPARATOR
MENUITEM "Exit" ACTION o:oWnd:oWnd:End()
ENDMENU
ACTIVATE MENU oMnu AT nRow, nCol OF o:oWnd
Return oMnu
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function Test3( oP, nT, nL, nH, nW )
local oWnd, oImage, oFontSay
local oNameUser, oPassword
local oBtn1, oBtn2
local oFontI, oFontBtn
local cNameUser := space( 40 )
local cPassword := SPACE( 40 )
DEFINE FONT oFontI NAME "CALIBRI" SIZE 0,-15
DEFINE FONT oFontBtn NAME "VERDANA" SIZE 0,-17 BOLD
DEFINE FONT oFontSay NAME "VERDANA" SIZE 0,-25 BOLD //ITALIC
DEFINE DIALOG oWnd STYLE nOr( 0, WS_CHILD ) COLOR CLR_BLACK, nRGB( 253, 254, 254 ) ;
FROM nT, nL TO nH, nW PIXEL TRUEPIXEL OF oP
//DEFINE WINDOW oWnd STYLE nOr( WS_POPUP, WS_BORDER ) COLOR CLR_BLACK, nRGB( 253, 254, 254 )
// oWnd:nHeight := 320
// oWnd:nWidth := 400
//oWnd := oP
@ 15, 0 SAY "Cristóbal Navarro ( ® ) " PIXEL SIZE 400,30 OF oWnd ;
FONT oFontSay CENTER TRANSPARENT
@ 45, 0 SAY Upper( "FiveTech: ") + "Enter your Credentials" PIXEL ;
SIZE 400,30 OF oWnd FONT oFontI CENTER TRANSPARENT
@ 110, 50 GET oNameUser VAR cNameUser OF oWnd;
COLOR Rgb( 128, 128, 128 ), CLR_WHITE PICTURE "@!" ;
CUEBANNER "User" PIXEL BOTTOMBORDER ;
FONT oFontBtn ;
INFIELD INFONT oFontI INCLRTXT CLR_GRAY INCLRBORDER Rgb( 204, 204, 204 ) ;
INCLRLINE CLR_RED DYNAMIC //GROUP
@ 110, 50 GET oPassword VAR cPassword OF oWnd;
COLOR Rgb( 128, 128, 128 ), CLR_WHITE;
CUEBANNER "Enter Password" PASSWORD PIXEL BOTTOMBORDER ;
FONT oFontBtn PICTURE "@40" ;
INFIELD INFONT oFontI INALIGN 0
@ 260, 40 FLATBTN oBtn1 PROMPT "Access" OF oWnd SIZE 140, 40 ;
FONT oFontBtn;
COLOR CLR_WHITE, METRO_STEEL ;
ACTION ( oWnd:End() )
@ 260,210 FLATBTN oBtn2 PROMPT "Exit" OF oWnd SIZE 140, 40 ;
FONT oFontBtn;
COLOR CLR_WHITE, METRO_STEEL ;
ACTION ( oWnd:End() )
ACTIVATE DIALOG oWnd ON INIT ( oNameUser:SetFocus() ) NOWAIT
//ACTIVATE WINDOW oWnd CENTER ON INIT ( oNameUser:SetFocus() )
oFontI:End()
oFontBtn:End()
oFontSay:End()
RETURN oWnd
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function MyRibbonSetup( oCtrl, oP )
local oGr1
oCtrl:aPrompts[ 1 ] := "NEW"
ADD GROUP oGr1 RIBBON oCtrl TO OPTION 1 PROMPT "New" WIDTH Int( oP:nWidth / 3 ) ;
GRADIANT { { 1, Rgb( 192, 192, 192 ), Rgb( 192, 192, 192 ) } }
oCtrl:AddTab( "OTHER" )
//oCtrl:SetStyles( .F., .T. )
Return oP
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function MyButtonBarSetup( oCtrl, oP )
local oBtt1
local oBtt2
DEFINE BUTTON oBtt1 PROMPT "Exit" OF oCtrl ACTION MsgInfo( "ButtonBar" ) ;
TOOLTIP "TDockPnel Power" GROUP LEFT FILE "..\bitmaps\16x16\close.bmp" FLAT
oBtt1:nClrText := CLR_BLUE
oBtt1:nWidth := 48 * 2
DEFINE BUTTON oBtt2 PROMPT "Button" OF oCtrl ACTION MsgInfo( "Button" ) ;
TOOLTIP "TDockPnel Power" GROUP LEFT FILE "..\bitmaps\16x16\folder.bmp" FLAT
oBtt2:nClrText := CLR_BLUE
oBtt2:nWidth := 48 * 2
Return oP
//----------------------------------------------------------------------------//