Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Sep 21, 2019 2:20 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Definitive guide to Custom Window Frames?
PostPosted: Wed May 22, 2013 10:56 am 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
Hello.

I've seen some comments in the past regarding custom window frames but they either tackle something very specific or don't seem to work in Cocoa or Linux.

I understand that to make a custom window frame Declares are needed (or, I guess, plugins that use similar calls but simplify implementation).

I'm looking for hints on what would be necessary in each platform to create a custom window frame. I assume the contents are never a problem so the problem really becomes the window title, the borders and, I guess, the menus for non-mac windows.

It started with the idea was to do my own window, down to the titlebar. Like the mockup below

https://www.dropbox.com/s/v6i5wiaz88ml0a6/CustomWindow.png

Image

(image link may be broken, if so use the URL above to see the dropbox page directly)

I'm looking to do the above style for all three platforms, with only the window widgets changing around (and, again, the menus in non-mac OSes)

So far I'm assuming I can't just do this and I'll need to recreate the window frame and title from scratch. I don't like it because it would become non-native (in the sense of functionality, it's non-native regarding looks).

Do you have a way to create custom window frames for one or more of the three platforms? How would you go about doing this?

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Wed May 22, 2013 11:02 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
You could use our OverlayMBS class and if there is demand, we could check how to create a linux version.
Because Windows, Carbon and Cocoa work already.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Wed May 22, 2013 11:17 am 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
MonkeybreadSoftware wrote:
You could use our OverlayMBS class and if there is demand, we could check how to create a linux version.
Because Windows, Carbon and Cocoa work already.

Greetings
Christian


I've never understood overlaymbs. I thought it was used to create HUD-style windoids. Can it be used to create any type of window? Can it have menus in windows? Can it style the OS widgets but still link to their native behaviours?

For example, if I had a document icon in a custom frame and I cmd-clicked on the name in an overlayMBS window would it popup the path menu as in native OS X windows?

Sorry for all the questions, as I said, I thought overlaymbs was used for something else :)

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Wed May 22, 2013 11:25 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Well, you may havesomthing different in mind.
If you draw your own frame, you are responsible to draw the widgets and handle the events.
I think we have examples for Windows fro custom window masks and example for Cocoa to draw own frame.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Wed May 22, 2013 4:39 pm 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
Thanks, Christian, but I've checked OverlayMBS but it isn't what I'm looking for. I'm looking for a way to modify an existing window, as I've seen in some cases already be done.

Overlay is nice, but it doesn't support native controls so it really would break a lot of the functionality already programmed.

Let's hope someone else can offer an alternative. Thanks anyway.

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Thu May 23, 2013 2:05 am 
Offline

Joined: Mon Aug 15, 2011 10:25 pm
Posts: 293
For Cocoa apps

#if TargetCocoa
soft declare sub setStyleMask lib "Cocoa" selector "setStyleMask:" (WindowRef As WindowPtr, Mask As UInt32)
setStyleMask self, 0
#endif

_________________
Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Thu May 23, 2013 11:09 am 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
shaosean wrote:
For Cocoa apps

#if TargetCocoa
soft declare sub setStyleMask lib "Cocoa" selector "setStyleMask:" (WindowRef As WindowPtr, Mask As UInt32)
setStyleMask self, 0
#endif


Thank you, Shaoshean. As far as I can see this is not that different from the "Shadowed box" frame selectable from the IDE. Unless I'm missing something. It has square corners, is it possible to mask the corners to make them round?

NSWindow has no mention of rounded corners so I assume that it's not straightforward and I'll have to abort muy attempts :-|

The problem, really, is the round corners in OS X. I can set a box and handle dragging and widgets myself, but I can't make an irregularly shaped window. I tried using alpha to make the window transparent but that makes the contained controls also transparent, so that didn't work.

EDIT: Shaoshean: I know it rang a bell. I just "rediscovered" your Window Extenders post. The "transparent window, opaque controls" should do it.

viewtopic.php?p=229050#p229050

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Fri May 24, 2013 2:42 am 
Offline

Joined: Mon Aug 15, 2011 10:25 pm
Posts: 293
Shadowed box has a smaller drop shadow..

_________________
Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7


Top
 Profile  
Reply with quote  
 Post subject: Re: Definitive guide to Custom Window Frames?
PostPosted: Fri May 24, 2013 6:59 am 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
shaosean wrote:
Shadowed box has a smaller drop shadow..


You're right, but so far it's the closest I've found to a normal shadowed window without the titlebar. I'll have to scrap it because shadowed boxes like to be on top of every window.

My goal is to make a window with a different title bar, rounded corners and shadow. I have tried several things but there's always missing.

This is a screenshot of my current attempt:

https://dl.dropboxusercontent.com/u/177 ... owTry1.png

This is using a shadowed box. But it won't work because the shadowed box wants to be on top of everything.

Actually, I've been storing my tries here (sample project):

https://dl.dropboxusercontent.com/u/177 ... Window.rbp

Tests:
Using a shadowbox: Perfect, but stays on top of every window.
Using StyleMask: Almost. But bottom round corners are not round and transparency routine adds a black background (!)
Using Backintype: Same as stylemask (to be expected, really)
Combining window type metal with stylemask: Mess.

I'm about to desist, take my second option, remove the transparency declares (as it ironically adds a black background) and forget about rounded corners at the bottom of the screen.

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


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

All times are UTC - 5 hours


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group