Does anyone know the best way to create rollover buttons in IB? I tried a square button with image/alt image but nothing happens upon rollover.
There is an AMRollOverButton Project that comes with an Interface Builder pLugin. haven't tested it yet but have a look at it(at the section code):
http://www.harmless.de/cocoa-code.php
if you're after what i believe you're after, then see:
-[NSResponder mouseEntered:]
-[NSResponder mouseExited:]
and family. on enter/exit, change the image (or do whatever changes you like).
Related
I've tried, but in vain, setting the window style of a wxFrame to (wxDEFAULT_FRAME_STYLE & (~wxCAPTION)). The title bar is still stubbornly there. My platform is Linux MX-19.4_x64, and the wxWidgets port is wxGTK 3.1.5. Any suggestion? Thanks.
By the way, I'm aware of the method wxNonOwnedWindow::SetShape, but I prefer to not use it, because the purpose is as simple as hiding the titlebar, instead of changing the shape to a triangle, a star or something.
I was creating a simple GUI for an app, and came across this seemingly unusual behaviour when running.
Here is what my xib file looks like:
And here is what happens when I run the app:
I have tried creating a new view and using that instead, but it displays the same behaviour.
Why is the window getting resized? And more importantly, how can you prevent it from happening?
Thanks!
I've had this problem lately with Xcode's auto-layout feature. I solved it by manually deleting all the constraints and using the "Editor->Resolve Auto-Layout Issues->Reset to Suggested Constraints in Window.
You either need to use Auto Layout Constraints or Springs and Struts (old style ) to configure your views. The window normally will adjust itself as needed with auto layout.
With old style you have to manage the window frame or at least its content view frame.
Go to .xib file
and select size inspector. and from that set autosizing according to your rquirement.
Feel free to contact.
Increase main window width and hight.
I really wonder how winamp did it. I tried to change a drawing code to draw on title bar at ncpaint. it was run well but it was complex and it didn't draw,choosing another window.
I searched some source code or article but they used other ways... how do I do it?...
Well, Winamp just creates a borderless, decorationless window, and draws everything itself. Important is, that you still can attach a sysmenu to the window, so that a right click on the taskbar button gives the usual options.
If you want to get fancy you can process the WM_NCPAINT message to perform frame and title drawing yourself on a decorated window: http://msdn.microsoft.com/en-us/library/windows/desktop/dd145212(v=vs.85).aspx
But the easier solution actually is to just emulate the standard Windows decorations and synthesize the events the standard buttons do.
I am making a customised window (a NSWindow with NSBorderlessWindowMask) So far I have been able to handle dragging, resizing, cmd+click and even miniaturize with double click if allowed (see here) so my window resembles as much as possible to a normal NSWindow.
However when I drag my window to the corner of my screen the user will expect to move that window to the next space. (In case you have Spaces enabled in "SystemPreferences" > "Expose and Spaces" > "Spaces" > "Enable Spaces")
I wonder how can I change to other space programmatically and move my window there?
Unfortunately there's no public API which allows you to do this, but if you're willing to use the Private API it's possible. Take a look at CGSPrivate.h and you'll see you can make a call like this:
CGSConnection connection = _CGSDefaultConnection();
CGSMoveWorkspaceWindowList(connection, &windowNumber, 1, newSpaceNumber);
Note that using this private API will cause your app to be rejected from Apple's Mac App Store though.
Finally I found a solution.
I can't change to a certain space programmatically but I can make my window behave like other non NSBorderlessWindowMask if [window setMovableByWindowBackground:YES] is done. That was the final purpose of this question :)
The solution is written (with some detail) here because that question seems to be older (or maybe a duplicate of this question?)
Is there a way to make a custom NSWindow work with Spaces
I can make a single row IKImageBrowserView by setting the
[imageBrowser setContentResizingMask:NSViewWidthSizable];
but in this case while i drag an image inside image browser to rearrange it, the drop place highlights with horizontal line(vertical line expected).
how can this be changed?
Many thanks.
There is no defined way to do what you want.
You may be better off writing your own custom view where you can control every detail of how things are drawn. In general, Apple's controls are "as-is" and unless they provide an explicit way to control behavior or mention that you can custom an object in some way, don't count on being able to do it easily (if at all).
I would also suggest heading to http://bugreport.apple.com and making the enhancement request - it would be best if you attached a sample application demonstrating the behavior.
EDIT: You could also try out the NSCollectionView to see if it might work for you.