Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
PUBLIC ofrm
DO genpict
ofrm=CREATEOBJECT("MyForm")
ofrm.show()
DEFINE CLASS MyForm as Form
ocol=Null
ADD OBJECT lst as Listbox WITH width=300,multiselect=1
PROCEDURE init
This.ocol=CREATEOBJECT("collection")
FOR lni=1 TO 5
This.ocol.Add(CREATEOBJECT("mycheckbox"))
This.ocol.item(lni).Caption="Item "+TRANSFORM(lni)
This.ocol.item(lni).nListItem=lni
This.ocol.item(lni).oList=This.lst
This.ocol.item(lni).value2="Col 2 item "+TRANSFORM(lni)
This.ocol.item(lni).value3="Third col item "+TRANSFORM(lni)
NEXT
This.lst.RowSourceType=10
This.lst.ColumnCount=3
This.lst.ColumnWidths="100,75,100"
This.lst.RowSource="ThisForm.ocol,caption,value2,value3"
FOR lni=1 TO 5
This.lst.Picture(lni)="uncheck.bmp"
NEXT
ENDPROC
PROCEDURE lst.click
FOR lni=1 TO This.ListCount
ThisForm.ocol.item(lni).Value=This.selected(lni)
NEXT
ENDPROC
PROCEDURE lst.keypress
LPARAMETERS nkey,nshift
IF INLIST(nkey,13,32)
NODEFAULT
DODEFAULT(nkey,nshift)
FOR lni=1 TO This.ListCount
ThisForm.ocol.item(lni).Value=This.selected(lni)
NEXT
ENDIF
ENDPROC
PROCEDURE destroy
This.ocol=Null
ENDPROC
ENDDEFINE
DEFINE CLASS MyCheckbox as checkbox
Picture="uncheck.bmp"
DownPicture="check.bmp"
style=1
value=.F.
nListItem=0
oList=Null
value2=""
value3=""
PROCEDURE interactivechange
IF VARTYPE(This.oList)="O" AND !ISNULL(This.oList) AND This.nListItem>0
This.oList.Picture(This.nListItem)=IIF(This.Value,This.DownPicture,This.Picture)
ENDIF
ENDPROC
PROCEDURE programmaticchange
IF VARTYPE(This.oList)="O" AND !ISNULL(This.oList) AND This.nListItem>0
This.oList.Picture(This.nListItem)=IIF(This.Value,This.DownPicture,This.Picture)
ENDIF
ENDPROC
ENDDEFINE
PROCEDURE GenPict
LOCAL lcFile,oImage,oGr,oFillColor,oLineColor,oPen,nHeight,nBkColor,nForeColor
nBkColor=RGB(255,255,255)
nForeColor=0
nHeight=14
lcFile="uncheck.bmp"
oImage = Newobject('Gpbitmap',Home(1)+'ffc/_gdiplus.vcx')
oImage.Create(m.nHeight,m.nHeight)
oGr = Newobject('GpGraphics',Home(1)+'ffc/_gdiplus.vcx')
oGr.CreateFromImage(oImage)
oFillColor = Newobject( 'GpColor',Home(1)+'ffc/_gdiplus.vcx','', nBkColor%256,FLOOR(nBkColor%(256*256)/(256)),FLOOR(nBkColor/(256*256)) )
oFillColor.set(nBkColor%256,FLOOR(nBkColor%(256*256)/(256)),FLOOR(nBkColor/(256*256)))
oGr.Clear(oFillColor)
oLineColor = Newobject( 'GpColor',Home(1)+'ffc/_gdiplus.vcx','', nForeColor,FLOOR(nForeColor%(256*256)/(256)),FLOOR(nForeColor/(256*256)) )
oPen = Newobject('GpPen', Home(1)+'ffc/_gdiplus.vcx' )
oPen.Create( m.oLineColor, 1 )
oGr.DrawRectangle(oPen, 2,2, m.nHeight-5,m.nHeight-5)
oImage.Savetofile( lcFile, "image/bmp")
lcFile="check.bmp"
oGr.DrawLine(oPen, 2,2, m.nHeight-4,m.nHeight-4)
oGr.DrawLine(oPen, m.nHeight-3,2,2,m.nHeight-3)
oImage.Savetofile( lcFile, "image/bmp")
ENDPROC
Saif said:Thanks Mr.Mike for the idea, but I want to display the records of the delivered/undelivered items of Delivery Orders in list and wanted to show the check box (checked) which is delivered and (Unchecked) which is not delivered.
alisaif said:I want to display the records of the delivered/undelivered items of Delivery Orders in list and wanted to show the check box (checked) which is delivered and (Unchecked) which is not delivered
Vilhelm-Ion Praisach said:I have no experience with Listview so I am very interested.
WITH THIS
.cAlias = "Orders" && alias of table or cursor to bind to the control
.cData = "Order_ID" && a character field in the cursor that you want to display
.cCheckField = "Delivered" && a logical field in the cursor that you want to
&& map to the checkbox
.lUpdateCheckbox = .T. && says that, when the user toggles the checkbox,
&& this will also toggle the logical field
.lCheckBoxes = .T. && a master switch to enable / disable the checkbox
.PopulateList && go ahead and display the data
ENDWITH
Olaf said:I'd go for a dynamicbackcolor in a grid, though.