Reproducing InputManagerTest Buttons - c#

(Crosspost to Mixed Developer forums because they're still very inactive.)
Going through the HoloToolkit examples, I'm trying to reproduce the button input example in the InputManagerTest example for a GUI I'm making. Reproducing the button seems to cause a hiccup though. Here's what I do:
I add a Canvas
I add a Button to that Canvas
That's basically it. This looks very similar to the example. My scene, as well, as the InputManager, EventSystem, and Camera as instructed in the tutorial.
However, in the example, the button responds to Gaze, and hand click, which is what I want.
In my example, my button responds to my mouse and mouse click though. I also cannot change its color from the default.
Does anyone know why this all would be?

I can answer my own question. Standalone Input Module is automatically added as a component of the Event System in the current build. This sets the default input to be the mouse cursor. Disabling this component fixes the issue.

Related

EventSystem misinterprets button clicks

I have a problem with clicking on UI buttons. In this video you can see a problem. VIDEO
I found the solution of my problem. The problem was in component "Grid Layout Group". I don't know why this component makes my buttons "scary", but it's more good if you place your "tabs" manually.

Detecting UserControl User Custom Cursor, and Getting Callbacks

I am creating a fullscreen demo application (demo = not production, so hacky code is okay though not preferred) for the Kinect SDK. The application hides the Windows cursor and shows a custom hand cursor which is defined as a object.
What I would like to do is create a custom UserControl (let's call it "HoverControl") that can detect when the cursor object is over it and then send back timer ticks, allowing the cursor object to update in some way (showing the user that something is about to happen).
The behavior is pretty much a copy of the Xbox 360 Kinect behavior. How things look will just be a little different.
How can I detect with the cursor object is over a "HoverControl" and have receive a callback from the HoverControl?
Thank you for any help or suggestions!
CLARIFICATION:
I am not currently moving the Windows cursor, so MouseEnter doesn't fire.
You can use your own cursor by making one using Online Cursor Maker. See this website on how to set it. Then you can use MouseEnter and/or MouseLeave.
Coding my own cursor in XAML, and creating a UserControl out of it, I set up a timer inside the control to perform a hit test for certain buttons (again, their own unique UserControl type) around my interface.
I ran into one issue with the hit test, which I was ultimately able to solve and detail in the following post at MSDN:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a8cdb265-21cc-4fd0-b40d-e6778b659852

Gain Access to Mouse Clicks in C# Component

I am using the ScintillaNET component and I am attempting to capture clicks in the margin, as this will determine how I respond. Unfortunately, the margins capture the mouse events (and don't provide a way, from what I can see, to get the click information - number of clicks, mouse button clicked, etc).
If this is indeed the case (I am not able to get that info directly), what is another way of capturing what the mouse is doing before the MarginClick event is fired?
Thanks for any help!
I did not figure out a solution to my specific question. Instead, I changed my code to look at the modifier keys that are pressed when the MarginClick event is fired. This solution works well, and I am going to accept this answer. However, if someone can specifically answer my question, I will accept that answer.

How to fix weird scrolling/alignment behavior when using keyboard in MenuStrip?

I started noticing strange behavior when navigating the main toolbar of my Winforms application, and I don't know how to fix it. When I initially open the dropdown of the File menu, it looks like this:
I begin to scroll down each item with the arrow keys, and everything is fine until I reach "Exit". As soon as I hit the down arrow key from "Log Off", or if I hit the up arrow key from "Open", the menu rearranges itself to look like this:
I'm puzzled by this behavior. The menu still works, and from this point, if I start scrolling up, I can get the arrangement back to normal:
A few observations:
The menu still works.
This doesn't happen when using the mouse.
I have some code that toggles the Visible property of some of the menu items. I was able to modify what the arrangement was by playing around with this, but it was still messed up.
Can anyone help me understand what is going on, and how to fix it?
I found the source of this problem. It is a known bug that Microsoft apparently doesn't intend to fix. The problem happens when you attempt to toggle visibility/availability of menu items during runtime. Microsoft reminds us that "this issue is purely visual, there's no functionality loss."
Their suggested workaround is to add/remove the menuitems rather than show/hiding them.
Another workaround is suggested on the forums: deriving from ToolStripDropDownMenu, turning off AutoSize, handling it on your own, and adding 1 extra pixel of height.
I found a blog post that addressed this issue, but the author never got around to posting his solution. He makes a useful point concerning Visible vs Available, however.

Prevent Window Focus Change

I'm trying to help a disabled person with a small bit of code to help him play a game easier. He is limited to a trackball and a single button.
Currently he uses the onscreen keyboard and has managed to play other games using it. I've created a small bit of code to try and make his live easier. It uses hover buttons for the keys. When the mouse pointer enters the button it sends key down, when it moves off the button it sends key up.
I have that working and I think (or hope) he's going to like it. It worked pretty well when I tested it.
I want to add one more piece of functionality to it. If he clicks while over my control, I want to send a different key stroke. Not a problem, I can do that. However, when I do that window focus shifts from the game to my control.
I found this on MSDN:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/48737c2b-7e6f-4ade-ac1c-7dd2f5cc2b88/
That works to prevent my window from activating, but it still causes the game to lose focus. I can set the focus back to the game, but I would prefer if it just never lost focus.
I'm coding in C# and WPF.
Anyone have any ideas on how you might do that?
John Fenton
Hook in some low level mouse and keyboard hooks, and your application won't need to steal focus and give it back.
Take a look at this pastie of a simple WPF app, which is heavily based off of an article by Stephen Toub.
Whenever you left click, anywhere, a second left click is sent, so you effectively double click. You could achieve your goal by hiding your app whenever the user clicks, so that your app never steals focus. Then detect the location of the click, and decide if one of your buttons would have been pressed, and act accordingly.
I realize I'm digging this out of the past, but hopefully someone will find this answer helpful. Cheers, and good for you for turning your programming to assist a fellow human!
You could try canceling the event PreviewLostKeyboardFocus as mention in this blog:
http://immortalratblog.blogspot.com/2008/03/canceling-keyboard-focus-change-in-wpf.html
Im guessing that focus is lost be simulating the key press?

Categories