Creating none rectangular window

BlitzMax Forums/BlitzMax Beginners Area/Creating none rectangular window

Can BlitzMax be used to create a windowed app that does not have a standard rectangular window?

Apologies if this has been answered but I could not find any referece to none rectangular windows on the Forums.

Thank You

Not being funny, but when have you seen any nonrectangular windows?

Winamp and a few other 'windowed' applications that are not rectangular.

No they are rectangular, but copy the desktop to a canvas, then copy the "distorted" image over to it, with full transparency for the bits "outside" the application.

Or simply copy the "distorted" image onto the desktop

IE, They make bits of the rectangle see though/invisable

But they only respond to mouse activity within their own space not their default rectangle?

Anyway is there a way to do this "distorted" image thing in BlizMax?

Regards

it should actually be simple for mark to add it in win2k/xp but thats probably why he wont, it wouldnt be cross platform.

Try.
Make a canvas, attached to the desktop, set transparacy, (Using setalpha, and setblend) and see.

You can easily ignore mouse activity that is outside of a given area by doing per-pixel collision checks.

I also agree that most windows will be actually rectangular and copy what is beneath them. That said, what if you move a window underneath/behind a non-rectangular window? Will it update in the corners?

You can set an Alpha value for gadgets... does this apply to windows?

OK I've managed to get the border to go transparent but the main window area stays opaque...

Extern "win32"
   Function GetActiveWindow%()
   Function ShowWindow(hWnd , state)
   Function SetWindowLongA(hWnd, nIndex, dwNewLong)
   Function SetLayeredWindowAttributes(hwnd, crKey, bAlpha, dwFlags)	
EndExtern

Graphics(320,180,0)

Local win=GetActiveWindow()
ShowWindow(win,False)

Const GWL_STYLE = -16
Const GWL_EXSTYLE = $FFFFFFEC

Const WS_BORDER = $800000
Const WS_EX_LAYERED = $80000
Const WS_CAPTION =$C00000
Const SWP_FRAMECHANGED = $0020
Const SWP_SHOWWINDOW = $0040
Const SWP_HIDEWINDOW = $0080


Local old:Int=GetWindowLongA(win,GWL_STYLE)

Local newstyle:Int = old & WS_EX_LAYERED


Local style:Int=SetWindowLongA(win,GWL_EXSTYLE,newstyle)

SetWindowPos(win , HWND_TOP , 100 , 100 , 320 , 180 , SWP_FRAMECHANGED | SWP_HIDEWINDOW) ; 

SetWindowLongA(win, -20,  $80000)

SetLayeredWindowAttributes(win, 0,100,2)

ShowWindow(win , 1)

SetAlpha(0.5)

Repeat

	DrawText "What No Borders",0,0 

Flip()

Until KeyHit(KEY_ESCAPE)

End


Note that the code is based on some snippets dragged together so I could be missing the point here, can anyone provide additional help/guidance/advice?

Regards

I would have gone for using DeskTop:TGadget, and putting a canvas on that

Is it possible to add a canvas with Desktop() as the parent group, without a window?

I dont know, thats just how I would find out, if I wanted to know

there are winapi commands that allow you to set the clipping rect of a window to polygon, thus allowing non-rectangular windows.

SetWindowRegion I think it is.

TheCodeProject.com had something as using a bitmap to make a non-rectangular window in C# with the Windows API and BlitzSys has it too (But it is Blitz3D). So it is possible :]

it should actually be simple for mark to add it in win2k/xp but thats probably why he wont, it wouldnt be cross platform.


What?? Should be possible on all 3 platforms = cross platform

One good example in linux = Mplayer

I'm not that sure, that Cocoa allows this kind of stuff at all as it has the by far most restrictive rules on what is allowed in GUI (like buttons can't be oversized etc).

is that on mac?

Yes

It's have to work on all three platforms for brl to add it.

Because buffered windows are required for transparency or non-rectangular shapes, almost all Cocoa windows are buffered. Nonretained windows are appropriate for transitory images or simple connection lines, such as are used in Interface Builder for target-action connections.


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CoreAppArchitecture/chapter_7_section_4.html

Anything is possible ;)