- Code: Select all Expand view
#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