Is it possible to make an NSColorPanel 'Pop Up', almost like a popup menu, from the NSColorWell?
I don't like how it's implemented as a palette, as it's sometimes not obvious which NSColorWell it's associated with.
Thanks!
MT
No, you'd need to create your own color inspector and color well. To get it to pop up above your existing control, you'd need to create a child window and attach it to your existing window. The color palette controls would go in the child window.
However, I'd recommend you avoid doing this. The existing color palette mechanism is time-tested and works across multiple applications.
Related
I am building and maintaining a Win32 app using Visual Studio.
I have recently edited the .rc file adding WS_THICKFRAME to my dialog STYLE line for all dialog windows to allow them to be resizable.
My current problem is, when I resize a window, its content remains fixed to the left. How can I make the window's content remain centered when resizing using the border?
Pointing to any relevant documentation on this would also be helpful, as I have not had lucky finding that.
If you only want to reposition (rather than resize) the individual controls, an easy way would be to create a non-modal container dialog to hold the controls, make that dialog a child of the resizable dialog, and then when you handle WM_SIZE for the outer dialog, you only have to reposition that one non-modal dialog.
Your new position is ((newWidth- controlDlgWidth) / 2, (newHeight-controlDlgHeight)/2), where controlDlgWidth, controlDlgHeight are the width and height of the child dialog.
I say to use a non-modal dialog for this, so that you can continue using a resource script, rather than needing to add a whole bunch of explicit CreateWindow() calls.
I've got a search-suggestion box that I've implemented by using an NSScrollView that appears when you start typing in an NSTextField. I'd like my window to be quite short, and have the ScrollView draw partially outside the window. Like this:
But instead I get this:
What can I do?
You can't have controls that extend outside of a window. What you need to do is put them in a separate window. You generally want that window to be a child of the original window (using -[NSWindow addChildWindow:ordered:]).
For the use case you describe, you should use the built-in control, NSComboBox. If you really want to reimplement this sort of control, Apple provides the CustomMenus sample code and a related WWDC video. It specifically includes a suggestions menu to help fill in a text field.
I tried SetMenuInfo with MIM_BACKGROUND, but it doesn't work. I found it is because the Visual Style is enabled. But I don't want to disable the Visual Style by SetWindowTheme(hwndMain, L"", L"") becauuse it will change the appearance of the title bar and border...etc.
Is there any way to change, and only change the background color of the menu bar, without disalbe Visual Style of the main window. By "only change", I also mean that I don't have to draw the menu items myself, like I can use custom draw for change only the background color of toolbar, tab...etc. (But I can find custom draw for menu bar!).
You just set MainMenu's OwnerDraw Property to true, and Menu is automatically close Menu's theme, but don't close Window's theme!
With themes there is no official way to change the color. However you can take advantage of some undocumented window messages to implement the custom drawing yourself. https://github.com/adzm/win32-custom-menubar-aero-theme
I am in the process of creating a small image editor.
What I aim, is to create a window with transparent titlebar, but not what contains inside the window.
I have check HUD Window, but it's really is a panel, not a window. And I am missing the regular close,maximize and minimize button.
Is there anyway to create such window?
Or can we modify HUD to hold regular close,max and min button?
Thanks so much in advance!
Eko
Use a standard borderless window approach and provide a content view that draws something. Even if the content view's bounds rect is just filled with [NSColor whiteColor].
Update: Re-reading, I see you seem to be asking for just a transparent title bare but still with the window controls. See this StackOverflow question for an approach at customizing a window's title bar. Careful, though - I'm not sure this would be accepted into the App Store. Best to have a backup plan in case it's not.
Here is what I found that match to what I want : window trasparency
The trick is making the main window transparent, but not the content by creating a special view for this.
How do I go about adding/removing the window border after it has been created? the window was already designed in interface builder and I would prefer to avoid writing the window purely in code as I am still a long ways before i can say i am experienced with objective-c/cocoa.
Example Program:
a single window with the border initially, a button on it. If you click the button once it makes the boarder disappear and if you click it again then the boarder reappears.
Thanks
As far as I can tell, you can't. You might be able to fake it by taking the content view out of one window and making it be the content view of another window.