- Code: Select all Expand view RUN
static function CreateTestDbf()
local aCols := { { "PRCODE", 'C', 4, 0 }, { "PRDESC", 'C', 40, 0 }, ;
{ "PRIMAGE", 'C', 60, 0 } }
if .t. // ! File( "PROMO.DBF" )
DBCREATE( "PROMO", aCols )
USE PROMO EXCLUSIVE
APPEND BLANK
FIELD->PRCODE :="0001"
FIELD->PRDESC :="PROMOZIONE DI NATALE "
FIELD->PRIMAGE:=".\bitmaps\files-exel.ico"
APPEND BLANK
FIELD->PRCODE :="0002"
FIELD->PRDESC :="PROMOZIONE DI PASQUA "
FIELD->PRIMAGE:=".\bitmaps\files-word.ico"
USE
endif
return nil
If I try to load this dbf into a listview control there is a strange error as you can see on this picture
the listview load my record but add 3 object (&one,&two,&tree) WHY ?
this is the test
- Code: Select all Expand view RUN
#INCLUDE "Fivewin.ch"
#INCLUDE "Ribbon.ch"
#include "constant.ch"
#INCLUDE "XBROWSE.ch"
#define TRUE .t.
#define FALSE .f.
Function Promo_ListVw()
Local oDlg,oBtn1,oBtn2
Local bClrGrad := { | lPressed | If( ! lPressed,;
{ { 1, nRGB( 253, 254, 255 ), nRGB( 179, 217, 255 ) } },;
{ { 1, nRGB( 179, 217, 255 ), nRGB( 253, 254, 255 ) } } ) }
Local nBottom := 23
Local nRight := 99
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local lGridAll := TRUE
Local lGridRow := FALSE
Local oBtnConferma,oBtnAnnulla
Local oGridPromo,oBtnDown,oListView, oImageList
Local aPromozioni := {}
Local aPromoImages:= {}
CreateTestDbf()
DEFINE DIALOG oDlg SIZE nWidth, nHeight;
TITLE "Selezionare una promozione";
STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION, 4 )
USE PROMO ALIAS PR
DO WHILE ! PR->(EoF())
AAdd( aPromozioni,( TRIM(PR->PRDESC)))
AAdd( aPromoImages,( allTRIM(PR->PRIMAGE)))
PR->(DbSkip())
ENDDO
CLOSE PR
oImageList = TImageList():New( 48, 48 )
@ 150, 50 BTNBMP oBtnConferma PROMPT "&Conferma" OF oDlg FILENAME ".\bitmaps\DLG_OK.bmp" NOBORDER SIZE 50, 20 PIXEL DEFAULT ACTION ( oDlg:end( IDOK ) )
@ 150, 102 BTNBMP oBtnAnnulla PROMPT "&Annulla" OF oDlg FILENAME ".\bitmaps\DLG_NO.bmp" NOBORDER SIZE 50, 20 PIXEL CANCEL ACTION ( oDlg:end( IDCANCEL ) )
oBtnConferma:bClrGrad = bClrGrad
oBtnAnnulla:bClrGrad = bClrGrad
oBtnConferma:nLayout :=2
oBtnAnnulla:nLayout :=2
ACTIVATE DIALOG oDlg ;
ON INIT CreaListview(oImageList,aPromozioni,aPromoImages, oDlg)
IF oDlg:nresult == IDOK
ENDIF
RETURN NIL
FUNCTION CreaListview(oImageList,aPromozioni,aPromoImages, oDlg)
Local oLvw,oBtnUp,oBtnDown
@ 145, 10 LISTVIEW oLvw SIZE odlg:nwidth-30,130 PIXEL ;
ACTION MsgInfo( nOption )
for i=1 to len(aPromozioni)
oLvw:InsertItem(i-1 , aPromozioni[i] )
* oImageList:ReadBitmap( aPromoImages[i], 40,1)
oImageList:AddIcon(aPromoImages[i])
Next i
oLvw:SetImageList( oImageList )
@ 300,5 RBBTN oBtnUp BITMAP ".\bitmaps\Up.BMP" SIZE 40,40 OF oDlg PIXEL ;
BORDER CENTER ROUND ROUNDSIZE 2;
ACTION oLvw:KeyDown(VK_UP, 0)
@ 300,55 RBBTN oBtnDown BITMAP ".\bitmaps\Down.BMP" SIZE 40,40 OF oDlg PIXEL;
BORDER CENTER ROUND ROUNDSIZE 2;
ACTION oLvw:KeyDown(VK_DOWN, 0)
RETU NIL
static function CreateTestDbf()
local aCols := { { "PRCODE", 'C', 4, 0 }, { "PRDESC", 'C', 40, 0 }, ;
{ "PRIMAGE", 'C', 60, 0 } }
if .t. // ! File( "PROMO.DBF" )
DBCREATE( "PROMO", aCols )
USE PROMO EXCLUSIVE
APPEND BLANK
FIELD->PRCODE :="0001"
FIELD->PRDESC :="PROMOZIONE DI NATALE "
FIELD->PRIMAGE:=".\bitmaps\files-exel.ico"
APPEND BLANK
FIELD->PRCODE :="0002"
FIELD->PRDESC :="PROMOZIONE DI PASQUA "
FIELD->PRIMAGE:=".\bitmaps\files-word.ico"
USE
endif
return nil