English
Forum

GridBOX & CUSTOMDRAW by SubClassing

 

Uwe
''Pascal''
Niemeier
Hi people!

somehow Have I in momentum one shelf before the head...

i want my CUSTOMDRAW-routine for ListViews on XProfan11-SubClassing adjust, come but lest clear...
apparently werdne The values for LvDraw#.DrawStage& not correctly. staid.

here the code for ProcAddr-Variante (Minimal-demonstration):
CompileMarkSeparation
window 10,10-200,200
 $H Messages.ph
 $H Windows.ph
 $H Commctrl.ph

proc HdlgLvColorProc----------------------------HdlgLvColorProc-------------------------

    parameters wnd&,msg&,wparam&,lparam&
    case msg&<>~WM_NOTIFY:return ~CallWindowProc(HdlgProc&,wnd&,msg&,wparam&,lparam&)
    LvDraw#=Lparam&
    case LvDraw#.Hwndfrom& <> Lv&:return ~DefWindowProc(wnd&,msg&,wparam&,lparam&)
    case LvDraw#.Code&<>~NM_CUSTOMDRAW:return ~DefWindowProc(wnd&,msg&,wparam&,lparam&)
    case LvDraw#.DrawStage& = ~CDDS_PREPAINT :return ~CDRF_NOTIFYITEMDRAW
    case LvDraw#.DrawStage& = ~CDDS_ITEMPREPAINT:return ~CDRF_NOTIFYSUBITEMDRAW

    if LvDraw#.DrawStage& = ~CDDS_SUBITEM | ~CDDS_ITEMPREPAINT

        LvDraw#.Textbk&=rgb(25,255,255)

    endif

    return ~CDRF_DODEFAULT
    endproc---------------------------------------------------------------------------------
    var Lv&=create(gridbox,%hwnd,Test,0,10,10,150,100)
    addstring(Lv&,Test)
    declare LvDraw#
    struct LvDraw= HwndFrom&,idFrom&,Code&,DrawStage&,Hdc&,Rect#(16),ItemSpec&,ItemState&,ItemLparam&,Text&,Textbk&,SubItem&
    dim LvDraw#,LvDraw
    Set(FastMode,1)
    var HdlgProc&=~SetWindowLong(%hwnd,~GWL_WNDPROC,procaddr(HdlgLvColorProc,4) )
    ~RedrawWindow(Lv&,0,0,$485)

    while 1

        waitinput

    endwhile


though goes from the Help not clear forth, what happens, if The SubClassProc per Return leave becomes, where The thereby angegebenen values transfer and be which strain Set(WinProc,X)
in the drop game


hope on Help
Pascal
 
03/01/09  
 



Sub-Topic: List view-Customdraw with Subclassing: so geht's  [...]  created.
 
05/22/18  
 




Jens-Arne
Reumschüssel
here The Solution:
'GridBOX(=ListView)-CustomDraw-example
 $H windows.ph
 $H messages.ph
 $H commctrl.ph
STRUCT NMHDR=hwndFrom&,idFrom&,code&
STRUCT NMCUSTOMDRAW=NMHDR,dwDrawStage&,hdc&,rcLeft&,rcTop&,rcRight&,rcBottom&,dwItemSpec&,uItemState&,lItemlParam&
STRUCT NMLVCUSTOMDRAW=NMCUSTOMDRAW,clrText&,clrTextBk&,iSubItem&,dwItemType&,clrFace&,iIconEffect&,iIconPhase&,iPartId&,iStateId&,rcTextLeft&,rcTextTop&,rcTextRight&,rcTextBottom&,uAlign&
declare _hGB%,_hBende%,_ende%

SUBCLASSPROC

    declare b#,lParam&,ret&

    if &sWnd=%HWnd

        if %sMessage=~WM_NOTIFY

            lParam&=&sLParam
            dim b#,NMLVCUSTOMDRAW
            b#=lParam&

            if (b#.hwndFrom&=_hGB%) and (b#.code&=~NM_CUSTOMDRAW)

                if b#.dwDrawStage&=~CDDS_PREPAINT'same becomes the List view new drawn

                    ret&=~CDRF_NOTIFYITEMDRAW'Folgemessages demand

                elseif b#.dwDrawStage&=~CDDS_ITEMPREPAINT'same becomes one Item drawn

                    'b#.clrText&=$0000FFFF '@rgb(255,255,0) 'Textfarbe the cell Change
                    'b#.clrTextBk&=$00FFFF00 '@rgb(0,255,255) 'Backgroundcolor the cell Change
                    'ret&=~CDRF_NEWFONT 'went too, then any Lines same colored, the next elseif-cut offed would then unnecessary
                    ret&=~CDRF_NOTIFYSUBITEMDRAW'Folgemessages to the draw each individual Subitems demand

                elseif (b#.dwDrawStage& & (~CDDS_ITEMPREPAINT | ~CDDS_SUBITEM))=(~CDDS_ITEMPREPAINT | ~CDDS_SUBITEM)'same becomes one Subitem drawn

                    'b#.dwItemSpec&=Zeile
                    'b#.iSubItem&=Spalte
                    b#.clrText&=@rgb(255,255,b#.dwItemSpec&*13+b#.iSubItem&*30)'Textfarbe the cell Change
                    b#.clrTextBk&=@rgb(0,200,b#.dwItemSpec&*13+b#.iSubItem&*30)'Backgroundcolor the cell Change
                    ret&=~CDRF_NEWFONT

                endif

            endif

            dispose b#

            if ret&<>0

                @set("WINPROC",0)'must his, otherwise goes's not
                return ret&'CustomDraw-specific worth give back

            endif

        endif

    endif

ENDPROC'SUBCLASSPROC

'***** Hauptprogramm
cls
_hGB%=@create("GRIDBOX",%HWnd,"Spalte 1;0;100;Spalte 2;0;100;Spalte 3;0;100;Spalte 4;0;100;Spalte 5;0;100;Spalte 6;0;100",0,0,0,@width(%HWnd),(@height(%HWnd)-40))
_hBende%=@create("BUTTON",%HWnd,"Ende",((@width(%HWnd)\2)-35),(@height(%HWnd)-30),70,20)
@set("FASTMODE",1)'otherwise goes's unfortunately not
subclass %HWnd,1'not The GridBOX subclassen, separate the Mainwindow (to there weg The WM_NOTIFY-Messages)
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
@addstring(_hGB%,"Test|TestTest|TestTestTest|Test|TestTest|TestTestTest")
_ende%=0

whilenot _ende%

    waitinput

    if @clicked(_hBende%)

        _ende%=1

    endif

endwhile

subclass %HWnd,0
@set("FASTMODE",0)
end

deference: If one many Objects subclasst and the GridBOX very big is, ought to the at the beginning the Subclassproc stand, because otherwise the Updaten the GridBOX vastly delayed go can - particularly, if one each element eachone row farblich change would like, and not only each row for itself uniform.
 
XProfan X4 * Prf2Cpp * XPSE * JRPC3 * Win11 Pro 64bit * PC i7-7700K@4,2GHz, 32 GB RAM
PM: jreumsc@web.de
05/23/18  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.547 Views

Untitledvor 0 min.
Matzbub vor 23 Tagen
Normann Strübli01/29/23
RudiB.08/30/22
Stringray01/05/22
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