Showing the keyboard in a Microsoft Surface application - pixelsense

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)

Related

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.

How to force an NSWindow to be in front of every app? Even fullscreen apps

I have an NSWindow that i would like to have it in front of everything (every app of the computer, fullscreen apps, etc..). Even if i click in a background app, the NSWindow cant go to background. And the NSWindow must follow the user screen if, for example, the user switches the desktop to desktop2, and so on...
How can i do that?
Thanks!
If you don't need to be visible with other apps' full-screen windows, it's not too hard.
First, to stay in front of everything else, just setLevel: with NSFloatingWindowLevel or higher. Experiment with the different values to see which seems appropriate to your needs.
Next, to stay in front even when the user changes Spaces, possibly including Exposé/Mission Control, setCollectionBehavior: with the appropriate pair of flags, or use the corresponding Spaces and Exposé settings in the Attributes Inspector if you're creating the window in the nib. Either Can Join All Spaces or Move to Active Space will make sure you stay visible on every space, in slightly different ways. You'll probably want Exposé set to Stationary, or possibly Transient, too. Again, try both ways and see.
However, Lion will hide both all-spaces and move-to-active-space windows when the user switches to a full-screen space or to Dashboard or Launchpad. And if you watch, you'll see that it does this in different ways for each of the three cases. And that Snow Leopard does things a little differently, and so does Mountain Lion.
If you want to solve that last problem, you need a bit of hackery—and different forms of hackery for each case and for each OS version. The basic trick is to catch the hide-related notifications and unhide yourself at the appropriate time.
You should modify your info.plist and set the Application is Agent flag to YES. An agent's window can be displayed in front of fullscreen windows.
Setting both,
"Application is agent (UIElement)" to "YES" in info.plist
&
window level :
self.view.window?.level = NSWindow.Level(rawValue: kCGMainMenuWindowLevel.hashValue - 1)
self.view.window?.collectionBehavior = [.stationary, .canJoinAllSpaces, .fullScreenAuxiliary]
helped me.

Prevent split of the keyboard and block it

Can I use UIKeyboardWillChangeFrameNotification to prevent the user to change the keyboard layout? I've some buttons on it and I don't want the splited keyboard, because it creates some ui problems.
Thank you in advance.
No, you have no control over the behavior of the system keyboard. Your only real option is to make your UI work properly with the split one. Keep in mind, though, that since the split keyboard can be moved, it doesn’t matter if it’s covering parts of your interface—if the user splits their keyboard, moving it out of the way of what they’re trying to interact with then becomes their problem.

UIWebView paragraph selection style

as you can see in the first picture ,i'm using the UIWebview in my app.
But when i drag the second handle to the next paragraph , the selection become a rectangle box , i can only select the whole paragraph , how can i keep it just like the first picture?
from reading Using Copy, Cut and Paste Operations, you can see that iOS has implemented the UI selection for UIWebView, UITextView and UITextField for you, and thus what you are seeing is simply how selection works in these UI objects.
(and it is thus: so long as the user is within the bounds of a paragraph, then the user will be able to select a portion of the text in the paragraph as you have demonstrated in your first view; and if the user's fingers run beyond the edges of the paragraph, the underlying UI code showing the selected area will attempt to select the smallest subset of items it can select, with entire paragraphs being considered an atomic unit at this level.)
given that the documentation referenced above describes only how to invoke the various cut/copy/paste/select actions when invoked from a menu (with some control over what appears in the UIMenuController's menu, and some control over what you can do with the cut/copied selection in a UIPasteboard), there doesn't seem to be a handy way to direct how the UI responds to the user controlling the edge of the selection. even going so far as extending UIWebView might give you the ability to capture the touch events necessary, but you wouldn't be able to direct the resulting drawing of the selection through documented API of UIWebView.
and so, without mucking with non-public API, it's a little hard to imagine how you could have a more precise fine-grain control over selecting text spanning paragraphs unless you go to the length of implementing your own class to capture the touch-events necessary to control he selection and then process the events to draw the selection around the edges that you prefer. in other words, you'd sort of have to re-invent UIWebView and all that it does, with the exception of your special code for selections spanning textual paragraphs.
sorry.

Custom NSWindows

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.