Custom NSWindows - objective-c

Is is possible to make a window act like a true heads up display? If not fully can a windows do any part of the following? Any pointers on finding information about how to code a window like this would be great.
1 - Be above everything?
All other windows?
On all spaces?
Shown above the screensaver? [1]
2 - Be non interactive?
Never get focus?
Ignore all mouse clicks? (ie. if the user click where the window is, what ever is under the window receives the click)
[1] Shown above the screen saver would be a user settable preference (default to off). If the display is a big TV and the screen saver slide show is running, the user may sill want the display to be shown.

I'm not sure what you want. If you're looking for a full screen app here's Implementing the Full-Screen Experience.
Otherwise, you might be wanting to read Window Layers and Levels
Here's an exert for convenience:
There are a number of predefined window levels, specified by constants defined by the NSWindow class. The levels you typically use are: NSNormalWindowLevel, which specifies the default level; NSFloatingWindowLevel, which specifies the level for floating palettes; and NSScreenSaverWindowLevel, which specifies the level for a screen saver window. You might also use NSStatusWindowLevel for a status window, or NSModalPanelWindowLevel for a modal panel. If you need to implement your own popup menus you use NSPopUpMenuWindowLevel. The remaining two levels, NSTornOffMenuWindowLevel and NSMainMenuWindowLevel, are reserved for system use.
Oh! And I'm pretty sure you can't have anything over the screensaver.

Related

LabVIEW disabled Slider is enabled

I have a large problem disabling a slider in LabVIEW. Here is my minimal example:
I have a simple Slider, which is disabled and grayed out if the value is higher than 5. Otherwise the Slider is enabled.
If I drag the slider higher than 5, the Slider gets grayed out. But I am still able to move the slider around and change the value. Only after I dropped the Slider, the Slider is disabled to use.
In my opinion, this is a large bug of LabVIEW. Is there any way to disable the Slider correct during drag?
Thank you for your answers!
Additional information:
Like I said, the snippet is only my minimal example to show the basic problem. In my application the following is happening:
I have s statemachine with a state that enables the Slider and a state that disables my Slider. The state can change every moment, so it´s possible, the user is using the slider at the moment of statechange --> moment of disabling. At this moment the slider should be disabled (it only gets grayed out) directly ... not after releasing it. So limiting the maximum is not real target. I want to prohibit all slider actions for a user.
"Link to question asked on NI Discussion Forums"
As suggested by Alexander_Sobolev on the NI forum (but I promise I thought of it independently!), you can end the slider drag by generating a mouse up event. On Windows you can do this with Simulate Mouse.vi from the NI site, which calls mouse_event from user32.dll:
Note that one of that VI's mouse position inputs is erroneously marked as 'Required'; I fixed that before creating the code above.
I do think this is a UI technique that should only be used if it's really justified by the requirements of the system, and if the users will understand why it works like that; otherwise it could make for a frustrating and annoying user experience. I don't think it's a bug, rather a design decision, because the opposite behaviour could be equally undesired in other circumstances.
I guess you could set the slider value to 5 inside the case structure, alongside the greying out, by adding another property node. This should keep the slider stuck at 5, if the user tries to pull it above.
This appears to be strange behavior as the Value Change event is triggered while the mouse button is held down even when the control is Disabled & Grayed Out.
One way I can think of to limit the value would be to update the Data Entry Limits Maximum property for this control and setting the Response to Value Outside Limits for Maximum to be Coerce.

Floating NSWindow steals focus

I'm trying to make an app that sort-of functions like the spotlight search that was demonstrated on WWDC.
I managed to get it to the floating level with kCGFloatingWindowLevelKey, however the window steals the focus from whatever window was previously active. I would like it to keep the focus, and still take input in the textfield from the user. Is that doable?
Answers in swift is preferred, but objective-c works as well.

How do I change windows skin in api

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.

Showing the keyboard in a Microsoft Surface application

I am creating an application that has multipile browsers open.
Each browser has its own keyboard to type with but I don't know how to show the keyboard in this application. When the user wants to type any URL, I have to show keyword for each user.
The normal keyboard should - at least in the surface mode - appear as soon as a textbox gets a focus. The drawback: there is only on open at a time.
If you really need to have multiple touch-keyboards, you would need to implement a custom control displaying and emulating a keyboard (you would need to handle different layouts on your own!). Basically it could be implemented as a bunch of buttons, each one adding a letter to a label. A delete button would delete the last letter. Marking, copying, deleting and so one would be interesting parts to be implementing.
We have done something similar (although only one keyboard) to emulate a handy keyboard for a promotion. To be honest: it wasn't the best experience in terms of usability (a bit worse than the included keyboard). It has fit it's need, and on screen keyboards aren't best in class experience at all (you could argue, but I like my mechanical keyboard a lot more than any virtual keyboard, so this might be a matter of taste)

How do I use an indeterminate status indicator as the image for an NSStatusItem?

I have an application that is an NSStatusItem.
It has a few different modes, each of which require an external process to be launched, during which the icon is simply highlighted, and appears to be frozen.
I want to use the -setImage: method (or reasonable facsimile) to display something along the lines of a "spinner" commonly seen in web applications and all over OS X.
Is there any native method for accomplishing this (e.g. some instance of NSProgressIndicator?) or must I manually display an animation by cycling through a set of images?
In either case, how would I implement?
In order to have it be animated (and not just a static image), you'll probably need to use -setView: and give it a custom view (which then animates itself). You might be able to get away with using a suitably-configured standard NSProgressIndicator (i.e. set to NSProgressIndicatorSpinningStyle style, etc.) as that "custom view".
But, if the NSProgressIndicator standard sizes don't work well, then you can check out my YRKSpinningProgressIndicator (BSD-licensed), which is a clone of the spinning NSProgressIndicator that can be set to arbitrary size and colors.