Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Hints on compiling Win32::GUI::Header

by tomsell (Acolyte)
on Jan 06, 2013 at 12:41 UTC ( #1011881=perlquestion: print w/ replies, xml ) Need Help??
tomsell has asked for the wisdom of the Perl Monks concerning the following question:

Still pursuing a solution to my ListView problem, I'm having mild forms of success by using a Win32::GUI::Header placed on top of the default header created by ListView->InsertColumn.

Alas, all dedicated Win32::GUI::Header events (BeginTrack, EndTrack, Track, DividerDblClick, ItemClick and ItemDblClick) fail to work as the XS code is never reached. The root cause of this seems to be the negative API event numbers starting at -300 (HDN_FIRST).

I'm using Strawberry Perl 5.16 and the MingW commctrl.h header file defines this as:

#define HDN_FIRST (0U-300U)

I found by debugging the XS that the cases in the switch statement

switch (nmh->hdr.code) { case HDN_BEGINTRACK :

never match. Replacing e.g. HDN_BEGINTRACK with the numeric "-326" makes it work. Now, I can brute-force things by inserting

#define HDN_FIRST -300 #define HDN_BEGINTRACK (HDN_FIRST-26)

into Header.xs and live with the compiler warnings. But that's just ugly.

Another workaround would be using the standard events "onMouseDown", "onMouseUp" etc. and compute the relevant information. But that seems ugly, too.

I'm not a C person and therefore wonder if there's a way to tell gcc to compile "0U-300U" into something that ends up being effectively -300 in the object code.

Any hints on how to deal with this? Should I file a bug report with the maintainers?

Comment on Hints on compiling Win32::GUI::Header
Select or Download Code
Re: Hints on compiling Win32::GUI::Header
by BrowserUk (Pope) on Jan 06, 2013 at 16:00 UTC
    if there's a way to tell gcc to compile "0U-300U" into something that ends up being effectively -300 in the object code.

    Eeek! Subtracting an unsigned integer from unsigned zero to derive an negative (signed) integer is just weird!

    #define HDN_FIRST -300 #define HDN_BEGINTRACK (HDN_FIRST-26) into Header.xs and live with the compiler warnings. But that's just ugly.

    If that works and the only concern is the compiler noise, perhaps you can shut them up by preceding your #defines with:

    #undef HDN_FIRST #define HDN_FIRST -300 #define HDN_BEGINTRACK (HDN_FIRST-26)

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1011881]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-07-30 02:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls