MyLittleGrid MLG.DLL

Anfängerfragen zum Programmieren mit PureBasic.
ben1160
Beiträge: 7
Registriert: 05.05.2016 18:51

MyLittleGrid MLG.DLL

Beitrag von ben1160 »

Hallo,

ich möchte MyLittleGrid (MLG.DLL) in meinen Programmen verwenden. Hat jemand von Euch schon Erfahrungen damit?

LG Helmut
Benutzeravatar
mk-soft
Beiträge: 3855
Registriert: 24.11.2004 13:12
Wohnort: Germany

Re: MyLittleGrid MLG.DLL

Beitrag von mk-soft »

Wie es aus sieht nur Windows und 32Bit. Ausserdem Kostenpflichtig.

Vielleicht mal im Forum nach alternativen suchen.

Diesen finde ich schon sehr gut. Link http://www.purebasic.fr/english/viewtop ... 12&t=54022
Alles ist möglich, fragt sich nur wie...
Projekte ThreadToGUI / EventDesigner V3 / OOP-BaseClass-Modul
Downloads auf MyWebspace / OneDrive
ben1160
Beiträge: 7
Registriert: 05.05.2016 18:51

Re: MyLittleGrid MLG.DLL

Beitrag von ben1160 »

Danke für die schnelle Info.
Die Einschränkungen würde ich aber gerne in Kauf nehmen, vor allem da MLG einige Features mehr als zB MyGrid aufweist und auch optisch besser aussieht.
Soweit ich das verstanden habe wurde die MLG.DLL mittels PowerBasic erstellt. Da ich ein blutiger Anfänger bin frage ich mich wie man diese DLL in PB einbinden kann. Ich habe schon mit OpenLibrary und CallFunction experimentiert, komme aber bis jetzt auf keinen grünen Zweig.

LG
Helmut
Benutzeravatar
H.Brill
Beiträge: 496
Registriert: 15.10.2004 17:42
Wohnort: 66557 Neunkirchen

Re: MyLittleGrid MLG.DLL

Beitrag von H.Brill »

Ist vielleicht die Listview.dll (32Bit) etwas für dich ?
http://frabbing.net/prg_listviewdll.php

einen älteren Code hätte ich dafür noch :

Code: Alles auswählen

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

Global Dim Spalten.s(3)
sp1 = "Artikel"
sp2 = "Menge"
sp3 = "Preis"


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)
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) 
EnableEdits(lhandle, 1)
; 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

Hier die nötige .pbi :

Code: Alles auswählen

; ListviewP.pbi
; 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   
Müßte dann nur im ASCII - Modus compiliert werden.
PB 6.10
ben1160
Beiträge: 7
Registriert: 05.05.2016 18:51

Re: MyLittleGrid MLG.DLL

Beitrag von ben1160 »

Danke für den Hinweis und den Code. Ich habe mir die listview.dll besorgt und mit Deinem Code zum Laufen gebracht. Optisch schaut das gut aus. Leider ist die Bearbeitung der Zellen nicht optimal. So weit ich das sehe kann man den Inhalt einer Zelle nur über Anklicken mit der rechten Maus Taste bearbeiten. Oder gibt es hier eine andere Möglichkeit die ich übersehen habe.

LG Helmut
- chris -
Beiträge: 195
Registriert: 24.08.2005 19:52
Wohnort: Stadtallendorf

Re: MyLittleGrid MLG.DLL

Beitrag von - chris - »

Die ersten Versuche mit MyLittleGrid:

Code: Alles auswählen


;http://shop.powerbasic.com/products/my-little-grid

#IDC_MLGGRID = 100

;#MLG_STYLE = 1353711616
#MLG_STYLE = #WS_VISIBLE | #WS_BORDER | #WS_CHILD | #WS_CLIPCHILDREN | #WS_CLIPSIBLINGS

Global MLG_hDLL.i

;- Prototype
Prototype.i MLGHSIZERPROC()
Prototype.i MLGTABPROC()
Prototype.i MLGVSIZERPROC()
Prototype.i MLG_ARRAYREDIM()
Prototype.i MLG_ARRAYREDIMZ()
Prototype.i MLG_CREATE()
Prototype.i MLG_GET()
Prototype.i MLG_GETEX()
Prototype.i MLG_GETZ()
Prototype.i MLG_INIT()
Prototype.i MLG_INITEX()
Prototype.i MLG_PUT()
Prototype.i MLG_PUTEX()
Prototype.i MLG_PUTZ()

Procedure MLG_CloseDLL()
  If MLG_hDLL <> 0
    If IsLibrary(MLG_hDLL)
      CloseLibrary(MLG_hDLL)
    EndIf
    MLG_hDLL = 0
  EndIf
EndProcedure

Procedure MLG_OpenDLL()

  MLG_hDLL = OpenLibrary(#PB_Any, "MLG.dll")
  If MLG_hDLL = 0
    ProcedureReturn #False
  EndIf

  Global MLGHSIZERPROC.MLGHSIZERPROC=GetFunction(MLG_hDLL,"MLGHSIZERPROC")
  Global MLGTABPROC.MLGTABPROC=GetFunction(MLG_hDLL,"MLGTABPROC")
  Global MLGVSIZERPROC.MLGVSIZERPROC=GetFunction(MLG_hDLL,"MLGVSIZERPROC")
  Global MLG_ARRAYREDIM.MLG_ARRAYREDIM=GetFunction(MLG_hDLL,"MLG_ARRAYREDIM")
  Global MLG_ARRAYREDIMZ.MLG_ARRAYREDIMZ=GetFunction(MLG_hDLL,"MLG_ARRAYREDIMZ")
  Global MLG_CREATE.MLG_CREATE=GetFunction(MLG_hDLL,"MLG_CREATE")
  Global MLG_GET.MLG_GET=GetFunction(MLG_hDLL,"MLG_GET")
  Global MLG_GETEX.MLG_GETEX=GetFunction(MLG_hDLL,"MLG_GETEX")
  Global MLG_GETZ.MLG_GETZ=GetFunction(MLG_hDLL,"MLG_GETZ")
  Global MLG_INIT.MLG_INIT=GetFunction(MLG_hDLL,"MLG_INIT")
  Global MLG_INITEX.MLG_INITEX=GetFunction(MLG_hDLL,"MLG_INITEX")
  Global MLG_PUT.MLG_PUT=GetFunction(MLG_hDLL,"MLG_PUT")
  Global MLG_PUTEX.MLG_PUTEX=GetFunction(MLG_hDLL,"MLG_PUTEX")
  Global MLG_PUTZ.MLG_PUTZ=GetFunction(MLG_hDLL,"MLG_PUTZ")

  ProcedureReturn #True
EndProcedure

Code: Alles auswählen


EnableExplicit

IncludeFile "MLG.pbi"

;- Enumerations / DataSections
;- Windows
Enumeration
  #Window_0
EndEnumeration

;- Gadgets
Enumeration
  #Button_0
EndEnumeration

;- Define
Define Event.i, EventWindow.i, EventGadget.i, EventType.i, EventMenu.i
Define hWnd.i, hGrid.i, res.i
Define quit.i

If MLG_OpenDLL() = 0
  End
EndIf

Procedure OpenWindow_Window_0()
  Protected res.i
  res = #False
  If OpenWindow(#Window_0, 450, 200, 800, 600, "MLG Workbook Demo", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar)
    ;ButtonGadget(#Button_0, 30, 55, 95, 60, "Button")
    res = #True
  EndIf
  ProcedureReturn res
EndProcedure

If OpenWindow_Window_0()

  hWnd = WindowID(#Window_0)

  MLG_Init()

  hGrid = CreateWindow_("MYLITTLEGRID", "d-0/r35/c6/e1/t2/b2/x60,80,80,80,80,5,80/m2Move Left,Move Right,-,Color Default,Color Cyan,-,Info", #MLG_STYLE, 4, 4, 765, 555, hWnd, #IDC_MLGGRID, GetWindowLong_(hWnd, #GWL_HINSTANCE), 0)

  ;- Event loop
  Repeat

    Event       = WaitWindowEvent()
    EventGadget = EventGadget()
    EventType   = EventType()
    EventWindow = EventWindow()

    Select Event

      Case #PB_Event_Gadget

        If EventGadget = #Button_0

        EndIf

      Case #PB_Event_CloseWindow

        quit = 1

    EndSelect

  Until quit = 1

EndIf

End

PB v5.72 x86/x64
Windows 10 Pro 64bit
Benutzeravatar
H.Brill
Beiträge: 496
Registriert: 15.10.2004 17:42
Wohnort: 66557 Neunkirchen

Re: MyLittleGrid MLG.DLL

Beitrag von H.Brill »

ben1160 hat geschrieben:Danke für den Hinweis und den Code. Ich habe mir die listview.dll besorgt und mit Deinem Code zum Laufen gebracht. Optisch schaut das gut aus. Leider ist die Bearbeitung der Zellen nicht optimal. So weit ich das sehe kann man den Inhalt einer Zelle nur über Anklicken mit der rechten Maus Taste bearbeiten. Oder gibt es hier eine andere Möglichkeit die ich übersehen habe.

LG Helmut
Schau mal in der PDF-Hilfe, die dabei ist :
EnableEdits(H,F)
Erlaubt in einem Listview editierbare Itemtexte (oder auch nicht).
H : Long - Handle eines mit CreateListview() erstellten Listview Controls
F : Long - Flag
Normalerweise arbeiten Listview-Controls ohne editierbare Itemtexte.
Mit EnableEdits() kann dieses Feature aber eingeschaltet (oder wieder abgeschaltet) werden, und zwar für jedes
einzelne Listview.
Ob ein Listview editierbar werden soll, bestimmt das Flag F.
0 = H soll kein editierbares Listview sein
1 = H soll editierbar sein
2 = Sobald ein Editfeld erscheint, wird der Text darin selektiert (ohne Flag 2
bleibt
der Text normal)
4 = Editieren startet mit linkem Maus-Doppelklick
8 = Editieren startet mit rechtem Mausklick und linkem Maus-Doppelklick
16 = Springen mit Cursortaste links/rechts und komplettes Text-Entfernen mit "Entf"
verbieten
Bisher waren die Flags 2-16 global. Ab Listview.dll-Version 1.7 sind sie jetzt aber auch lokal und können für jedes
Listview unterschiedlich eingestellt werden.
Ein Editfeld wird in einem Listview erzeugt, sobald der Anwender die rechte Maustaste (default) über einem
Itemtext drückt.
Es erscheint das Editfeld mit dem Itemtext, der jetzt editiert werden kann.
Benutzt der Anwender die rechte Maustaste zusammen mit der Taste STRG, dann erscheint das Editfeld mit dem
dem Inhalt der Zwischenablage (erste Textzeile, die im Clipboard gespeichert ist.
Ist Flag 4 gesetzt, dann ist anstatt des rechten Mausklicks der linke Maus-Doppelklick aktiv.
Ist Flag 8 gesetzt, dann sind beide Mausklicks gestattet. Flag 4 und 8 dürfen nicht zusammen benutzt werden!
Ist das Editfeld nun erschienen, dann kann solange editiert werden, bis eine Maustaste oder eine der Tasten
Return, Tab, Bild hoch, Bild runter, Pos 1, Ende oder die Cursortasten gedrückt wurde. Danach verschwindet das
Editfeld und setzt den editierten Text als Itemtext an passender Stelle in das Listview.
Wurde die Tabtaste gedrückt, dann baut sich anschließend ein neues Editfeld auf, sodas der nächste Itemtext
editiert werden kann.
Wenn die Tabtaste zusammen mit SHIFT gedrückt wurde, kann der vorhergehende Itemtext editiert werden. Die
Tab-Taste kann jedoch auch unter mehreren Controls hin und her springen. Darum empfehlen sich immer die
Cursortasten, um zu springen.
Wird eine Cursortaste gedrückt, dann wird das Editfeld in diese Richtung weitergesetzt. Bei den Cursortasten links/
rechts kann man das per Flag 16 aber verhindern. Ist Flag 16 nicht gesetzt, kann mittels der Entf-Taste der
komplette Text im Editfeld gelöscht werden.
Wenn der User die Spalten per Drag&Drop verschoben hat, kann sich die Reihenfolge innerhalb des
Spaltenindexes ändern!
Ein Trackmenü kann während des Editierens nicht benutzt werden, dafür aber die üblichen Windows
Tastenkombinationen:
STRG+C = Kopieren
STRG+X = Ausschneiden
STRG+V = Einfügen
STRG+Z = Rückgängig
ENTF = Löschen
STRG+SHIFT+CURSORTASTE = Textblock markieren.
Anmerkung: Windows Listview-Controls unterstützen normalerweise nicht das Editieren in beliebigen Spalten,
lediglich in der ersten Spalte kann editiert werden. Hierbei reagieret das System-Editcontrol genauso, wie die
Editcontrols, welche die Listview.dll erzeugt. D.h. auch dort unterbricht ein Mausklick die Eingabe.
Ich selber hätte gern zusätzlich zu den Editfeldern noch ein Trackmenu gestattet, aber das scheint nicht möglich zu
sein, weil das Editcontrol nur ein Childwindows des Listview-Controls ist....
Editierbare Listview mit Profan sollten nur in einem Fenster mit Dialogstyle (Fensterstyle 512) aufgerufen werden.
Ab Listview.dll Version 1.4 kann mit SelectColumnEdits() entschieden werden, das nur bestimmte Spalten
editierbar sind.
Mit Version 2.0 kamen manuell erzeugte Editfelder dazu, um konfortable Eingabemasken programmieren zu
können. Diese werden mit EditManual() erzeugt. EnableEdits() sollte deaktiviert sein/werden, wenn die manuellen
Felder benutzt werden sollen.
Da gibt es mehrere Möglichkeiten.
PB 6.10
ben1160
Beiträge: 7
Registriert: 05.05.2016 18:51

Re: MyLittleGrid MLG.DLL

Beitrag von ben1160 »

H.Brill hat geschrieben:
ben1160 hat geschrieben:Danke für den Hinweis und den Code. Ich habe mir die listview.dll besorgt und mit Deinem Code zum Laufen gebracht. Optisch schaut das gut aus. Leider ist die Bearbeitung der Zellen nicht optimal. So weit ich das sehe kann man den Inhalt einer Zelle nur über Anklicken mit der rechten Maus Taste bearbeiten. Oder gibt es hier eine andere Möglichkeit die ich übersehen habe.

LG Helmut
Schau mal in der PDF-Hilfe, die dabei ist :
EnableEdits(H,F)
Erlaubt in einem Listview editierbare Itemtexte (oder auch nicht).
H : Long - Handle eines mit CreateListview() erstellten Listview Controls
F : Long - Flag
Normalerweise arbeiten Listview-Controls ohne editierbare Itemtexte.
Mit EnableEdits() kann dieses Feature aber eingeschaltet (oder wieder abgeschaltet) werden, und zwar für jedes
einzelne Listview.
Ob ein Listview editierbar werden soll, bestimmt das Flag F.
0 = H soll kein editierbares Listview sein
1 = H soll editierbar sein
2 = Sobald ein Editfeld erscheint, wird der Text darin selektiert (ohne Flag 2
bleibt
der Text normal)
4 = Editieren startet mit linkem Maus-Doppelklick
8 = Editieren startet mit rechtem Mausklick und linkem Maus-Doppelklick
16 = Springen mit Cursortaste links/rechts und komplettes Text-Entfernen mit "Entf"
verbieten
Bisher waren die Flags 2-16 global. Ab Listview.dll-Version 1.7 sind sie jetzt aber auch lokal und können für jedes
Listview unterschiedlich eingestellt werden.
Ein Editfeld wird in einem Listview erzeugt, sobald der Anwender die rechte Maustaste (default) über einem
Itemtext drückt.
Es erscheint das Editfeld mit dem Itemtext, der jetzt editiert werden kann.
Benutzt der Anwender die rechte Maustaste zusammen mit der Taste STRG, dann erscheint das Editfeld mit dem
dem Inhalt der Zwischenablage (erste Textzeile, die im Clipboard gespeichert ist.
Ist Flag 4 gesetzt, dann ist anstatt des rechten Mausklicks der linke Maus-Doppelklick aktiv.
Ist Flag 8 gesetzt, dann sind beide Mausklicks gestattet. Flag 4 und 8 dürfen nicht zusammen benutzt werden!
Ist das Editfeld nun erschienen, dann kann solange editiert werden, bis eine Maustaste oder eine der Tasten
Return, Tab, Bild hoch, Bild runter, Pos 1, Ende oder die Cursortasten gedrückt wurde. Danach verschwindet das
Editfeld und setzt den editierten Text als Itemtext an passender Stelle in das Listview.
Wurde die Tabtaste gedrückt, dann baut sich anschließend ein neues Editfeld auf, sodas der nächste Itemtext
editiert werden kann.
Wenn die Tabtaste zusammen mit SHIFT gedrückt wurde, kann der vorhergehende Itemtext editiert werden. Die
Tab-Taste kann jedoch auch unter mehreren Controls hin und her springen. Darum empfehlen sich immer die
Cursortasten, um zu springen.
Wird eine Cursortaste gedrückt, dann wird das Editfeld in diese Richtung weitergesetzt. Bei den Cursortasten links/
rechts kann man das per Flag 16 aber verhindern. Ist Flag 16 nicht gesetzt, kann mittels der Entf-Taste der
komplette Text im Editfeld gelöscht werden.
Wenn der User die Spalten per Drag&Drop verschoben hat, kann sich die Reihenfolge innerhalb des
Spaltenindexes ändern!
Ein Trackmenü kann während des Editierens nicht benutzt werden, dafür aber die üblichen Windows
Tastenkombinationen:
STRG+C = Kopieren
STRG+X = Ausschneiden
STRG+V = Einfügen
STRG+Z = Rückgängig
ENTF = Löschen
STRG+SHIFT+CURSORTASTE = Textblock markieren.
Anmerkung: Windows Listview-Controls unterstützen normalerweise nicht das Editieren in beliebigen Spalten,
lediglich in der ersten Spalte kann editiert werden. Hierbei reagieret das System-Editcontrol genauso, wie die
Editcontrols, welche die Listview.dll erzeugt. D.h. auch dort unterbricht ein Mausklick die Eingabe.
Ich selber hätte gern zusätzlich zu den Editfeldern noch ein Trackmenu gestattet, aber das scheint nicht möglich zu
sein, weil das Editcontrol nur ein Childwindows des Listview-Controls ist....
Editierbare Listview mit Profan sollten nur in einem Fenster mit Dialogstyle (Fensterstyle 512) aufgerufen werden.
Ab Listview.dll Version 1.4 kann mit SelectColumnEdits() entschieden werden, das nur bestimmte Spalten
editierbar sind.
Mit Version 2.0 kamen manuell erzeugte Editfelder dazu, um konfortable Eingabemasken programmieren zu
können. Diese werden mit EditManual() erzeugt. EnableEdits() sollte deaktiviert sein/werden, wenn die manuellen
Felder benutzt werden sollen.
Da gibt es mehrere Möglichkeiten.
Vielen Dank. Werde mir das gleich einmal ansehen.
LG Helmut
ben1160
Beiträge: 7
Registriert: 05.05.2016 18:51

Re: MyLittleGrid MLG.DLL

Beitrag von ben1160 »

- chris - hat geschrieben:Die ersten Versuche mit MyLittleGrid:
Herzlichen Dank. Das ist genau das was ich als blutiger Anfänger gebraucht habe. Nun verstehe ich auch die Demo Datei besser.

LG Helmut
ben1160
Beiträge: 7
Registriert: 05.05.2016 18:51

Re: MyLittleGrid MLG.DLL

Beitrag von ben1160 »

Ich bräuchte noch einmal Hilfe mit dem MyLitteGrid. Ich habe nun das Grid schön in einem Fenster. Wenn ich aber mit MLG_PUT Daten in eine Zelle schreibe, bekomme ich den ERROR "Ungültiger Speciherzugriff (Lesefehler an der Adresse xxxxxxx)". Den Prototype habe ich erweitert.

Code: Alles auswählen

Prototype.i MLG_PUT(hWnd.l, MyRow.l, MyCol.l, Mystr.s, MyGrid.l, MySheet.l)
....
MLG_Put(hGrid,1,1,"Test",0,0)
Antworten