Re: Irregular Windows

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

From: "Tony Steward" <tony at locksdownunder.com>
Subject: Irregular Windows


> Hi All,
> I wish to use the irreg. window routine but don't know what I have done 
> wrong. Follow is my test program which does open an oval window 

> <snip>

Hi Tony,

This is how I do it.....

       poke4(pt,0) 
       poke4(pt+4,0)  
       
       junk = c_func(xClientToScreen,{hwnd, pt}) 
       
       x = peek4s(pt) 
       y = peek4s(pt+4)

       c_proc(GetWindowRect, {hwnd,rect})

       x -= peek4s(rect_Left)
       y -= peek4s(rect_Top)

       SetWindowRgn(hwnd,CreateEllipticRgn(x+2,y,165,165))


So, you might try this:

   SetWindowRgn(ShapedWin,CreateEllipticRgn(0,0,300,100)) 

instead of this:

   Region = CreateEllipticRgn(0,0,300,100) 
   SetWindowRgn(getHandle(ShapedWin),Region) 

These are very much the same,  I just eliminate getHandle.

Also, if you looked close at my code there-in lies a trick
that will eliminate the offset given by all windows due to
the titlebar height... "The code upto SetWindowRgn, above"

Next part to be concerned with is this...

       hdc = c_func(GetDC, {hwnd})
       memdc = c_func(xCreateCompatibleDC, {hdc})
       
       hDib = createDIB(clockface2[1], clockface2[2], hdc )
       junk =  c_func(xSelectObject, {memdc,hDib}) 
                          
       c_proc(xDeleteObject, {hDib})
       c_proc(ReleaseDC, {hwnd, hdc})  

have you created an hdc and copied this to a CompatibleDC?

----

Because you use Win32lib most of this is setup already for you..

Here is the code I'd use to put the bitmap on the window in win32lib

atom Buffer
Buffer = createDIB( {pal, pixels} )

procedure Paint( integer x1, integer y1, integer x2, integer y2 )
bitBlt(ShapedWin,0,0,Buffer,x1,y1,x2,y2,SRCCOPY)
end procedure

Next, to exit the Window I would do something like this...

MyPopup = create( Popup, "", ShapedWin, 0, 0, 0, 0, 0 ),
Item1 = create( MenuItem, "Close", MyPopup, 0, 0, 0, 0, 0 )

procedure exitClock() 
closeWindow(ShapedWin ) 
end procedure

procedure menu() 
integer self
self = getSelf()
if self = Item1 then exitClock()
end if
end procedure

onClick[Item1] = routine_id("menu")

----

If this stuff doesnt help or I mis-understood the ?, let me know.
I'll try again...

Euman
euman at bellsouth.net

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

Search



Quick Links

User menu

Not signed in.

Misc Menu