#include "fivewin.ch"
#include "constant.ch"
Function Test()
Local oDlg,oFolder
Local oPanelScroll
Local oCbxListino
Local aListini:= { {"01","Alta Stagione" },;
{"02","Media Stagione" },;
{"03","Bassa Stagione" }}
Local nListino:=3
Local oFont,oFontBold,oLarge
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE FONT oFontBold NAME "TAHOMA" SIZE 0,-14 BOLD
DEFINE FONT oLarge NAME "VERDANA" SIZE 0,-24 BOLD
DEFINE DIALOG oDlg TITLE "test " SIZE 1130,650 ;
PIXEL TRUEPIXEL RESIZABLE COLOR CLR_HGRAY ,CLR_WHITE FONT oFont
@ 1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL ;
PROMPT "Prenotazioni","Pagamenti"
@ 6,5 COMBOBOX oCbxListino VAR nListino Items ArrTranspose( aListini )[2 ];
SIZE 80,90 PIXEL of oFolder:aDialogs[1] ;
ON CHANGE (MakeButtons(oPanelScroll,nListino,oFontBold),;
oPanelScroll:SetRange(),;
oPanelScroll:CheckResize() )
oDlg:bResized := <||
local oRect := oDlg:GetCliRect()
oFolder:nWidth := oRect:nRight-2
oFolder:nHeight := oRect:nBottom-60
* oCbxListino:nTop := oFolder:nHeight:nTop-30
oCbxListino:nLeft := oRect:nRight - 190
oPanelScroll := oRect:nBottom-350
return nil
>
ACTIVATE DIALOG oDlg CENTERED;
ON INIT ( oPanelScroll := CreatePanel( oFolder,oFontBold,nListino),;
oPanelScroll:CheckResize() ,;
EVAL( oDlg:bResized) )
Return nil
//-------------------------------------------------//
Function CreatePanel(oFolder,oFontBold,nListino)
local oPanel
oPanel := TScrollPanel():New( 135,010,250,550,oFolder:aDialogs[1], .t. )
oPanel:nRightMargin := 90
oPanel:nBottomMargin :=300 // 335
oPanel:WinStyle(WS_BORDER, .t.)
MakeButtons(oPanel,nListino,oFontBold)
oPanel:SetRange()
Return oPanel
//---------------------------------------------------//
Function MakeButtons(oPanel,nListino,oFontBold)
Local cDesc,nPrice
local nProductsforRow:= 5
local nSizeW := 195
local nSizeH := 55
local nSpaceH:= 5
local nSpaceW:= 5
local n,nProduct:=1
local nRow:= 10
local nCol:= 10
local oHand:= TCursor():New(,'HAND')
local ctooltip:= "fai click per aggiungere un servizio"
local oCtrl
local aProducts:= {}
local oBtn:=array(3)
If nListino =1
aProducts:= {{"Lettino",9},;
{"Sdraio",11},;
{"Regista",12} }
elseif nListino =2
aProducts:= {{"Lettino",90},;
{"Sdraio",110},;
{"Regista",120} }
elseif nListino =3
aProducts:= {{"Lettino",0},;
{"Sdraio",0},;
{"Regista",0} }
Endif
* for each oCtrl in oPanel:aControls
* oCtrl:End()
* next
For n=1 to Len (aProducts)
cDesc := aProducts[n][1]
nPrice := aProducts[n][2]
@ nRow,ncol BTNBMP oBtn[n] ;
FILENAME "" ;
SIZE nSizeW, nSizeH PIXEL;
FLAT RIGHT;
PROMPT "" + alltrim(cDesc) + CRLF +;
transform( nPrice,'@ €99,999.99') + " " ;
OF oPanel ;
TOOLTIP ctooltip ;
COLOR CLR_RED,Rgb( 225,239,219) //GDIP
oBtn[n]:oFontBold := oFontBold
oBtn[n]:ocursor:= oHand
oBtn[n]:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 1, RGB( 225, 225, 225 ), RGB( 225, 225, 225 ) } },;
{ { 1, RGB( 229,241,251 ), RGB( 229,241,251 ) } } ) }
ncol+=nSizeW+nSpaceW
IF nProduct= nProductsforRow // prodotti per linea
nRow+=nSizeH+nSpaceH
nCol:=10
nProduct:= 0
endif
nProduct+=1
cDesc:=""
nPrice:=""
Next
return nil
//---------------------------------------------------//