English
Forum

wish: ListBox OwnerDraw SubClass

 
my question on Andreas Miethe, what richtigerweise with working stand could, around the Painting all individual Entries the ListBox so self To take, that one hPic drawn becomes instead of z.B. the Eintragstext.
CompileMarkSeparation
 
02/20/09  
 




Andreas
Miethe


Hello @IF

have another small Problem started by Interpreter, time ne small interval make, usually helps the.
CompileMarkSeparation
Header-Dateien
 $H windows.ph
 $H messages.ph
Strukturen
Struct RECT = Left&,Top&,Right&,Bottom&
Struct DRAWITEMSTRUCT = CtlType&,CtlID&,itemID&,itemAction&,itemState&,hwndItem&,hDC&,rcItem!RECT,itemData&
Declare lpdis#,Rect#,h&
Dim lpdis#,DRAWITEMSTRUCT
Dim Rect#,RECT
var hPic&=create(hNewPic,15,15,$1278FF)
cls ~GetSysColor(~COLOR_BTNFACE)
subClass %hwnd,1
h& = Control(LISTBOX,,~WS_BORDER | ~WS_CHILD | ~WS_VISIBLE | ~LBS_OWNERDRAWFIXED | ~LBS_HASSTRINGS | ~LBS_STANDARD ,10,10,200,200,%hwnd,0,%hInstance,0)
SendMessage(h&, ~LB_SETITEMHEIGHT,0,Makelong(18,0))
Var Item& = AddString(h&,Hallo Welt)
SendMessage(h&,~LB_SETITEMDATA,Item&,hPic&)
Item& = AddString(h&,Hallo Welt 2)
SendMessage(h&,~LB_SETITEMDATA,Item&,hPic&)
AddString(h&,Hallo Welt 3)
Warum geht es mit dem Interpreter erst, wenn ich in die Listbox klicke ?
Als Kompilat funktioniert es !
Habe ich heute ein Brett vorm Kopf ?
Var Ende& = 0

Whilenot Ende&

    WaitInput

EndWhile

end

SubClassProc

    If SubClassMessage(%hwnd,~WM_DRAWITEM)

        lpdis# = &slParam
        Var Text$ = GetString$(lpdis#.hwndItem&,lpdis#.itemID&)
        Var hbmpPicture& = SendMessage(lpdis#.hwndItem&,~LB_GETITEMDATA, lpdis#.itemID&,0)
        Var hdcMem& = ~CreateCompatibleDC(lpdis#.hdc&)
        Var hbmpOld& = ~SelectObject(hdcMem&, hbmpPicture&)
        lpdis#.rcItem!left&= lpdis#.rcItem!left& + 20
        Rect#.Left& = lpdis#.rcItem!left&
        Rect#.Top& = lpdis#.rcItem!Top&
        Rect#.Right& = lpdis#.rcItem!Right&
        Rect#.Bottom& = lpdis#.rcItem!Bottom&
        ~DrawText(lpdis#.hdc&, Addr(Text$), Len(Text$), Rect#,0)
        ~BitBlt(lpdis#.hdc&, lpdis#.rcItem!left&-20, lpdis#.rcItem!top&, lpdis#.rcItem!right& - lpdis#.rcItem!left&,lpdis#.rcItem!bottom& - lpdis#.rcItem!top&, hdcMem&, 0, 0, ~SRCCOPY)
        ~SelectObject(hdcMem&, hbmpOld&)
        ~DeleteDC(hdcMem&)
        Set(WinProc, 1)

    EndIf

ENDPROC

 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
02/21/09  
 



Wow dankesehr Schonmal - so see I on each drop as virtual is.

if I something to that Interpreter herausfind...
 
02/21/09  
 




Jörg
Sellmeyer
by me knallts here:
CompileMarkSeparation
~DrawText(lpdis#.hdc&, Addr(Text$), Len(Text$), lpdis#.rcItem,0)
>

ca. row 42
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
02/21/09  
 




Andreas
Miethe


Jörg Sellmeyer
by me knallts here:
CompileMarkSeparation
~DrawText(lpdis#.hdc&, Addr(Text$), Len(Text$), lpdis#.rcItem,0)
>

ca. row 42


Hello Jörg,

the shining on the direct Übergabe the Rechteckstruktur in the Drawitem-structure To lying.
HH having too the trouble with Ownerdraw-Menüs. Why the by me works and with andern not ? in a.
have whom code dahingehend abgeändert, ought to now functions.
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
02/22/09  
 




Jörg
Sellmeyer
I had not yet 11.1 on it! Steoll still again whom originalen code mere - Perhaps lying it on it.
@Horst - which Version have You?
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
02/22/09  
 




Andreas
Miethe


Hello Jörg,

here again the Original.
CompileMarkSeparation
Header-Dateien
 $H windows.ph
 $H messages.ph
Strukturen
Struct RECT = Left&,Top&,Right&,Bottom&
Struct DRAWITEMSTRUCT = CtlType&,CtlID&,itemID&,itemAction&,itemState&,hwndItem&,hDC&,rcItem!RECT,itemData&
Declare lpdis#,Rect#,h&,WP#
Dim lpdis#,DRAWITEMSTRUCT
var hPic&=create(hNewPic,15,15,$1278FF)
cls ~GetSysColor(~COLOR_BTNFACE)
subClass %hwnd,1
h& = Control(LISTBOX,,~WS_BORDER | ~WS_CHILD | ~WS_VISIBLE | ~LBS_OWNERDRAWFIXED | ~LBS_HASSTRINGS | ~LBS_STANDARD | ~LBS_NOTIFY,10,10,200,200,%hwnd,0,%hInstance,0)
SendMessage(h&, ~LB_SETITEMHEIGHT,0,Makelong(18,0))
Var Item& = AddString(h&,Hallo Welt)
SendMessage(h&,~LB_SETITEMDATA,Item&,hPic&)
Item& = AddString(h&,Hallo Welt 2)
SendMessage(h&,~LB_SETITEMDATA,Item&,hPic&)
AddString(h&,Hallo Welt 3)
Warum geht es mit dem Interpreter erst, wenn ich in die Listbox klicke ?
Als Kompilat funktioniert es !
Habe ich heute ein Brett vorm Kopf ?
Var Ende& = 0

Whilenot Ende&

    WaitInput

EndWhile

end

SubClassProc

    If SubClassMessage(%hwnd,~WM_DRAWITEM)

        lpdis# = &slParam
        Var Text$ = GetString$(lpdis#.hwndItem&,lpdis#.itemID&)
        Var hbmpPicture& = SendMessage(lpdis#.hwndItem&,~LB_GETITEMDATA, lpdis#.itemID&,0)
        Var hdcMem& = ~CreateCompatibleDC(lpdis#.hdc&)
        Var hbmpOld& = ~SelectObject(hdcMem&, hbmpPicture&)
        lpdis#.rcItem!left&= lpdis#.rcItem!left& + 20
        ~DrawText(lpdis#.hdc&, Addr(Text$), Len(Text$), lpdis#.rcItem,0)
        ~BitBlt(lpdis#.hdc&, lpdis#.rcItem!left&-20, lpdis#.rcItem!top&, lpdis#.rcItem!right& - lpdis#.rcItem!left&,lpdis#.rcItem!bottom& - lpdis#.rcItem!top&, hdcMem&, 0, 0, ~SRCCOPY)
        ~SelectObject(hdcMem&, hbmpOld&)
        ~DeleteDC(hdcMem&)
        Set(WinProc, 1)

    EndIf

ENDPROC

 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
02/22/09  
 




Jörg
Sellmeyer
Mh - strange. in the Interpreter knallts not, in compilierter shape already. though shows by me The Runtime still 11.0 on and the Interpreter 11.1, though I any Files from the last(?) Update of 2.12. on it have.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
02/22/09  
 




Andreas
Miethe


then is what schiefgelaufen with Your Update. my Runtime shows correctly 11.1 on.

Dateidatum Runtime, Interpreter and Compiler 26.11.2008 11:01
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
02/22/09  
 




Jörg
Sellmeyer
OK - now Have ichs too. having forget into Projekteinstellungen the new Runtime anzugeben. Runs means except for The Interpreter-/Runtime-Seltsamigkeit, The You supra erwähnt have.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
02/22/09  
 



the example shows, that it pity is, that The SubClassProc only WaitInput clutching.

go in the Programmablauf first of all The Listboxes created and befüllt, wonach then The Hauptschleife with WaitInput access becomes.

because The Messages lost are, go first of all no Items displayed.

446 kB
Kurzbeschreibung: without nachträgliches Anschubsen
Hochgeladen:03/02/09
Downloadcounter103
Download
446 kB
Kurzbeschreibung: with nachträglichem Anschubsen
Hochgeladen:03/02/09
Downloadcounter77
Download
448 kB
Kurzbeschreibung: nachträgliches Anschubsen sometimes wirkungslos
Hochgeladen:03/02/09
Downloadcounter96
Download
 
03/02/09  
 



Hmpf, even if I z.B. wm_drawItem additional as UserMessage deklariere circa the Hauptschleife mitzuteilen, that in ListBoxen Entries to drawing wären, then sustain I (naturally) weder in uwnd, ulparam yet uwparam a brauchbare Info - so I new draw could.

might one _nur inside the subClassProc and inside the waitInput addString indicate so The Entries too showing. :/

I teste time, whether one wm_command as UserMessage benefit can - ought to Yes with lbs_notfiy shipped go with lever the ListBox in the ulParam.

Nachtrag: wm_command won't triggered of addString - ldr. (too) no Solution.
 
03/02/09  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

11.673 Views

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