Re: Win32Lib getPixel problem revised

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andy Drummond wrote:
> 
> I posted a query about getPixel() in Win32Lib recently. But when I tried 
> the test here at work I couldn't replicate the problem. Now I have.
> 
> The problem is this. I have two bitmaps. They overlay one another. I 
> click on the top, visible, one with the mouse. I can then read the value 
> of the top bitmap, which picked up the mouse events, fine. But using the 
> same coordinates for the other bitmap I get -1 returned.

<snipped sample> 

Hi Andy,

From what I can see by your example, I think your issue is that you are
 confusing a Bitmap control and a Pixmap control.  A Bitmap control is a static
 control.  With a Bitmap control, you stick a bitmap image into it, maybe handle a
 click event, and that's about it.  Windows will handle redrawing the bitmap in
 the control when it's needed.  It doesn't appear to me that you can even draw on
 a Bitmap control like your example attempts.  I believe the reason you are
 getting the -1 for 'Page' is because you declared 'Copy' after, and covering,
 'Page' and, therefore, it's not accessible.  You cannot get a pixel from
 something that can't get focus.

However, a pixmap sits in memory so you don't have to worry about that issue. 
With a Pixmap, you basically have a bitmap in memory that you can draw to and
blit to your window.  I think you can stick a pixmap into a bitmap control but I
usually just copyBlt the Pixmap to the window on repaint.

If you can give me some more details about what you are trying to do, I can
provide a better explanation with a demo but I really can't tell you how you
should proceed based on your example.

-- Brian

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu