Fwh19.05 - New Class TDockPnel

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Tue Oct 06, 2020 5:47 pm

Use TScrollPanel in your control windows

Code: Select all  Expand view

#include "Fivewin.ch"

Static aRes
Function Main()

   local oWnd
   local nRow := 2
   local nCol := 2
   local nWAlto  := 760
   local nWAncho := 1360
   local oPanel

   aRes := { GetSysMetrics(0), GetSysMetrics(1) }
   DEFINE WINDOW oWnd FROM nRow, nCol TO nWAlto + nRow, nWAncho + nCol ;
             PIXEL TITLE "Movimentos do Dia "+Dtoc( Date() ) ; //MENU oMenu ;
             COLOR CLR_WHITE, Rgb( 182, 182, 182 ) // VSCROLL //NOSYSMENU //NOZOOM //NOMINIMIZE
         
//         CreateDocks(oWnd)
        oPanel := TScrollPanel() : New( 1, 1, oWnd:nHeight, oWnd:nWidth, oWnd, .f. )
        oPanel:SetColor( , CLR_WHITE )

   
   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT ( CreateDocks( oPanel ), oPanel:SetRange() )


Return nil

STATIC FUNCTION  CreateDocks(oWnd)
LOCAL aPos:={},oFnt,oDock[4]

    DEFINE FONT oFnt NAME "CALIBRI" SIZE 0,-16

    Aadd(aPos,{ 014, 005, 370, 278 } )
    Aadd(aPos,{ 014, 300, 360, aRes[1] - 10 } )
    Aadd(aPos,{ 390, 300, aRes[2]/3 + 390, aRes[1] - 10 + 300 } )

    oDock[1]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[1]
        :SetCoors( aPos[1,1], aPos[1,2], aPos[1,3], aPos[1,4] )
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Calendário" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 1 ) } )
        :Activate()
    END
   
    oDock[2]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[2]
        :SetCoors( aPos[2,1], aPos[2,2], Int( aRes[ 1 ] / 6 ), aPos[2,4] - if( oWnd:WinStyle( WS_VSCROLL ), 20, 0 ) )
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Autorizações" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 2 ) } )
        :Activate()
    END  

    oDock[3]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[3]
      :SetCoors( { | o | XEval( o:oWnd:aControls[ 2 ]:nBottom + 10, o ) }, ;
                 { | o | XEval( o:oWnd:aControls[ 2 ]:nLeft, o ) }, ;// { | o | Int( 2 * aRes[ 1 ] / 6 ) + 20 }, ;
                 { | o | XEval( o:oWnd:aControls[ 2 ]:nBottom + 10 + Int( aRes[ 2 ] / 2 ) , o ) }, ;
                 { | o | XEval( o:oWnd:aControls[ 2 ]:nRight, o ) } )
      //  :SetCoors( aPos[3,1], aPos[3,2], aPos[3,3], aPos[3,4] )
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Faturamento" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 3 ) } )
        :Activate()
    END  

   oDock[4]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[4]
         :SetCoors( { | o | XEval( o:oWnd:aControls[ 3 ]:nBottom + 10, o ) }, ;        
                    { | o | XEval( o:oWnd:aControls[ 3 ]:nLeft, o ) }, ; //  { | o | Int( 3 * aRes[ 1 ] / 6 ) + 30 }, ;
                    { | o | XEval( o:oWnd:aControls[ 3 ]:nBottom + 10 + Int( aRes[ 2 ] / 2 ) , o ) }, ;
                    { | o | XEval( o:oWnd:aControls[ 3 ]:nRight, o ) } )                  
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Baixas" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 4 ) } )
        :Activate()
    END
    oFnt:End()

RETURN nil

STATIC FUNCTION DefDialog( oP, nT, nL, nH, nW, nD )
   LOCAL oCol,k,oLbx[3]
   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 }   ;
                  }

RETURN nil  
 


Please wait, there is another additional possibility which is the one that I usually use.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Tue Oct 06, 2020 5:55 pm

vilian wrote:Did you reduce the height of tDockPnel 2,3 and 4 ? In can't reduce the height of Tdockpnel. I must scroll the windows to see those tdockpnel that doesn't fit in the window.
What is the screeen's resolution of your windows ? Please, decrease it and try again.


Vilian, I know this, not worry
They were an example of how to fit several dockpnels to the container window. I know it has nothing to do with the problem you were asking me
My sample is run in 1365 x 768
Wait
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Wed Oct 07, 2020 10:02 am

Look my sample

Code: Select all  Expand view

#include "Fivewin.ch"

Static aRes
Static oDock0

Function Main()

   local oWnd
   local nRow := 2
   local nCol := 2
   local nWAlto  := 760
   local nWAncho := 1360
   local oPanel

   aRes := { GetSysMetrics(0), GetSysMetrics(1) }
   DEFINE WINDOW oWnd FROM nRow, nCol TO nWAlto + nRow, nWAncho + nCol ;
             PIXEL TITLE "Movimentos do Dia "+Dtoc( Date() ) ;
             COLOR CLR_WHITE, Rgb( 182, 182, 182 ) STYLE WS_POPUP
         
   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT ( CreaDocks0( oWnd ) )


Return nil

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

Function CreaDocks0( oWnd )

   oDock0  := TDockPnel():New( oWnd )
   WITH OBJECT oDock0

      :SetHeightCaption( 40 )
      :SetBorderSize( 1 )
      :SetCoors( { | o | 2 }, ;
                 { | o | 2 }, ;
                 { | o | o:oWnd:nBottom - o:oWnd:nTop  - 2 }, ;
                 { | o | o:oWnd:nRight  - o:oWnd:nLeft - 2 } )
      :SetCaption( { | o | "Test TDockPanel Class  - " + FWVERSION + " -" } )
      //:SetPosTitle( .T. )  // Title at bottom
      :SetStyle( 30 )
      :SetModeHorz( 2 )  // TScrollPanel
      :SetImgsFiles( { { 57678, { | o | MyPopupMnu( o ) }, } } )
      :SetCtrlsPnel( { | o, nT, nL, nH, nW | CreateDocks( o ) } )

      :Activate()
   END

Return oDock0

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

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

      MENUITEM "Info" ACTION MsgInfo( o:ClassName() )
      MENUITEM "Exit" ACTION o:oWnd:oWnd:End()

   ENDMENU
   ACTIVATE MENU oMnu AT nRow, nCol OF o:oWnd

Return oMnu

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

STATIC FUNCTION  CreateDocks(oWnd)
    LOCAL aPos:={},oFnt,oDock[4]

    DEFINE FONT oFnt NAME "CALIBRI" SIZE 0,-16

    Aadd(aPos,{ 014, 005, 370, 278 } )
    Aadd(aPos,{ 014, 300, 360, aRes[1] - 10 } )
    Aadd(aPos,{ 390, 300, aRes[2]/3 + 390, aRes[1] - 10 + 300 } )

    oDock[1]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[1]
        :SetCoors( aPos[1,1], aPos[1,2], aPos[1,3], aPos[1,4] )
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Calendário" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 1 ) } )
        :Activate()
    END
   
    oDock[2]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[2]
        :SetCoors( aPos[2,1], aPos[2,2], Int( aRes[ 1 ] / 6 ), aPos[2,4] - if( oWnd:WinStyle( WS_VSCROLL ), 20, 0 ) )
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Autorizações" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 2 ) } )
        :Activate()
    END  

    oDock[3]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[3]
      :SetCoors( { | o | XEval( o:oWnd:aControls[ 2 ]:nBottom + 10, o ) }, ;
                 { | o | XEval( o:oWnd:aControls[ 2 ]:nLeft, o ) }, ;// { | o | Int( 2 * aRes[ 1 ] / 6 ) + 20 }, ;
                 { | o | XEval( o:oWnd:aControls[ 2 ]:nBottom + 10 + Int( aRes[ 2 ] / 2 ) , o ) }, ;
                 { | o | XEval( o:oWnd:aControls[ 2 ]:nRight, o ) } )
      //  :SetCoors( aPos[3,1], aPos[3,2], aPos[3,3], aPos[3,4] )
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Faturamento" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 3 ) } )
        :Activate()
    END  

   oDock[4]  := TDockPnel():New( oWnd )
    WITH OBJECT oDock[4]
         :SetCoors( { | o | XEval( o:oWnd:aControls[ 3 ]:nBottom + 10, o ) }, ;        
                    { | o | XEval( o:oWnd:aControls[ 3 ]:nLeft, o ) }, ; //  { | o | Int( 3 * aRes[ 1 ] / 6 ) + 30 }, ;
                    { | o | XEval( o:oWnd:aControls[ 3 ]:nBottom + 10 + Int( aRes[ 2 ] / 2 ) , o ) }, ;
                    { | o | XEval( o:oWnd:aControls[ 3 ]:nRight, o ) } )                  
        :SetHeightCaption( 40 )
        :SetBorderSize( 4 )
        :SetCaption( "Baixas" )
        :SetColors( CLR_WHITE, METRO_OLIVE, , )
        :SetFont( oFnt )
        :cAlignText  := "CC"
        :SetCtrlsPnel( { | o, nT, nL, nH, nW | DefDialog(  o, nT, nL, nH, nW, 4 ) } )
        :Activate()
    END

    oFnt:End()

RETURN nil


STATIC FUNCTION DefDialog( oP, nT, nL, nH, nW, nD )
   LOCAL oCol,k,oLbx[3]
   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 }   ;
                  }

RETURN nil  
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Wed Oct 07, 2020 10:39 am

Cristobal,
When I try your sample there is happening this error: Error BASE/1004 Message not found: TDOCKPNEL:SETMODEHORZ
I'm Using FWH May/2020.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Wed Oct 07, 2020 11:37 am

vilian wrote:Cristobal,
When I try your sample there is happening this error: Error BASE/1004 Message not found: TDOCKPNEL:SETMODEHORZ
I'm Using FWH May/2020.


Ok, look your mail, and tell me what you think of this version.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Wed Oct 07, 2020 11:50 am

Now it's almost perfect :)
I need only one more thing. How could I add a button/option to minimize the oDock0 ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Wed Oct 07, 2020 3:14 pm

In function MenuPopup add

//
MENUITEM "Minimize" ACTION o:oWnd:oWnd:Minimize() // oWindow:Minimize // So oWindow is object window principal and static variable
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Wed Oct 07, 2020 4:57 pm

is possible add Images on the right side, like the bellow?

Image
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Wed Oct 07, 2020 11:06 pm

Puedes poner uno o varios botones a la izquierda o a la derecha pero no en ambos ( de momento )
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Wed Oct 07, 2020 11:59 pm

How could I do this ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Thu Oct 08, 2020 12:13 am

vilian wrote:How could I do this ?


Code: Select all  Expand view

      //:SetImgsFiles( { { "..\bitmaps\16x16\min.bmp", { | o | MyPopupMnu( o ) }, }, { "..\bitmaps\16x16\max.bmp", { | o | MsgInfo( "Otro" ) }, } } )
      :SetImgsFiles( { { 57678, { | o | MyPopupMnu( o ) }, }, { 57656, { | o | MsgInfo( "Otro" ) }, } } )
      // :lLeftImgs  := .F.       // Align to right
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Thu Oct 08, 2020 10:47 am

Thank you Cristobal ;)

Where could I know the list of these image codes ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Thu Oct 08, 2020 12:32 pm

vilian wrote:Thank you Cristobal ;)

Where could I know the list of these image codes ?


Look UISYMBOL.PRG in SAMPLES folder
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Thu Oct 08, 2020 12:55 pm

Thank You Very Much!

TDockPnel is amazing and your support too.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby goosfancito » Thu Nov 04, 2021 11:48 pm

hola
Como hago para que los paneles no se puedan mover? si adaptar a la ventana pero no moverse por toda la ventana
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests