It is currently Sun Mar 07, 2021 9:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Re: Window with rounded corners
PostPosted: Wed Jan 20, 2016 8:55 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 524
I got it :-)
I have to open the window invisible...

Code:
Rect.NSRect
Rect\origin\x = 0
Rect\origin\y = 0
Rect\size\width = 300
Rect\size\height = 200
RadiusX.CGFloat = 20
RadiusY.CGFloat = 20

ImageID = CocoaMessage(0,CocoaMessage(0,0,"NSImage alloc"),"initWithSize:@",@Rect\size)
CocoaMessage(0,ImageID,"lockFocus")
Path = CocoaMessage(0,0,"NSBezierPath bezierPathWithRoundedRect:@",@Rect,"xRadius:@",@RadiusX,"yRadius:@",@RadiusY)
ColorWhite = CocoaMessage(0,0,"NSColor whiteColor")
CocoaMessage(0,ColorWhite,"setFill")
CocoaMessage(0,Path,"fill")
CocoaMessage(0,ImageID,"unlockFocus")

If OpenWindow(0,0,0,300,200,"Drawing",#PB_Window_BorderLess|#PB_Window_ScreenCentered|#PB_Window_Invisible)
  Close = ButtonGadget(#PB_Any, 100, 50, 100, 25, "close")

  ID = WindowID(0)

  CocoaMessage(0,ID,"setOpaque:",#NO)
  CocoaMessage(0,ID,"setBackgroundColor:",CocoaMessage(0,0,"NSColor colorWithPatternImage:",ImageID))
  CocoaMessage(0,ID,"setHasShadow:",#YES)
  CocoaMessage(0,ID,"setMovableByWindowBackground:",#NO)

  HideWindow(0, 0)
 
  Repeat
    ev = WaitWindowEvent()
    If EventGadget() = Close
      Break
    EndIf
   
  Until ev = #PB_Event_CloseWindow
 
  End
 
EndIf


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye