FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Creating a small Dashboard with scrollpanel
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Creating a small Dashboard with scrollpanel
Posted: Fri Feb 10, 2023 10:09 AM
I wish create a small dashboard on a Window
Code (fw): Select all Collapse
 
#include "fivewin.ch"
#include "constant.ch"
#include "ttitle.ch"

Function test()
Local oDlg,oPanel,oBar
Local aItems



aItems:={;
{'C:\Work\fwh\bitmaps\pngs\2.png',"text one",.t.},;
{'C:\Work\fwh\bitmaps\pngs\2.png',"text two",.t.},;
{'C:\Work\fwh\bitmaps\pngs\2.png','text tree',.t.},;
{'C:\Work\fwh\bitmaps\pngs\2.png','text four',.t.}}

DEFINE WINDOW oWndMain TITLE "Test silvio"

  DEFINE BUTTONBAR oBar OF oWndMain 2015 SIZE 70, 60

   oPanel := CreaPanel( oWndMain ,aItems);oPanel:checkresize()

   DEFINE MSGBAR PROMPT "Test silvio" ;
                       OF oWndMain 2015 KEYBOARD DATE

   ACTIVATE WINDOW oWndMain MAXIMIZED


Return  NIL
//----------------------------------------------------------------------//
Function CreaPanel(oWnd,aItems)
Local oPanel
Local aBtn:= array(len(aItems))
Local nRow:=1
Local nCol :=1
Local nNumero:= 1
Local n
Local cCursor:= TCursor():New(,'HAND')

oPanel:= TScrollPanel():New(65,1,900,800,oWnd, .t.)

For n= 1 to Len(aItems)

   aBtn[n]:= PanelBox(oPanel,nRow,nCol,oPanel:nWidth-20,120,n )

   DemoText(aBtn[n],aItems[n][1]) //some text



     nRow+= 120+5



Next n

 oPanel:SetRange()
   Return oPanel
//----------------------------------------------------------------------//
 function PanelBox(oDlg,nTop,nLeft,nRight,nBottom,n)
  local oPanel,oBrush
  Local aGradBox := { nRgb( 255,255,255), nRgb(254,254,254)}
  DEFINE BRUSH oBrush GRADIENT aGradBox
     oPanel:=Tpanel():New( nTop, nLeft, nBottom, nright, oDlg)
     oPanel:SetBrush( oBrush )
     oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
     return oPanel
//-------------------------------------------------------------------------//

Function DemoText(oBox,cimage)
   local oTitle,oBoldTitle,oFontTitle

      DEFINE FONT oBoldTitle NAME 'Tahoma' SIZE 0, -16  BOLD
      DEFINE FONT oFontTitle NAME 'Tahoma' SIZE 0, -18

   @ 10, 8 TITLE oTitle OF oBox SIZE oBox:nWidth-12,65 NOBORDER //PIXEL
        oTitle:aGrdBack := { { 1, nRgb( 255,255,255), nRgb(254,254,254) } }
        oTitle:nShadow  := 0
     @ 14, 75 TITLETEXT OF oTitle TEXT "Text1" FONT oBoldTitle
     @ 2, 10 TITLEIMG OF oTitle RESNAME cimage SIZE 48, 48 //REFLEX TRANSPARENT
     @ 34, 75 TITLETEXT OF oTitle TEXT "text2-text2-text2" FONT oFontTitle

     RELEASE oBoldTitle,oFontTitle
     return nil




I not understood why it not whow the other elements on scrollPanel
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Creating a small Dashboard with scrollpanel
Posted: Fri Feb 10, 2023 01:07 PM
Change this line
Code (fw): Select all Collapse
aBtn[n]:= PanelBox(oPanel,nRow,nCol,oPanel:nWidth-20,120,n )

with
Code (fw): Select all Collapse
aBtn[n]:= PanelBox(oPanel,nRow,nCol,oPanel:nWidth-20,120 + nRow,n )
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

Continue the discussion