for 32 bit i use the listview.dll.
only a german documentation is avaiable, but it is simply to use.
Code: Select all
; Funktionen für Listview.dll
; als Prototype deklariert
#Library = 0
Global lview.l, value.l, text.s
lview = OpenLibrary(#Library, "Listview.dll")
Prototype pCreateListview(f.l, i.l, t.l, h.l, g.l, s.l)
Prototype pIColumn(h.l, t.l, b.l, f.l)
Prototype pSItem(h.l, b.l, a.l)
Prototype pShowListview(ha.l, x.l, y.l, b.l, h.l)
Prototype pInitMessages(h.l)
Prototype pASortListview(h.l, b.l, a.l)
Prototype pAddItemValues(lv.l, s.l, b.l, a.l)
Prototype pCheckIfMarked(lv.l)
Prototype pMarkIfChecked(lv.l)
Prototype pReadFileQuick(s.l, b.l, o.l, a.l)
Prototype pWriteFileQuick(s.l, b.l, o.l, a.l)
Prototype pSwapLines(b.l, a.l, f.l)
Prototype pCsvToListview(h.l, b.l, a.l, s.l)
Prototype pListviewToCsv(h.l, b.l, a.l, f.l)
Prototype pSetItemsFromMem(h.l, b.l, a.l, s.l)
Prototype pGetColumns(h.l)
Prototype pGetColumnName(lv.l, b.l, s.l)
Prototype pGetLines(h.l)
Prototype pGetSelected(bt.l, bl.l)
Prototype pGetSelectedDbClk(bt.l, bl.l)
Prototype pGetAllSelected(bt.l, bl.l)
Prototype pGetNeededMemory(h.l, f.l)
Prototype pGetTabOffsets(bt.l, bo.l)
Prototype pGetNullOffset(b.l)
Prototype pGetOwnControlParas(b.l, h.l, s.l, z.l)
Prototype pGetRealColumnIndex(lv.l, s.l)
Prototype pCreateImageList(f.l, b.l)
Prototype pDestroyImageList(i.l)
Prototype pSetImageList(h.l, i.l)
Prototype pSetIcon(h.l, z.l, n.l)
Prototype pSetIconMode(f.l)
Prototype pSetIconColumn(s.l)
Prototype pSetIconsFromMem(h.l, z.l, b.l, a.l)
Prototype pSetIconsWith(h.l, z.l, n.l, a.l)
Prototype pSetIndex(i.l)
Prototype pGetSelectedLine(h.l)
Prototype pGetColumnWidth(h.l, i.l)
Prototype pCryptMem(b.l, a.l, s.l, l.l)
Prototype pSetColumnsFromMem(h.l, b.l, o.l)
Prototype pSetColumnName(lv.l, b.l, s.l)
Prototype pCloseMessages(f.l)
Prototype pDbfToCsv(b.l, a.l, s.l, z.l, f.l)
Prototype pSelectLine(h.l, i.l, f.l)
Prototype pSetAllCheckboxStates(lv.l, b.l)
Prototype pDeleteDoubleItems(lv.l, s.l)
Prototype pEnableEdits(lv.l, fl.l)
Prototype pListviewToDbf(lv.l, ber.l, vb.l, fl.l)
Prototype pSetCheckboxState(lv.l, index.l, mode.l)
Prototype pGetCheckboxState(lv.l, index.l)
Prototype pGetAllCheckboxStates(H.l, B.l)
Prototype pGetChecked(p1.l, p2.l, p3.l)
Prototype pSearchText(lv.l, start.l, ende.l, spalte.l, sstr.l, flag.l, espalte.l)
Prototype pSelectColumnEdits(lv.l, b.l)
Prototype pExchangeSeparator(ber.l, anzb.l, ascz.l, ersatz.l, f.l)
Prototype pCopyLineTo(qlv.l, zlv.l, qindex.l, zindex.l)
Prototype pCopyColumnTo(qlv.l, zlv.l, qindex.l, zindex.l)
Prototype pSortManual(h.l, i.l, f.l)
Prototype pFilelistToCsv(n.l, b.l, s.l, z.l, f.l, i.l)
Prototype pSetItemText(h.l, t.l, s.l, i.l)
Prototype pGetItemText(h.l, b.l, s.l, i.l)
Prototype pGetItemTextsAsFloat(lv.l, s.l, b.l)
Prototype pGetItemTextsAsInteger(lv.l, s.l, b.l)
Prototype pExamineColumn(h.l, s.l)
Prototype pSetColumnSort(h.l, s.l, f.l)
Prototype pGetColumnUpdate(h.l, b.l)
Prototype pRaiseColumns(h.l, b.l, s.l, g.l)
Prototype pRaiseLine(lv.l, l.l, s.l, g.l)
Prototype pMixRGB(f1.l, f2.l)
Prototype pSetBackImage(h.l, n.l, f.l)
Prototype pPrintListview(h.l, w.l, i.l, s.l, l.l, o.l, r.l, u.l, ps.l, pz.l, us.l, n.l, f.l)
Prototype pPrintColumns(b.l)
Prototype pAreCheckboxesPresent(h.l)
Prototype pEraseListview(h.l)
Prototype pGetControlParas(b.l)
Prototype pRegister(k.l)
Prototype pSetFilelistFilter(s.l)
Prototype pSetFilelistNoFilter(s.l)
Prototype pEnableDragDrop(lv.l, f.l)
Prototype pGetDragDropParas(b.l)
Prototype pSetStyle(s.l)
Prototype pGetVar(f.l)
Prototype pGetEdgeIntegers(b.l, a.l, l.l, h.l)
Prototype pGetEdgeFloats(b.l, a.l, l.f, h.f)
Prototype pGetIcon(lv.l, s.l, z.l)
Prototype pAreIconsPresent(H.l)
Prototype pSetColumnAlignment(lv.l, s.l, a.l)
Prototype pSetLineNumbers(lv.l, a.l, s.l)
Prototype pGetDllVersion()
Prototype pDeleteSpaceLines(lv.l, f.l)
Prototype pGetIndex()
Prototype pConvertDatas(lv.l, s.l, f.l)
Prototype pForbidScrollMessage(lv.l)
Prototype pExchangeBytes(lv.l, s.l, q.l, z.l)
Prototype pSetPrintAttributes(F.l, p1.l, p2.l, p3.l, p4.l)
Prototype pSetColumnsWidthLimits(L.l, H.l)
Prototype pSetLineHeight(lv.l, y.l)
Prototype pGetLastKey(L.l,T.l)
Prototype pListviewToRaw(H.l,B.l)
Prototype pRawToListview(H.l, B.l)
Prototype pSetItemTextEx(H.l,T.l,S.l,L.l,A.l)
Prototype pGetItemTextEx(H.l,B.l,S.l,L.l,A.l)
Prototype pBuildListview(H.l,S.l,L.l,B.l,T.l)
Prototype pClearListview(H.l)
Prototype pEditManual(H.l,S.l,Z.l,F.l)
Prototype pCsvToHeader(H.l, B.l, O.l)
Prototype pDeleteAllItems(H.l)
Prototype pDeleteColumn(H.l, I.l)
;Prototype pDeleteItem(H.l, I.l)
Prototype pGetItemState(lv.l, index.l, status.l)
Prototype pGetSelectedCount(lv.l)
Prototype pUpdateListview(H.l)
Prototype pGetLineText(h.l, i.l, b.l)
Prototype pSetColumnUpdate(H.l, B.l)
Prototype pHeaderToCsv(H.l, B.l, A.l, F.l)
Prototype pSearchBlankItem(H.l, S.l, L.l)
If IsLibrary(#Library)
Global CreateListview.pCreateListview = GetFunction(#Library, "CreateListview")
Global IColumn.pIColumn = GetFunction(#Library, "IColumn")
Global SItem.pSItem = GetFunction(#Library, "SItem")
Global ShowListview.pShowListview = GetFunction(#Library, "ShowListview")
Global InitMessages.pInitMessages = GetFunction(#Library, "InitMessages")
Global ASortListview.pASortListview = GetFunction(#Library, "ASortListview")
Global AddItemValues.pAddItemValues = GetFunction(#Library, "AddItemValues")
Global CheckIfMarked.pCheckIfMarked = GetFunction(#Library, "CheckIfMarked")
Global MarkIfChecked.pMarkIfChecked = GetFunction(#Library, "MarkIfChecked")
Global ReadFileQuick.pReadFileQuick = GetFunction(#Library, "ReadFileQuick")
Global WriteFileQuick.pWriteFileQuick = GetFunction(#Library, "WriteFileQuick")
Global SwapLines.pSwapLines = GetFunction(#Library, "SwapLines")
Global CsvToListview.pCsvToListview = GetFunction(#Library, "CsvToListview")
Global ListviewToCsv.pListviewToCsv = GetFunction(#Library, "ListviewToCsv")
Global SetItemsFromMem.pSetItemsFromMem = GetFunction(#Library, "SetItemsFromMem")
Global GetColumns.pGetColumns = GetFunction(#Library, "GetColumns")
Global GetColumnName.pGetColumnName = GetFunction(#Library, "GetColumnName")
Global GetLines.pGetLines = GetFunction(#Library, "GetLines")
Global GetSelected.pGetSelected = GetFunction(#Library, "GetSelected")
Global GetSelectedDbClk.pGetSelectedDbClk = GetFunction(#Library, "GetSelectedDbClk")
Global GetAllSelected.pGetAllSelected = GetFunction(#Library, "GetAllSelected")
Global GetAllCheckboxStates.pGetAllCheckboxStates = GetFunction(#Library, "GetAllCheckboxStates")
Global GetNeededMemory.pGetNeededMemory = GetFunction(#Library, "GetNeededMemory")
Global GetTabOffsets.pGetTabOffsets = GetFunction(#Library, "GetTabOffsets")
Global GetNullOffset.pGetNullOffset = GetFunction(#Library, "GetNullOffset")
Global GetOwnControlParas.pGetOwnControlParas = GetFunction(#Library, "GetOwnControlParas")
Global GetRealColumnIndex.pGetRealColumnIndex = GetFunction(#Library, "GetRealColumnIndex")
Global CreateImageList.pCreateImageList = GetFunction(#Library, "CreateImageList")
Global SetImageList.pSetImageList = GetFunction(#Library, "SetImageList")
Global SetIcon.pSetIcon = GetFunction(#Library, "SetIcon")
Global SetIconMode.pSetIconMode = GetFunction(#Library, "SetIconMode")
Global SetIconColumn.pSetIconColumn = GetFunction(#Library, "SetIconColumn")
Global SetIconsFromMem.pSetIconsFromMem = GetFunction(#Library, "SetIconsFromMem")
Global SetIconsWith.pSetIconsWith = GetFunction(#Library, "SetIconsWith")
Global SetIndex.pSetIndex = GetFunction(#Library, "SetIndex")
Global SetColumnsWidthLimits.pSetColumnsWidthLimits = GetFunction(#Library, "SetColumnsWidthLimits")
Global GetSelectedLine.pGetSelectedLine = GetFunction(#Library, "GetSelectedLine")
Global GetColumnWidth.pGetColumnWidth = GetFunction(#Library, "GetColumnWidth")
Global CryptMem.pCryptMem = GetFunction(#Library, "CryptMem")
Global SetColumnsFromMem.pSetColumnsFromMem = GetFunction(#Library, "SetColumnsFromMem")
Global SetColumnName.pSetColumnName = GetFunction(#Library, "SetColumnName")
Global CloseMessages.pCloseMessages = GetFunction(#Library, "CloseMessages")
Global DbfToCsv.pDbfToCsv = GetFunction(#Library, "DbfToCsv")
Global SelectLine.pSelectLine = GetFunction(#Library, "SelectLine")
Global SetAllCheckboxStates.pSetAllCheckboxStates = GetFunction(#Library, "SetAllCheckboxStates")
Global DeleteDoubleItems.pDeleteDoubleItems = GetFunction(#Library, "DeleteDoubleItems")
Global EnableEdits.pEnableEdits = GetFunction(#Library, "EnableEdits")
Global ListviewToDbf.pListviewToDbf = GetFunction(#Library, "ListviewToDbf")
Global SetCheckboxState.pSetCheckboxState = GetFunction(#Library, "SetCheckboxState")
Global GetCheckboxState.pGetCheckboxState = GetFunction(#Library, "GetCheckboxState")
Global GetChecked.pGetChecked = GetFunction(#Library, "GetChecked")
Global SearchText.pSearchText = GetFunction(#Library, "SearchText")
Global SelectColumnEdits.pSelectColumnEdits = GetFunction(#Library, "SelectColumnEdits")
Global ExchangeSeparator.pExchangeSeparator = GetFunction(#Library, "ExchangeSeparator")
Global CopyLineTo.pCopyLineTo = GetFunction(#Library, "CopyLineTo")
Global CopyColumnTo.pCopyColumnTo = GetFunction(#Library, "CopyColumnTo")
Global GetIndex.pGetIndex = GetFunction(#Library, "GetIndex")
Global SortManual.pSortManual = GetFunction(#Library, "SortManual")
Global FilelistToCsv.pFilelistToCsv = GetFunction(#Library, "FilelistToCsv")
Global SetItemText.pSetItemText = GetFunction(#Library, "SetItemText")
Global GetItemText.pGetItemText = GetFunction(#Library, "GetItemText")
Global GetItemTextsAsFloat.pGetItemTextsAsFloat = GetFunction(#Library, "GetItemTextsAsFloat")
Global GetItemTextsAsInteger.pGetItemTextsAsInteger = GetFunction(#Library, "GetItemTextsAsInteger")
Global ExamineColumn.pExamineColumn = GetFunction(#Library, "ExamineColumn")
Global SetColumnSort.pSetColumnSort = GetFunction(#Library, "SetColumnSort")
Global GetColumnUpdate.pGetColumnUpdate = GetFunction(#Library, "GetColumnUpdate")
Global SetColumnUpdate.pSetColumnUpdate = GetFunction(#Library, "SetColumnUpdate")
Global RaiseColumns.pRaiseColumns = GetFunction(#Library, "RaiseColumns")
Global RaiseLine.pRaiseLine = GetFunction(#Library, "RaiseLine")
Global MixRGB.pMixRGB = GetFunction(#Library, "MixRGB")
Global SetBackImage.pSetBackImage = GetFunction(#Library, "SetBackImage")
Global PrintListview.pPrintListview = GetFunction(#Library, "PrintListview")
Global PrintColumns.pPrintColumns = GetFunction(#Library, "PrintColumns")
Global AreCheckboxesPresent.pAreCheckboxesPresent = GetFunction(#Library, "AreCheckboxesPresent")
Global AreIconsPresent.pAreIconsPresent = GetFunction(#Library, "AreIconsPresent")
Global EraseListview.pEraseListview = GetFunction(#Library, "EraseListview")
Global GetControlParas.pGetControlParas = GetFunction(#Library, "GetControlParas")
Global Register.pRegister = GetFunction(#Library, "Register")
Global SetFilelistFilter.pSetFilelistFilter = GetFunction(#Library, "SetFilelistFilter")
Global SetFilelistNoFilter.pSetFilelistNoFilter = GetFunction(#Library, "SetFilelistNoFilter")
Global EnableDragDrop.pEnableDragDrop = GetFunction(#Library, "EnableDragDrop")
Global GetDragDropParas.pGetDragDropParas = GetFunction(#Library, "GetDragDropParas")
Global SetStyle.pSetStyle = GetFunction(#Library, "SetStyle")
Global GetVar.pGetVar = GetFunction(#Library, "GetVar")
Global GetEdgeIntegers.pGetEdgeIntegers = GetFunction(#Library, "GetEdgeIntegers")
Global GetEdgeFloats.pGetEdgeFloats = GetFunction(#Library, "GetEdgeFloats")
Global GetIcon.pGetIcon = GetFunction(#Library, "GetIcon")
Global SetColumnAlignment.pSetColumnAlignment = GetFunction(#Library, "SetColumnAlignment")
Global SetLineNumbers.pSetLineNumbers = GetFunction(#Library, "SetLineNumbers")
Global GetDllVersion.pGetDllVersion = GetFunction(#Library, "GetDllVersion")
Global DeleteSpaceLines.pDeleteSpaceLines = GetFunction(#Library, "DeleteSpaceLines")
Global ConvertDatas.pConvertDatas = GetFunction(#Library, "ConvertDatas")
Global ForbidScrollMessage.pForbidScrollMessage = GetFunction(#Library, "ForbidScrollMessage")
Global ExchangeBytes.pExchangeBytes = GetFunction(#Library, "ExchangeBytes")
Global SetPrintAttributes.pSetPrintAttributes = GetFunction(#Library, "SetPrintAttributes")
Global SetLineHeight.pSetLineHeight = GetFunction(#Library, "SetLineHeight")
Global GetLastKey.pGetLastKey = GetFunction(#Library, "GetLastKey")
Global SetColumnsWidthLimits.pSetColumnsWidthLimits = GetFunction(#Library, "SetColumnsWidthLimits")
Global ListviewToRaw.pListviewToRaw = GetFunction(#Library, "ListviewToRaw")
Global RawToListview.pRawToListview = GetFunction(#Library, "RawToListview")
Global SetItemTextEx.pSetItemTextEx = GetFunction(#Library, "SetItemTextEx")
Global GetItemTextEx.pGetItemTextEx = GetFunction(#Library, "GetItemTextEx")
Global BuildListview.pBuildListview = GetFunction(#Library, "BuildListview")
Global ClearListview.pClearListview = GetFunction(#Library, "ClearListview")
Global EditManual.pEditManual = GetFunction(#Library, "EditManual")
Global CsvToHeader.pCsvToHeader = GetFunction(#Library, "CsvToHeader")
Global HeaderToCsv.pHeaderToCsv = GetFunction(#Library, "HeaderToCsv")
Global DeleteAllItems.pDeleteAllItems = GetFunction(#Library, "DeleteAllItems")
Global DeleteColumn.pDeleteColumn = GetFunction(#Library, "DeleteColumn")
;Global DeleteItem.pDeleteItem = GetFunction(#Library, "DeleteItem")
Global GetItemState.pGetItemState = GetFunction(#Library, "GetItemState")
Global GetSelectedCount.pGetSelectedCount = GetFunction(#Library, "GetSelectedCount")
Global UpdateListview.pUpdateListview = GetFunction(#Library, "UpdateListview")
Global HeaderToCsv.pHeaderToCsv = GetFunction(#Library, "HeaderToCsv")
Global SearchBlankItem.pSearchBlankItem = GetFunction(#Library, "SearchBlankItem")
Else
MessageRequester("Fehler", "Library nicht gefunden", 0)
End
EndIf
Procedure DestroyImageList(i.l)
ImageList_Destroy_(i)
EndProcedure
Procedure.s GetLineText(h.l, i.l, b.l)
value = GetFunction(#Library, "GetLineText")
If value <> 0
text = PeekS(b)
Else
text = ""
EndIf
ProcedureReturn text
EndProcedure
Procedure.l GetLVTxtColor(lv.l)
value = SendMessage_(lv, $1023, 0, 0)
ProcedureReturn value
EndProcedure
Procedure.l GetLVTxtBKColor(lv.l)
value = SendMessage_(lv, $1025, 0, 0)
ProcedureReturn value
EndProcedure
Procedure.l GetLVBKColor(lv.l)
value = SendMessage_(lv, $1000, 0, 0)
ProcedureReturn value
EndProcedure
Procedure DeleteItem(lv.l, zeile.l)
SendMessage_(lv,$1008, zeile, 0)
EndProcedure
Code: Select all
IncludeFile "ListviewP.pbi"
Global flen.l, lhandle.l, bereich.l, fenster.l, fenster1.l, aicons.l, ilist.l, lvcount.l, Quit.l
Global hinstance.l
Global datei.s, root.s, sp1.s, sp2.s, sp3. s, fehler.s, EditableColumns.s
Global Dim Spalten.s(3)
sp1 = "Artikel"
sp2 = "Menge"
sp3 = "Preis"
EditableColumns = "001"
; only the column Preis is editable -> 0 = noneditable 1 = editable
Declare DatenLesen()
Declare PrintLV()
Register(199143)
Procedure PrintLV()
titel.s = "Liste"
PrintListview(lhandle, WindowID(0), 48, 60, 200, 200, 200, 200, 0, 0, @titel, 0, 1)
EndProcedure
Procedure DatenLesen()
Spalten(0) = "Grafikkarte"
Spalten(1) = "10"
Spalten(2) = "30.00"
SItem(lhandle, @Spalten(), 3)
Spalten(0) = "Mainboard"
Spalten(1) = "5"
Spalten(2) = "150.00"
SItem(lhandle, @Spalten(), 3)
Spalten(0) = "Soundcard"
Spalten(1) = "5"
Spalten(2) = "20"
SItem(lhandle, @Spalten(), 3)
EndProcedure
fenster1 = OpenWindow(0, 10, 10, 640, 480, "List - View",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
ButtonGadget(1, 10, 10 ,100, 20, "Info")
ButtonGadget(2, 120, 10, 100, 20, "Print")
ButtonGadget(3, 230, 10, 70, 20, "Ende")
TextGadget(4, 10, 35, 200, 20, "")
lhandle = CreateListview(WindowID(0), 0, 0, RGB(255,255,255), -1, $31)
IColumn(lhandle, @sp1, 250, 0)
IColumn(lhandle, @sp2, 80, 0)
IColumn(lhandle, @sp3, 100, 0)
ShowListview(lhandle, 5, 60, 570, 320)
SelectColumnEdits(lhandle, @EditableColumns) ; without this command, all columns are editable
EnableEdits(lhandle, 1) ; make columns editable with right click
; Parameter = 5 -> double left click -> EnableColumnEdits(lhandle, 5)
; Messageverwaltung einschalten
InitMessages(WindowID(0))
DatenLesen()
Quit = 0
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_Gadget And EventGadget() = 1
MessageRequester("Datei - Lister", "Info", #PB_MessageRequester_Ok)
EndIf
If EventID = #PB_Event_Gadget And EventGadget() = 2
PrintLV()
EndIf
If EventID = #PB_Event_Gadget And EventGadget() = 3
; Ende
Quit = 1
EndIf
Until EventID = #PB_Event_CloseWindow Or Quit = 1
; Messageverwaltung wieder ausschalten
CloseMessages(WindowID(0))
DestroyWindow_(fenster1)
End