English
Forum

List view1.pb Beispieldatei Darstellungsfehler

 
- Page 1 -



Fred
Matthiesen
Hello and good day together.
I begrüße first any Members.
Try The Listviewdll from and had to check, that I a problem not whom handle get.
If the Beispieldatei launched becomes, is the List view first of all dark. so far ok. now load I The DBF-File and it shows supra left too The Number of eingelesenen Datensätze on. --- but---- the Listvier remaining dark. One Linksklick with the mouse: Fehlanzeige. now with the rechten Mouse button: uiii, joh, the List view is visible. now but befinde I already in the Editiermodus one Items. this is for function correctly.
now, I expect, the to the reading the DBF-File itself the List view with its Einträgen shows.
which commands must to the reading erfolgen, so itself the List view shows.

Regards
Fred
 
SUSE 10.3 / Listview.dll
11/03/06  
 



 
- Page 1 -



H.Brill
Hi,
meinste PureBasic 4.0 ?
The Beispielcodes are yet for Version 3.94 written.
with Version 4.0 brauchste z.B. the Frame3DGadget not any more.
has then with the 3.94 not differently worked.

Have you time the first example on Version 4.0 rewritten.
is now not in detail tested, hope but, that it in all sharing
work.
CompileMarkSeparation
IncludeFile "Listview.pb"
Global flen.l, lhandle.l, bereich.l, Quit.l
Global datei.s, datei2.s, db_datei.s
Global spalte1.s, spalte2.s, spalte3.s, sp1.s, sp2.s, sp3.s, selected.s
spalte1.s = "Artikel"
spalte2.s = "Menge"
spalte3.s = "Preis"
Dim Spalten.l(3)
Dim Sortspalten.l(3)
; hier wird die Sortierung der einzelnen Spalten festgelegt.
; 0 = nicht sortiert, 2 = Alphabetisch, 3 = Zahlenwert (nur ganze Zahlen)
Sortspalten(0) = 1
Sortspalten(1) = 2
Sortspalten(2) = 2
selected = Space(16384)
; wird global gebraucht, um beim Abfangen von Klicks im LV
; die zeilen hineinzuschreiben. (Siehe Anfang der Repeat - Schleife)
OpenWindow(0, 100, 100, 600, 460,"List - View",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)

If CreateGadgetList(WindowID(0))

    ButtonGadget(5, 5, 10, 70, 20, "Clear")
    ButtonGadget(6, 90, 10, 70, 20, "Set Zeile")
    ButtonGadget(7, 175, 10 ,70, 20, "Ende")
    ButtonGadget(8, 5, 40, 70, 20, "Load DBF")
    ButtonGadget(9, 90, 40, 70, 20, "Save to CSV")
    ButtonGadget(10,175,40, 70, 20, "Load CSV")
    ButtonGadget(11, 175, 70, 70, 20, "Save to DBF")
    TextGadget(20, 5, 70, 80, 25, "Anzahl Zeilen : ")
    TextGadget(21, 90, 70, 40, 25, "")
    TextGadget(22, 270, 10, 40, 20, "Artikel :")
    TextGadget(23, 270, 40, 40, 20, "Menge : ")
    TextGadget(24, 270, 70, 40, 20, "Preis : ")
    StringGadget(25, 320, 10, 240, 20, "")
    StringGadget(26, 320, 40, 40, 20, "")
    StringGadget(27, 320, 70, 80, 20, "")
    ;Frame3DGadget(40, 5, 100, 580, 350, "Listview", #PB_Frame3D_Double)

EndIf

fenster.l = WindowID(0)
; Listview initialisieren und erstellen
; hier mit 3 Spalten
lhandle = CreateListview(fenster, 0, 0, RGB(255, 255, 255), -1, $31)
IColumn(lhandle, @spalte1, 240, 0)
IColumn(lhandle, @spalte2, 80, 1)
IColumn(lhandle, @spalte3, 80, 1)
; Sortierung zulassen
ASortListview(lhandle, @Sortspalten(), 3)
; Editieren zulassen
EnableEdits(lhandle, 1)
; Messageverwaltung einschalten
InitMessages(fenster)
; Listview anzeigen
ShowListview(lhandle, 5, 120, 570, 320)
MessageRequester("Hallo !", "Rechtsklick" + Chr(13) + "zum Editieren " + Chr(13) + "benutzen !", #PB_MessageRequester_Ok)
Quit = 0

Repeat

    x.l = GetSelected(@selected, @y)

    If y = lhandle

        Gosub GetEintrag

    EndIf

    EventID.l = WaitWindowEvent()

    Select EventID

        Case #PB_Event_Gadget

        Select EventGadget()

            Case 5
            ; Clear

            If GetLines(lhandle) > 0

                r.l = DeleteAllItems(lhandle)
                SetGadgetText(21, "0")

            EndIf

            Case 6
            ; Set
            Gosub SetEintrag
            Case 7
            Quit = 1
            Case 8
            ; Load DBF
            datei2 = OpenFileRequester("DBF laden", "", "dBase 3 - Dateien |*.dbf", 0)

            If datei2 <> ""

                Gosub LoadDBF

            Else

                MessageRequester("Info", "Keine Datei gewählt !", #PB_MessageRequester_Ok)

            EndIf

            Case 9
            ; Save to CSV
            datei = SaveFileRequester("CSV speichern", "", "CSV - Dateien |*.csv", 0)

            If datei <> ""

                Gosub SaveToCSV

            Else

                MessageRequester("Info", "Keine Datei gewählt !", #PB_MessageRequester_Ok)

            EndIf

            Case 10
            datei = OpenFileRequester("CSV laden", "", "CSV - Dateien |*.CSV", 0)

            If datei <> ""

                Gosub LoadCSV

            Else

                MessageRequester("Info", "Keine Datei gewählt !", #PB_MessageRequester_Ok)

            EndIf

            Case 11
            db_datei = SaveFileRequester("DBF speichern", "", "dBase 3 - Dateien |*.DBF", 0)

            If db_datei <> ""

                Gosub SaveToDBF

            Else

                MessageRequester("Info", "Keine Datei gewählt !", #PB_MessageRequester_Ok)

            EndIf

        EndSelect

    EndSelect

Until Quit = 1 Or EventID = #PB_Event_CloseWindow

; Messageverwaltung wieder ausschalten
CloseMessages(fenster)
FreeMemory(0)
DestroyWindow_(fenster1)
CloseWindow(0)
CloseLibrary(#lvdll)
End
GetEintrag:
; 3 Spalten
y.l = GetSelectedLine(lhandle)
zeile.s = GetLineText(lhandle, y, @selected)
SetGadgetText(25, StringField(zeile, 1, Chr(9)))
SetGadgetText(26, StringField(zeile, 2, Chr(9)))
SetGadgetText(27, StringField(zeile, 3, Chr(9)))
Return
SetEintrag:
sp1 = GetGadgetText(25)
sp2 = GetGadgetText(26)
sp3 = GetGadgetText(27)
Spalten(0) = @sp1
Spalten(1) = @sp2
Spalten(2) = @sp3
SItem(lhandle, @Spalten(), 3)
anzahl.l = GetLines(lhandle)
SetGadgetText(21, Str(anzahl))
Return
SaveToCSV:
anzb.l = GetNeededMemory(lhandle, 1)
; voraussichtlicher Speicherverbrauch abfragen
bereich = AllocateMemory(anzb)
wbytes.l = ListviewToCsv(lhandle, bereich, 59, 0)
err.l = WriteFileQuick(@datei, bereich, 0, wbytes)

If err <> 0

    MessageRequester("Info !", Str(err) + "  Bytes" + Chr(13) + "in Datei " + datei + Chr(13) + "geschrieben !", #PB_MessageRequester_Ok)

Else

    MessageRequester("Fehler !", "Operation ist fehlgeschlagen !", #PB_MessageRequester_Ok)

EndIf

FreeMemory(0)
Return
LoadDBF:
dbspalten.l
dbzeilen.l

If OpenFile(1, datei2)

    flen = Lof(1)
    CloseFile(1)

EndIf

If flen > 0

    bereich = AllocateMemory(flen)

EndIf

err.l = ReadFileQuick(@datei2, bereich, 0, flen)

If err <> 0

    If GetLines(lhandle) > 0

        r.l = DeleteAllItems(lhandle)

    EndIf

    anz.l = DbfToCsv(bereich, flen, @dbspalten, @dbzeilen, 1)
    CsvToListview(lhandle, bereich, anz, 3)
    SetGadgetText(21, Str(dbzeilen))
    SetIndex(dbzeilen)

Else

    MessageRequester("Info", "Konnte Datei nicht laden !", #PB_MessageRequester_Ok)

EndIf

FreeMemory(0)
Return
LoadCSV:

If OpenFile(1, datei)

    flen = Lof(1)
    CloseFile(1)

EndIf

If flen > 0

    bereich = AllocateMemory(flen)

EndIf

err.l = ReadFileQuick(@datei, bereich, 0, flen)

If err <> 0

    If GetLines(lhandle) > 0

        r.l = DeleteAllItems(lhandle)

    EndIf

    err = CsvToListview(lhandle, bereich, flen, 3)
    anzahl.l = GetLines(lhandle)
    SetGadgetText(21, Str(anzahl))

Else

    MessageRequester("Info", "Konnte Datei nicht laden !", #PB_MessageRequester_Ok)

EndIf

FreeMemory(0)
Return
SaveToDBF:
nb.l = GetNeededMemory(lhandle, 1)
; verfügbarer Platz ermitteln und Speicher allocieren
;            ACHTUNG  !!!
; da GetNeededMemory() den dBase Header nicht berücksichtigt,
; muß diese Bytezahl manuell dazugerechnet werden.
; die Zahl 4260 ist die max. Zahl an Bytes, die ein
; DBF - Header enthalten kann.
; Der erste Teil des DBF Headers ist normalerweise 32 Byte
; groß. Da hier außer Bytes auch 2 Words und 1 Long gespeichert
; sind (rechne mal 4 Btes für jedes), mache ich mal 36 daraus.
; Dann kommen max. 128 Felder mit einer Feldbeschreibung von
; 32 Bytes + 1 Byte (0DH) als Ende - Markierung.
; somit wäre das 36 + (128 * 33) = 4260 .
; Also geizen wir nicht und machen 5000 Bytes dazu
; So ist auf jeden Fall genug Speicher reserviert.
nb = nb + 5000
bereich = AllocateMemory(nb)
wbytes.l = ListviewToDbf(lhandle, bereich, nb, 0)
err.l = WriteFileQuick(@db_datei, bereich, 0, wbytes)

If err <> 0

    MessageRequester("Info !", Str(err) + "  Bytes" + Chr(13) + "in Datei " + db_datei + Chr(13) + "geschrieben !", #PB_MessageRequester_OK)

Else

    MessageRequester("Fehler !", "Operation ist fehlgeschlagen !", #PB_MessageRequester_OK)<
EndIf FreeMemory(0) Return
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
11/03/06  
 



does me sorrow, but this is no PB code, this is spaghettis

Wozu globale variables, if you quite no Proceduren verwendest. and Why verwendest You no
 
11/03/06  
 




H.Brill
Heut mach ichs too differently. The Beispielcodes I had to längerer Time
time written. wished hold only time on The speedy help, so it it to that
walk bring. can itself Yes eachone yourself zusammenbasteln.

but power Yes nothing. will be künftig nothing more write.
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
11/03/06  
 



[quote:d7a00e7ae6]but power Yes nothing. will be künftig nothing more write.[/quote:d7a00e7ae6]
the must You not so suppressed see - here becomes manchesmal someone stunned made, the only help wished - in the Grunde are it any love Humans and because it Humans are, having tappt im dunkeln too your Macken nobody is perfect
If you means again to help feel is, then institute of technology it - me has here already some helped
 
11/03/06  
 



[quote:d7dc5bb2e7=H.Brill]
but power Yes nothing. will be künftig nothing more write.[/quote:d7dc5bb2e7]
must still not same The insulting Leberwurst play
wished only avoid the diejenigen, The PB not kennen, a nauseous local win
 
11/03/06  
 




Frank
Abbing
[quote:d4d4597af7] Heut mach ichs too differently. The Beispielcodes I had to längerer Time
time written. wished hold only time on The speedy help, so it it to that
walk bring. can itself Yes eachone yourself zusammenbasteln.

but power Yes nothing. will be künftig nothing more write. [/quote:d4d4597af7]
Heinz, seh the Please not so tight. The Thomas is quick with Ner grossen tab thereby, is still nothing New.
i was very glad, that You me then The Codes available set have. and still have you got it still fine running brought.
and for me sees the code aufgeräumt from - should time my Assemblercodes see.
 
11/03/06  
 



 
- Page 2 -


Hi,
somehow observe I still that I here in the incorrect Forum be. I had adopted, Frank had whom Beispielcode prepares. therefore first thanks on Heinz for its work, so that one at least a first local over the employment list view.dll win. whether spaghettis-Code or not, is faith I, completely uninteressant. Hauptsache one has first an example and erspart itself therefore Time. How one yourself program lying in a yourself. I yourself with the whom Gosub´s big become. the were yet The times of Commondire C64 and tailor CPC. there knew one procedural Programming not yet. thereafter coming The object-oriented Programming moreover which in the extreme in C++ wiederfindet. As I said, it comes always hereon on, when one with Purebasic starting and from which Programiererlinie one comes. therefore ought to one not meckern separate at all glad his, the someone another weiterhilft. even if of/ one z.B. not correctly. write can on reason irgendwelcher illnesses or shortages, so is at all anzuerkennen, the so someone, withal the Wissens this for want of into Forum writes and even attempts one own Forum aufzubauen.hat ex. If then defined people itself then above jolly make, is the äußert pity.
OK. one ought to here but not the Topic moreover treat separate It's all right here for a trouble.

the could I zwischenzeitlich yourself solve. Heinz has the Framegadget herausgenommen, therefore comes it now to sofortigen display the clear Gadgets. what on this place evtl. none desirable would. the Gadget ought to itself to the invite the data show. very this trouble having Heinz in Purebasicforum posted. The Solution have I objectively here in the Forum found.
After the invite the data must these row erfolgen:
SendMessage_(lhandle,4138,-1,0) ;LVM_UPDATE
then attend The data. by then remaining the List view-Gadget blass. I finds, so is the behaviour the Gadgets correctly. it should itself Yes first show, if data present are.

thanks for Posts, so ought to this issue completed his.
 
11/05/06  
 



now - It's all right too yet differently!

You could the framegadged (i don't know really what this is as non-pbler) dispense because You the LV before one sendmessage (listviewhandle,11,0,0) send, (toggles ex the it itself draw) and thereafter one sendmessage (listviewhandle,11,1,0).

with a invalidaterect (listviewhandle,0,0), redrawwindow (listviewhandle) ought to it then done his.

accordingly should even the add the items explicit faster run out.
 
11/05/06  
 




Frank
Abbing
this is unnecessary, iF. List view.dlls CreateListview() sends already Message 11 (0) and ShowListview() becomes The Message again aufgehoben (1). any functions, The between lying, can the List view set up, without that it constantly updated becomes.
with LVM_UPDATE (4138) becomes one List view forced, itself once new aufzubauen and this is too very The for vorgesehene Message. and otherwise no.

I login me tommorrow evening, Fred.
 
11/05/06  
 



well could I Yes not know.

[quote:46fe2d090d]and otherwise no.[/quote:46fe2d090d]
clear goes redrawwindow.
 
11/05/06  
 




Fred
Matthiesen
instead of whom Sendmessage-commands To take can subesquent commands using:
CompileMarkSeparation
has The same effect and is straight for Beginner verständlicher, because it this commands in the Help nachlesen can
 
SUSE 10.3 / Listview.dll
04/04/07  
 




Frank
Abbing
The using The Message too. ex the next Version any functions in the Inc-File solid in the Dll eigebaut (too with Description) and stand there also others Languages available.
 
04/04/07  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.395 Views

Untitledvor 0 min.
Peter Max Müller10/29/17
Michael W.07/04/16
Bernd Lies08/22/13

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie