English
Forum

Ownerdraw List view

 

Normann
Strübli
Hello Frank, Hello Community,

I bastel straight in a List view which Bargraphen and Images include can.
(was indeed already time somewhere demand )
this code is solely one beginning but can and should with Eurer Help weiterentwickelt go.
unfortunately have I it too not yet auskommentiert, but so heavy is it mean so did i not To understand.

I hope though Frank of it convincing to so a function in its List view with aufzunehmen ;D
as attachment have I time Vorlagen The with masm program are enclosed. -best time angucken
The Examples are too as ausführbare File present. FRANK BITTE GUCK DIR DAS AN!!!

same another question:
I have the List view whom LVS_OWNDERDRAWFIXED   Style missed, there Yes otherwise no wm_drawitem
message on the Elternfenster gesand becomes. Can it hinbekommen the only of/ one slot these Message
sent becomes, then should one not the complete control self draw?!...

Greeting
Normann
CompileMarkSeparation
 $H Windows.ph
 $H Structs.ph
 $H Messages.ph
 $H Commctrl.ph
 $H Structs.ph
Set(FastMode,1)
Def Hiword(1) And(&(1)>>16,$Ffff)
Def Loword(1) And(&(1),$Ffff)
declare test&,itemtext$
itemtext$ = TestItem
Struct Hd_notify = ~Hd_notify
Declare Hd_notify#
Dim Hd_notify#,Hd_notify
Struct NMHDR = ~NMHDR
Declare NMHDR#
Dim NMHDR#,NMHDR
Struct DRAWITEMSTRUCT = ~DRAWITEMSTRUCT
Declare DRAWITEMSTRUCT#
Dim DRAWITEMSTRUCT#,DRAWITEMSTRUCT
Struct Rect = ~Rect
Declare Rect#
Dim Rect#,Rect
struct TWindowClass = ~WndClass
struct TMsg = ~Msg
declare WindowClass#, Msg#
declare AppName$
 $I Listview_Funktionen.inc
Declare lvdll&
lvdll&=usedll(Listview.dll)
AppName$ = Listview Test

proc WindowProc

    parameters Window&, Message&, WParam&, LParam&

    If Message& = ~Wm_notify

        NMHDR# = Lparam&

        if NMHDR#.hwndfrom& = listview&

            if NMHDR#.code& = ~NM_KILLFOCUS  Das Control hat den Focus verloren

            elseif NMHDR#.code& = ~NM_SETFOCUS  Das Control hat den Focus bekommmen

            elseif NMHDR#.code& = ~NM_CLICK  Der Anwender hat die linke Maustaste im Control geklickt

            elseif NMHDR#.code& = ~NM_DBLCLK  Der Anwender hat die linke Maustaste im Control doppel-geklickt

            elseif NMHDR#.code& = ~NM_OUTOFMEMORY  Das Control konnte die Aktion Aufgrund zu wenig Speicher nicht ausführen

            elseif NMHDR#.code& = ~NM_RCLICK  Der Anwender hat die rechte Maustaste im Control geklickt.

            elseif NMHDR#.code& = ~NM_RDBLCLK  Der Anwender hat die rechte Maustaste im Control doppel-geklickt.

            elseif NMHDR#.code& = ~NM_RETURN  Der Anwender hat die ENTER-Taste im Control gedrückt

            elseif NMHDR#.code& = ~LVN_COLUMNCLICK  Das Control hat den Focus bekommmen

            Endif

        endif

    endif

    if Message& = ~wm_drawitem

        if Wparam& = listviewid&

            DRAWITEMSTRUCT# = lparam&
            Long Rect#,0 = Long(DRAWITEMSTRUCT#,28)
            Long Rect#,4 = Long(DRAWITEMSTRUCT#,32)
            Long Rect#,8 = Long(DRAWITEMSTRUCT#,36)
            Long Rect#,12 = Long(DRAWITEMSTRUCT#,40)

            If And(Long(Lparam&,16),1)

                ~SelectObject(DRAWITEMSTRUCT#.Hdc&,~CreateSolidBrush(@RGB(200,0,0)))
                ~SetBkColor(DRAWITEMSTRUCT#.hdc&,@RGB(100,100,200))

            else

                ~SetBkColor(DRAWITEMSTRUCT#.hdc&,@RGB(200,200,200))
                ~SelectObject(DRAWITEMSTRUCT#.Hdc&,~CreateSolidBrush(@RGB(0,200,0)))

            endif

            ~Exttextout(DRAWITEMSTRUCT#.Hdc&,rect#.left&,rect#.top&,~Eto_OPAQUE,Rect#,Addr(Itemtext$),Len(Itemtext$),0)
            ~Rectangle(DRAWITEMSTRUCT#.Hdc&,120,rect#.top&,120 + rect#.top&,rect#.bottom&)

        endif

    endif

    if Message& = ~wm_Destroy

        CloseProc
        ~PostQuitMessage(0)
        END

    endif

    return ~DefWindowProc(Window&, Message&, WParam&, LParam&)

endproc

proc WinMain

    declare Window&, Message&
    dim WindowClass#,TWindowClass
    dim Msg#,TMsg

    with WindowClass#

        .style& = 0
        .lpfnWndProc& = ProcAddr(WindowProc,4)
        .cbClsExtra& = 0
        .cbWndExtra& = 0
        .hInstance& = %HInstance
        .hIcon& = ~LoadIcon(0,~idi_Information)
        .hCursor& = ~LoadCursor(0, ~idc_Arrow)
        .hbrBackground& = ~GetStockObject(~white_Brush)
        .lpszMenuName& = Addr(AppName$)
        .lpszClassName& = Addr(AppName$)

    endwith

    if ~RegisterClass(WindowClass#) = 0

        ~MessageBox(0,Fenster konnte nicht registriert werden!,Fehler,0)
        end

    endif

    Window& = ~CreateWindowEx(
    0,
    Addr(AppName$),
    Addr(AppName$),
    ~ws_OverlappedWindow,
    ~cw_UseDefault,
    ~cw_UseDefault,
    ~cw_UseDefault,
    ~cw_UseDefault,
    0,
    0,
    %HInstance,
    0)
    ~ShowWindow(Window&, ~sw_ShowNormal)
    ~UpdateWindow(Window&)
    InitMessages(Window&)
    Declare listview&,ListviewId&,Column$
    Listview& = CreateListview(Window&,%HInstance,0,-1,-1,$23)
    ~SetWindowLong(Listview&,~GWL_STYLE,@Or(~Getwindowlong(Listview&,~GWL_STYLE),~LVS_OWNERDRAWFIXED))
    ~Setprop(Listview&,OldCallback,~Setwindowlong(Listview&,~Gwl_wndproc, Procaddr(Listviewcallback,4)))
    ListviewId& = ~Getwindowlong(Listview&,~GWL_ID)
    Autosortlistview Listview&,1,1,1,1,2,2
    Column$ = Column 1
    IColumn(Listview&,addr(Column$),120,0)
    Column$ = Column 2
    IColumn(Listview&,addr(Column$),120,0)
    Column$ = Column 3
    IColumn(Listview&,addr(Column$),120,0)
    Declare bereich#,text1$,text2$,text3$
    dim bereich#,1000
    text1$=Neues_Item 1
    text2$=Neues_Item 2
    text3$=Neues_Item 3
    long bereich#,0=addr(text1$)
    long bereich#,4=addr(text2$)
    long bereich#,8=addr(text3$)

    WhileLoop 8

        SItem(listview&,bereich#,3)

    EndWhile

    Showlistview(Listview&,32,32,500,400)
    Dispose bereich#

    while ~GetMessage(Msg#, 0, 0, 0) > 0

        ~TranslateMessage(Msg#)
        ~DispatchMessage(Msg#)

    endwhile

    end

endproc

WinMain

Proc Listviewcallback

    Parameters Wnd&, Msg&, Wparam&, Lparam&

    If Msg& = ~Wm_notify

        NMHDR# = Lparam&

        If (NMHDR#.code& = ~Hdn_begintrackw) OR (NMHDR#.code& = ~Hdn_DIVIDERDBLCLICKw) Die HDN_BeginTrack Botschaft abfangen und löschen!

            Hd_notify# = Lparam&

            if (Hd_notify#.iButton& = 0) OR (Hd_notify#.iButton& = 1)

                Return 1

            Endif

        Endif

    Endif

    Return ~Callwindowproc(~Getprop(Wnd&,OldCallback),Wnd&, Msg&,Wparam&,Lparam&)

Endproc

Proc Closeproc

    Clo
ages(window&) $I Listview_dispose.inc endproc

272 kB
Hochgeladen:11/03/05
Downloadcounter147
Download
 
11/03/05  
 




Frank
Abbing
Hi,

No, Ownerdraw comprising any things. either or. only one little is not.
your things seh I me tommorrow on. must same go to that office party
 
11/03/05  
 




Normann
Strübli
Hi,

@Frank: I hope you have The celebration schadenfrei überstanden

I werd yet demented with the Owerdraw-story Please help me !!!

the following trouble:

The WM_DRAWITEM -Message becomes always only once per row sent, The SubItems must Yes but
too new drawn and be very there missing me the right Lösungsansatz.

now read in a Loop each Split from, but this is now really not optimal...

Please schaut you the example once on and give me something Hilfestellung How I it rather solve can.

4 kB
Kurzbeschreibung: Ownerdraw List view -Lösungsansatz
Hochgeladen:11/09/05
Downloadcounter137
Download
 
11/08/05  
 




Frank
Abbing
Hello Normann,

Yes, The celebration was well.
my computer was but in Reparatur and behave itself still something strange. i'm not yet To your things come. tommorrow, hope I.
 
11/08/05  
 




Normann
Strübli
Hi,

new Version, Please testing! (now without same a Farbflash To get)
ought to itself now like a integrally normales List view-Control behaviour.

The benefit is z.B. the The Backgroundcolor the selektierten row always discernible remaining

Greeting
Normann

here maln Screenshot:

95 kB
Hochgeladen:11/09/05
Downloadcounter281
Download
 
11/09/05  
 




Frank
Abbing
Hi,

Normann, poste here too time your ph-Files. I get a Error Message and kanns not testing.

The Assembler.dll knew I already. If I correctly. remember, is tappt im dunkeln but never ready become.
Why should I The Dll-functions because for List view.dll umsetzen, if You The additional Dll already have? Kombiniere still simply both Dlls.
 
11/09/05  
 




Normann
Strübli
Aarrghh!!!

is correct The Structs.ph has a Error, here The corrected version.

13 kB
Hochgeladen:11/09/05
Downloadcounter146
Download
 
11/09/05  
 




Frank
Abbing
Hi,

ok, habs tested.
but what bezweckst You now so? What exactly want You of me? want You beam and Torten in Listviews?
 
11/09/05  
 




Michael
Wodrich
at least still The beam. can I me as Prozentbalken with one File-Downloader well present. Since there it with safety many Opportunities.

Best wishes
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
11/09/05  
 




Normann
Strübli
Hello Frank,

i want really (meanwhile) so bezwecken I to langer Time time with the X-menu bezweckt have.
One List view-Control complete whom own Bedürfnissen anzupassen.
original wished I Yes only a Balkenanzeige install, there this not so without weiters functions has, have I
I with the Ownerdraw-List view engage, and so I ment then moreover...

an Support of z.B. Bargraphen of your Dll would a super thing, I faith so think not
only Michael what about me.

my Ansatz should a Nischenlösung his for denjenigen the even yet something other as Text- or icons in
whom Lines stand having would like, what Yes theroretisch so already functions.
(z.B. Bitmaps, Graphen, mehzeilige boxes etc...)

your Dll can the naturally not supplant and should the interested only time aufzeigen the so a pretty
bunte List view too in reinem (X-)Profan To erschaffen is.

my Hauptproblem is now The speed with the whole story, and there was my question
How I my code- particularly with the Abarbeitung the Wm_notify-Message optimize and faster can make.
and who has there More Idea of tables as You, Frank

As I said for your List view.dll would the I vorhabe To individually, and I the whole now To foot erledige
would I for each hint grateful How I the whole can optimize...

More wished I still none
 
11/09/05  
 




Normann
Strübli
@Frank:

apiece longer I with the List view-story engage umso More Problems yield itself there
now have I The Sort Lines with Help the XPIA completed and times one comparison with
your List view.dll made.
with ca. 20.000 Einträgen lasts it with of my Variante still stolze 21 sec, with the Listviev.dll
only concise 3 sec. (means ca. 10time faster)
This will Yes certainly by the limp appeal of Profan come.

there in of my list but certainly 13.000 Entries present his go, have I me The whole work well
umsonst made -but at least have I plenty dazugelernt.

means have your List view.dll quick again eingebunden, unfortunately weg now The Zeilenfarben after a Sorting flöten.
is indeed clear I the lParam& member of LV_ITEM# moreover mißbraucht have The Farbinformationen for suitable row To Save.
You using richtigerweise the value of lParam circa to the Sorting whom new index the Lines To Save.

But if I not any more white which row to the Sorting whom index has, and the commands Raise Line on
only 1024 Lines beschränk is must I well begin To Zaubern circa of/ one row a eindeutigen Farbwert zuzuordnen
the independent of the Sorting is.
somewhere have You Schonmal on a question answered:
[quote:06c4627aa6]If you Lines einfügst and want, the The coloured Mark mitwandert, must You the yourself program.[/quote:06c4627aa6]
to that Happiness is the Superdupieinfach

...No, I have no idea!
Irgendeinen suggestion??? *verzweifel*

Greeting
Normann
 
11/12/05  
 




Normann
Strübli
Have I yet forget:

Frank, can You Perhaps a function install around the Zeilenhöhe einzustellen?
or white jmd. How the with of/ one List view functions???
 
11/12/05  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

9.523 Views

Untitledvor 0 min.
Andre Rohland06/16/19
Member 154727709/23/18
Michael W.07/04/16
Ernst05/04/16
More...

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