#include "FiveWin.ch"
#include "constant.ch"
REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
Function test()
Local oDlgTest,oGrid
Local aPrompts:={"faldone 1"}
Local nBottom := 29.2
Local nRight := 58
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
RddSetDefault( "DBFCDX" )
SetHandleCount( 100 )
DEFINE DIALOG oDlgTest ;
SIZE nWidth, nHeight PIXEL ; //TRUEPIXEL
TITLE "test" TRANSPARENT
oGrid := TFolderex():New( , , , , oDlgTest, , ,, aPrompts)
oGrid:nTop := 00
oGrid:nLeft := 00
oGrid:nBottom := 200
oGrid:nRight := 300
ACTIVATE DIALOG oDlgTest ;
ON INIT Show_raccoglitori(oGrid)
return nil
//----------------------------------------------------------------//
function Show_raccoglitori(oGrid)
local oFontsmall:= TFont():New( "Tahoma", 0, -9,,.F. )
Local cCursor:= TCursor():New(,'HAND')
local nRow := 10
local ncol := 10
//per i faldoni
Local nsizeW:= 84
Local nsizeh:= 240
local aBmp:= {".\bitmaps\tipo1.png" ,;
".\bitmaps\tipo2.png" ,;
".\bitmaps\tipo3.png" ,;
".\bitmaps\tipo4.png" ,;
".\bitmaps\tipo5.png" }
local n:= 1
local oBtn,oBasket2
Create_Faldoni()
USE FALDONI ALIAS RA
nCount:=RA->(OrdKeyCount())
nNumeroPerLinea:= 15+1
oBtn:= array(nCount)
k:= 1
RA->(dbgotop())
Do While ! Ra->(eof())
nCode:= Ra->racodice
nCaption:=Ra->Radesc
@ nrow,ncol BTNBMP oBtn[n] of oGrid:adialogs[1] ;
SIZE nsizeW,nsizeh PIXEL TRANSPARENT ;
Prompt str2lines(alltrim(Ra->Radesc)," ") ;
NOBORDER ;
Filename aBmp[RA->RACOLORE] ; // ACTION bEjecutaBoton(nrow,ncol,n,alltrim(Ra->Radesc),obtn);
CENTER
* oBtn[n]:lTransparent:=.T.
oBtn[n]:oCursor:= cCursor
oBtn[n]:lBorder := .F.
oBtn[n]:bAction := bEjecutaBoton(nrow,ncol,n,oBtn[n], nCaption)
ncol:= ncol+nsizeW+5
n:=n+1
k++
IF k = nNumeroPerLinea
nRow += nsizeh+10
ncol := 10
k:= 1
Endif
RA->(dbSkip())
Enddo
return nil
//----------------------------------------------------------------//
function bEjecutaBoton(nrow,ncol,n,oControl, nCaption)
return { |n| Menu_popup(nrow,ncol,n,oControl, nCaption) }
//----------------------------------------------------------------//
Function Menu_popup(nrow,ncol,n,oControl, nCaption)
Local oMenuPop
MENU oMenuPop POPUP
MENUITEM "Apri "+ nCaption
MENUITEM "WWW"
ENDMENU
ACTIVATE POPUP oMenuPop OF oControl AT nrow,ncol
return nil
//----------------------------------------------------------------//
Function Create_Faldoni()
Local cDir:=""
DbCreate(cDir+'RA', {{ "RACODICE" , "C", 4, 0 },;
{ "RADESC " , "C", 25, 0 },;
{ "RACOLORE" , "N", 1, 0 } } , 'DBFCDX')
close all
use &(cDir+'RA') new
select RA
if FILE(cDir+'FALDONI.DBF')
delete file &(cdir+'FALDONI.cdx')
append from &(cdir+'FALDONI')
dbcommitall()
close all
delete file &(cdir+'FALDONI.dbf')
endif
close all
rename &(cdir+'RA.dbf') to &(cdir+'FALDONI.dbf')
return nil
//----------------------------------------------------------------//
FUNCTION Str2Lines( string, parser )
Local cStrLines:= CRLF+"", nLenPar:= Len( parser )
Local commapos := 0
If parser == NIL .OR. parser == "e"
parser := " "
EndIf
Do While Len( string ) > 0
commapos := at( parser, string )
IF commapos > 0
cStrLines+= Left( string, commapos - 1 ) + CRLF + ""
string := SubStr( string, commapos + Len( parser ) )
ELSE
cStrLines+= string
string := ''
ENDIF
ENDDO
RETURN( cStrLines )
//----------------------------------------------------------------//