Re: Derek: function subClassBitmap

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

Tommy Carlier wrote:
> 
> 
> Derek, I looked at the function subClassControl, and used it to create the
> function
> subClassBitmap. This function takes a bitmap-handle and wraps it into a
> Win32Lib Pixmap.

LOL. I just finished updating that routine to work with bitmaps, then 
I came here to announce it and found your 'answer'!

Anyhow, all I did was update the existing subClassControl routine. I
changed the line ...

           phWnd = getHandle(lParent) or -- is its own parent


to read ...
           (lParent !=0 and phWnd = getHandle(lParent)) or -- is its own parent

and changed ...

     window_handle_type[lNewId] = kht_Window

to ...

    if window_type[lNewId] = Pixmap then
        window_handle_type[lNewId] = kht_Bitmap
    else
        window_handle_type[lNewId] = kht_Window
    end if
And here is the demo program for it ...

without warning
include win32lib.ew
integer MainWin
integer myPixMap
atom bmh
MainWin = create(Window, "Subclassed bitmap", 0, 0, 0, 500, 400, 0)
bmh = loadBitmapFromFile("..\\demoresources\\java.bmp")
myPixMap = subClassControl({Pixmap, 0}, bmh)
setPenColor(myPixMap, Cyan)
drawRectangle(myPixMap, 1, 0, 0, 40, 40)

procedure Painter(integer self, integer event, sequence parms)
    copyBlt(self, 0, 0, myPixMap)
end procedure
setHandler(MainWin, w32HPaint, routine_id("Painter"))
WinMain(MainWin, Normal)

-- 
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu