How to add click action to cursor in hololens - hololens

In microsoft hololens ,Added cursor to a button but unable add cursor action ,can anyone help
Thanks in advance.

To add the ability to "click" you can do this with the Input Manager that is built into the HoloLens Toolkit. See here:
https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit/Input
Specifically you should add the InputManager prefab to your scene, then add to a script that is attached to an object an implementation of IInputClickHandler. So something like this:
public class DoSomethingOnClick : MonoBehaviour, IInputClickHandler
{
void IInputClickHandler.OnInputClicked(InputEventData eventData)
{
// A Click happened here, do something about it
}
}

Make sure you dont forget to have an event system in your scene.

Related

I have added an OnPaint() function to my dialog class but its not getting called after dlg.DoModal()

Can anyone please help me understand how to override OnPaint() for a dialog class derived from CDialog.
Here is the code:
ColorImageDlg *pDlg = NULL;
pDlg = new ColorImageDlg;
pDlg->DoModal();
delete pDlg;
I'm overriding OnInitDialog() and it's getting called.
But while overriding OnPaint() it is not getting called.
Can any one please help me fixing it?
First of all what is the point of creating the instance of the dialog on heap? You can simply do:
ColorImageDlg dlg;
dlg.DoModal();
You need to modify your message map like this:
BEGIN_MESSAGE_MAP(ColorImageDlg, CDialog)
ON_WM_PAINT()
END_MESSAGE_MAP()
Use VS Class Wizard to avoid problems like that.
If you can't use the ClassWizard then there is another way. Here is a resource about it:
(VS2015 version) https://msdn.microsoft.com/en-us/library/dey7ke4c.aspx
(VS2008 version) https://msdn.microsoft.com/en-us/library/dey7ke4c(v=vs.90).aspx)
But basically, once you have defined the dialog resource and attached it to a new class, make sure the Class View tab is selected:
Next, make sure your dialog class is selected in the class view:
Then, click on the Messages icon of the Properties panel:
Scroll down the list of messages and locate WM_PAINT. Then click the dropdown arrow and select the option to add it:
As you can see, it has inserted all the needed code:
Hope this helps.

How do I know when all paintings are finished?

My program is fullscreen application. On start I use some checks and if something is wrong, error dialog is shown. I need two windows (main fullscreen, and dialog) were here and all graphics were ok.
When I use this code:
primaryStage.show();
/*..some checks*/
dialogStage.show();
.. there is no fullscreen. It's somehow overlapped by other windows.
This one works better:
stage.setOnShown( new EventHandler<WindowEvent>() {
public void handle(WindowEvent windowEvent) {
/*..some checks*/
dialogStage.show();
}
});
primaryStage.show();
But... I can see task panel from Windows. It becomes hidden when dialog is closed.
And also I can see default java icon there. Although I've set custom icon before.
Looks like setOnShown() is called before all graphical updates are done.
Is there any event or something to know it?
I also tried Timeline from animation to call a small delay. But without success.
The same with calling dialog from additional thread (with Platform.runLater() of course :) ). This way fullscreen hides at all.
Maybe on JavaFX8 things are better?

MonoTouch.Dialog: Dismissing keyboard by touching anywhere in DialogViewController

NOTE: There are two similar SO questions (1) (2), but neither of them provides an answer.
TL;DR: How can one dismiss the keyboard in a MonoTouch.Dialog by letting the user touch any empty space in the view?
I'm writing an app using MonoTouch.Dialog and a UITabBarController. One of my tabs is "Settings"...
When the user starts typing, the keyboard obstructs the tabbar...
Using MonoTouch.Dialog, the only way to dismiss the keyboard is to go to the last field and press the "return" key. Considering the fact that the user cannot press any tab until the keyboard is gone, I would like a better way to do it. Namely, to dismiss if the user taps anywhere else on the screen.
Without MonoTouch.Dialog, it's a snap: simply override TouchesBegan and call EndEditing. But this doesn't work with MT.D. I've tried subclassing DialogViewController and overriding TouchesBegan there, but it doesn't work. I'm currently at a loss.
Or, I wonder, would I be better off ditching the tabbar so I can use a UINavigationController with a "Back" button on top, which won't be hidden by the keyboard?
I suggest you use a tap gesture recognizer that will not cause interference with the TableView event handlers:
var tap = new UITapGestureRecognizer ();
tap.AddTarget (() => dvc.View.EndEditing (true));
dvc.View.AddGestureRecognizer (tap);
tap.CancelsTouchesInView = false;
You missed my question about it also: Can the keyboard be dismissed by touching outside of the cell in MonoTouch.Dialog?
:-)
This is my #1 feature request for MonoTouch.Dialog.
To answer your question: No. It is not possible. I have searched and asked around and have not found any answers.
I assume because it is just a sectioned (grouped) table and if it wasn't sectioned, there wouldn't be any spot to click. However, that is just my speculation.
I wish that miguel or someone that works on monotouch would answer this and say if it is even possible. Possibly a future enhancement?
I figured out a workaround that satisfies me well enough, so I'm answering my own question.
// I already had this code to set up the dialog view controller.
var bc = new BindingContext (this, settings, "Settings");
var dvc = new DialogViewController (bc.Root, false);
// **** ADD THIS ****
dvc.TableView.DraggingStarted += (sender, e) => {
dvc.View.EndEditing (true);
};
This will dismiss the keyboard whenever the user drags the view a little bit. There's no touch event I could find associated with the tableview, so this is the next best thing. I'd welcome any other ideas. Cheers!
One workaround to use the dragging gesture instead of the tap as proposed (that do not interfere with the table view gestures) is to override MonoTouch.Dialog.DialogViewController.SizingSource (or MonoTouch.Dialog.DialogViewController.Source if you don't want uneven rows) and give it to the DialogViewController. I don't know if it is very clean or safe.
public class CustomTableViewSource : MonoTouch.Dialog.DialogViewController.SizingSource
{
public CustomTableViewSource(MonoTouch.Dialog.DialogViewController dvc) : base(dvc)
{
}
public override void DraggingStarted(UIScrollView scrollView)
{
base.DraggingStarted(scrollView);
if (scrollView != null)
{
scrollView.EndEditing(true);
}
}
}

Eclipse RCP: How to configure the Perspective Menu?

I need to have total control of the perspective menu.
I already hacked into the platform to disable the CONTEXT menu:
private void disablePerspectiveToolbarMenu() {
PerspectiveBarManager perspectiveBarManager =
((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getPerspectiveBar();
if (perspectiveBarManager!=null){
ToolBar toolBar = perspectiveBarManager.getControl();
Listener[] listeners = toolBar.getListeners(SWT.MenuDetect);
if (listeners != null){
for (Listener listener : listeners){
toolBar.removeListener(SWT.MenuDetect, listener);
}
}
}
}
But i need also to control the default contents of the PERSPECTIVE MENU. There is one option that is always present that gives access to a Perspective List Shell. I need to remove that option from the menu.
It's a shame that the perspective menu is totally out of user control. I just need to have the perspectives added to the menu, and nothing more!
Thanks.
There are 3 potential options to get rid of Other:
Set the
org.eclipse.ui.IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU
preference to false in your RCP app. This can be done by including a plugin_customization.ini file with your product definition.
Patch the workbench in your RCP app.
Have a look at
org.eclipse.ui.internal.PerspectiveBarNewContributionItem
and
org.eclipse.ui.actions.ContributionItemFactory.PERSPECTIVES_SHORTLIST
Don't include the default
perspective bar in your RCP app.
Instead, create a perspective bar
using org.eclipse.ui.menus, a
toolbar, and the openPerspective
command.
I did some research and the solution did not work as I expected it. Finally I found my mistake.
To set the property in the plugin_customization.ini I tried:
org.eclipse.ui.IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU=false
but this is not the correct notation!!! Please see the correct solution I added finally to the plugin_customization.xml
org.eclipse.ui/SHOW_OTHER_IN_PERSPECTIVE_MENU=false
So the name of the interface or the class specifying the property ist not part of the notation!

How does MonoTouch autogenerate XIB code behind?

I'm a C# programmer dabbling in a bit of iPhone development using MonoTouch.
I add a new View Interface Definition to my project and double click to open it up in Interface Builder. I add a UIButton. I save the file, and inspect the xib.designer.cs file, and I can see no reference to the new button.
I downloaded the code from http://monotouchexamples.com/ where I could see an example of autogenerated code behind :
[MonoTouch.Foundation.Connect("infoButton")]
private MonoTouch.UIKit.UIButton infoButton {
get {
return ((MonoTouch.UIKit.UIButton)(this.GetNativeField("infoButton")));
}
set {
this.SetNativeField("infoButton", value);
}
}
I opened up MainWindow.xib in interface builder. I notice a few differences. File's Owner is of type UIApplication instead of NSObject. What is the importance of this? There is an App Delegate object of type AppDelegate. I can't add an AppDelegate to my own view, or at least I can't find it in the Library. Do I need to add one? I can see that the existing controls on MainWindow.xib have Referencing Outlets to the App Delegate. I add a new button and I want to hook it up. When I click and drag a New Referencing Outlet to the App Delegate a context menu appears that lists the existing controls. How do I add a new element to this list, or where does this list come from?
I've been spoilt by the Visual Studio world where I just dump a button on a form and start writing code for the click event. Could someone provide some pointers about the steps needed to get this working on MonoTouch?
Thanks,
Patrick
Adding a button by itself is not enough. The button is not accessible outside the Interface Builder. You need add an Outlet, and connect the button with the outlet in Interface Builder.
Remember: Outlets are the members in your Controller class that get a reference to the controls, you can't just access the controls without them.
As Dave says, you need to add an outlet to your controller class, and connect your button to that outlet, before any auto-generated code will appear. This caught me out too initially.
You choose your controller class in the Interface Builder library window, choose 'outlets' in the bottom part of the library, and add an outlet there. You then need to select your button, choose the connections tab of the inspector window, and drag from the "New referencing outlet" circle over to your controller class. Interface Builder will then prompt you to choose an outlet to connect to. Then when you save, you should get the auto-generated code appear in the .xib.designer.cs file, and then you should be able to reference your button via that outlet variable in your .xib.cs file.
It sounds like the project I created is out of date - I remember there were quite a few changes around how the generated buttons are created in the designer file. I will update the project soon for you.
As Dave said, to get the code to be auto generated you need to add an outlet with Interface Builder. There should be an example on this video here - http://bit.ly/aWoItN but the server seems to be down at the moment.
Hope this helps,
ChrisNTR

Resources