Round Transparent Window?

  1. ‹ Older
  2. 4 years ago

    Oliver O

    6 Oct 2013 Pre-Release Testers, Xojo Pro https://seminar.pro

    @ChristianSchmitz Well, we have OverlayMBS class in our plugins to do this...

    I'm using MakeTransparentMBS for a SplashScreen on OSX, but it does not seem to work on Windows, the window is not becoming transparent …

    https://forum.xojo.com/1874-the-easiest-way-i-ve-found-to-make-a-splash-screen/p1#p18183

  3. Christian S

    6 Oct 2013 Pre-Release Testers, Xojo Pro Germany

    Of course not. MakeTransparentMBS on Windows first enables the use of the TransparencyMBS property.

  4. Oliver O

    6 Oct 2013 Pre-Release Testers, Xojo Pro https://seminar.pro

    @ChristianSchmitz Of course not. MakeTransparentMBS on Windows first enables the use of the TransparencyMBS property.

    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?

  5. Christian S

    6 Oct 2013 Pre-Release Testers, Xojo Pro Germany

    I'm sorry, but on Windows things are different.
    You would need to use OverlayMBS class and not a Xojo window.

  6. 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)

    dim w As Ptr = Ptr(aWindow.Handle)

    setOpaque(w, 0) //0 = off, 1 = on

    setBGColor(w, colorMaker(NSClassFromString("NSColor"), 1, 0))

    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

    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

    Thanks

  7. Beatrix W

    20 Nov 2013 Pre-Release Testers Europe (Germany)

    Can you try makeWindowTransparent(self, false)?

  8. 3 months ago

    Aurelian N

    Sep 7 Pre-Release Testers, Xojo Pro

    Any code for windows as well ? thanks .

  9. Michel B

    Sep 7 Pre-Release Testers, Xojo Pro
    Edited 3 months ago

    Look into examples/Platform Specific/Windows/CustomWindowShape

  10. Aurelian N

    Sep 10 Pre-Release Testers, Xojo Pro

    @Michel B CustomWindowShape

    Well thanks but it does not really works properly, the image looks like a monitor from '80 and it`s like 8 colors not full image then the whole image gets shifted some how , i have no idea why

    I used same code there

  11. Michel B

    Sep 10 Pre-Release Testers, Xojo Pro

    Strange. I use the very same underlying methods, and no such issues. You may want to verify the quality of your pictures.

    At any rate, I am afraid this is the only game in town...

  12. 2 weeks ago
  13. Mathias M

    is not verified Dec 4 Pre-Release Testers Bruges, Belgium

    I really wonder, what are the use cases for a custom shaped window?

  14. Ulrich B

    Dec 4 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...
    Edited 2 weeks ago

    @ChristianSchmitz You would need to use OverlayMBS class and not a Xojo window.

    I used setWindowMaskMBS for a Windows app (in this case just to have nicely rounded corners) and it’s looking absolutely fine:
    (in Window.open)

    #If TargetWin32
      Dim p As Picture
      p = New Picture (Width*ScaleFactor, Height*ScaleFactor,32)
      p.Graphics.ForeColor=RGB(0,0,0)
      p.Graphics.FillRoundRect 15*ScaleFactor,15*ScaleFactor,461*ScaleFactor, 461*ScaleFactor, 20, 20
      If Not Self.SetWindowMaskMBS(p,True, RGB(255,255,255)) Then
        Break
      End If
    #EndIf

    A FillOval brings a round window like requested in the initial question.

    @Mathias M I really wonder, what are the use cases for a custom shaped window?

    Like the OP said: It’s a nice feature for a splash screen.

  15. @Ulrich B Dim p As Picture
    p = New Picture (Width*ScaleFactor, Height*ScaleFactor,32)
    p.Graphics.ForeColor=RGB(0,0,0)
    p.Graphics.FillRoundRect 15*ScaleFactor,15*ScaleFactor,461*ScaleFactor, 461*ScaleFactor, 20, 20
    If Not Self.SetWindowMaskMBS(p,True, RGB(255,255,255)) Then
    Break
    End If

    I Used it on Window OPEN event, and unfortunately It doesn't work for me :(

    So It does the Window Mask, but shows me the gray
    Window of the App

  16. Ulrich B

    Dec 4 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    You mean you want the visible rest of the window to have some transparency too?

     Call Me.MakeTransparentMBS
      Me.transparencymbs = 0.5

    Or did I get you wrong?

  17. last week

    Julian S

    Dec 5 Pre-Release Testers, Xojo Pro UK

    @Mathias M I really wonder, what are the use cases for a custom shaped window?

    Some developers use them for showing a custom splash screen logo (blizzard), some use them for custom window shapes if they have something hanging off their main window and dont want to take up space with a rectangular design.

    Here's an example I did back in November if it helps:

    https://www.dropbox.com/s/at4ktyd0cxkn126/TestCircleRotationOnTransparentBackground.xojo_binary_project?dl=1

  18. Christian S

    Dec 5 Pre-Release Testers, Xojo Pro Germany

    MBS Plugin comes with examples.
    You need to enable transparency and than draw with alpha channel in paint event.
    (For Mac at least)

    and check MBS Xojo Overlay Plugin for the OverlayMBS class.

  19. Emile S

    Dec 5 Europe (France, Strasbourg)

    Julian: thanks.

    The image is missing.

  20. Julian S

    Dec 5 Pre-Release Testers, Xojo Pro UK

    @Emile S Julian: thanks.

    The image is missing.

    Sorry that isn't needed, I just based it on the example file that was in the the "Xojo\Example Projects\Platform-Specific\Windows\CustomWindowShape" folder and forgot to comment out all the redundant code. I've tweaked the save file if you want to download it again.

    Windows only btw.

  21. Emile S

    Dec 6 Europe (France, Strasbourg)

    Thanks.

or Sign Up to reply!