Problem with Listview
Posted: Sun Aug 19, 2012 10:05 pm
I cannot show a listview records
I have this database
and I wish show the bitmpas into a listview
but I can show only one record
why ?
this is my code
I tried also with icons
I have this database
and I wish show the bitmpas into a listview
but I can show only one record
why ?
this is my code
Code: Select all
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( 32, 32 )
@ 63,2 GROUP TO 145,150 OF oDlg LABEL "Elenco promozioni" PIXEL TRASPARENT
ACTIVATE DIALOG oDlg ;
ON INIT CreaListview(oImageList,aPromozioni,aPromoImages, oDlg)
FUNCTION CreaListview(oImageList,aPromozioni,aPromoImages, oDlg)
Local oLvw,oBtnUp,oBtnDown
@ 145, 10 LISTVIEW oLvw SIZE 280,130 PIXEL ;
ACTION MsgInfo( nOption )
for i=1 to len(aPromozioni)
oLvw:InsertItem(i-1 , aPromozioni[i] )
oImageList:ReadBitmap( aPromoImages[i], 40,1)
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
function InsertItems(oListView,aPromozioni)
Local n
for n=1 to len(aPromozioni)
oListView:InsertItem( n, apromozioni[n] )
next n
retu nil
I tried also with icons