I thought it would be nice to have a round splash screen when the user launches an application.
In Xojo I can’t do that, because if I write the code for transparent windows, everything on the window gets transparent.
So I wrote the code with another IDE product for Macintosh which does the work. But instead of having one app, I have two apps now. I want to get rid of the splash screen app…
How can I have a round or oval window in Xojo? Is there a way?
Haha That’s a very good idea. I already have more than half a dozen MBS plugins. Before I have more plugins, I wanted to know if there is a native solution to it
For a transparent background you set Opaque off and the background color clear. This is the method I use. If calling from the Windows open event just pass in self. If calling at some later time also pass in true and it’ll fix the shadows. Then for a custom background draw in the Windows paint event and you can even use semi-transparent colors and it’s see through with corresponding shadow.
[code]Shared Sub makeWindowTransparent(aWindow As Window, forceDisplay As boolean = false)
if aWindow = nil then return
const CocoaLib = “Cocoa.framework”
soft declare function NSClassFromString lib CocoaLib (aClassName as CFStringRef) as Ptr
soft declare function colorMaker lib CocoaLib selector “colorWithCalibratedWhite:alpha:” (NSColorClass As Ptr, white As Single, alpha As Single) As Ptr
soft declare sub setBGColor lib CocoaLib selector “setBackgroundColor:” (NSWindow As Ptr, backgroundColor As Ptr)
soft declare sub setOpaque lib CocoaLib selector “setOpaque:” (NSWindow As Ptr, flag As Byte)
if forceDisplay then
soft declare sub invalidateShadow lib CocoaLib selector “invalidateShadow” (NSWindow As Ptr)
soft declare sub disp lib “AppKit” selector “display” (windRef As Ptr)
disp(w)
invalidateShadow(w)
end
End Sub
[/code]
There’s an example that comes with Xojo (in Example Projects\\Platform-Specific\\Windows\\CustomWindowShape) that demonstrates masking a window to a shape defined in a Picture; and the Windows Functionality Suite has code to set the alpha/transparency of a window.
I’m not able to find TransparencyMBS in your docu (just tons of listarchive entries). I obviously am missing something here, because I don’t know on how to make my example (splash.zip) work on Windows, using your plugins.
Could you help with a link to a Windows example and/or a link to the specific docu?
[quote]Shared Sub makeWindowTransparent(aWindow As Window, forceDisplay As boolean = false)
if aWindow = nil then return
const CocoaLib = “Cocoa.framework”
soft declare function NSClassFromString lib CocoaLib (aClassName as CFStringRef) as Ptr
soft declare function colorMaker lib CocoaLib selector “colorWithCalibratedWhite:alpha:” (NSColorClass As Ptr, white As Single, alpha As Single) As Ptr
soft declare sub setBGColor lib CocoaLib selector “setBackgroundColor:” (NSWindow As Ptr, backgroundColor As Ptr)
soft declare sub setOpaque lib CocoaLib selector “setOpaque:” (NSWindow As Ptr, flag As Byte)
if forceDisplay then
soft declare sub invalidateShadow lib CocoaLib selector “invalidateShadow” (NSWindow As Ptr)
soft declare sub disp lib “AppKit” selector “display” (windRef As Ptr)
disp(w)
invalidateShadow(w)
end
End Sub[/quote]
Hello,
how do i use it for a window?
I tested this 3 variants but nothing works (getting errors of wrong calls)
self.makeWindowTransparent
self.makeWindowTransparent aWindow
self.makeWindowTransparent forceDisplay As boolean = false