How to get the hand/controller that pressed a button - mrtk

I would like to know, just by subscribing to the Interactable OnClick event, if I pressed the button with my left or right hand. Would that even be possible without passing this information along with the OnClick event?
The button has quite the logic to go through until it decides to accept a click request, so replicating all of that via global listener is not feasible.
Is it possible to get that information OnClick from somewhere else? Is it possible to query the potential click sources for who that was?

Without altering the Interactable class the only way I found was to query the FocusProvider for the active pointer, which must have been the one pressing the button (in my case):
https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/Input/Pointers.html

https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/Input/Controllers.html
Setup your controllers, take note of the axis name, in code you can do something like this in any GameObject's update loop:
if (Input.GetAxis("Axis1D.PrimaryHandButton") > 0.5f) {
// this axis (button) is pressed do something
}

Related

Check if a webelement is "clickable" before you click it - Selenium VBA

Forgive what is potentially an obscure question.
In the webtable displayed below the following code will click on the highlighted radio button and fire the JS associated with its "click" event.
Set myEle = ch.FindElementById("__M5_1_1_image")
myEle.Click
For reasons I will not bore you with, I am trying to write a function which will check if you can click on this (or another candidate webelement in the table) WITHOUT actually clicking on it as I do not want to fire the associated "click" event at this stage of the code. However, I do want to know that the webelement I have specified will not throw an error or produce no event when I do click it later.
I have tried .ClickAndHold and .ReleaseMouse as tests to see if the same potential errors are returned as with the use of .click, but this does not work. For example I can get a "Element not interactable error" with .click but no error with the other 2.
Going back to the webpage I notice that this (and all the other tables I want to apply this function to) change the mouse cursor from an arrow to a "pointing hand" graphic when you hover the mouse over the correct element (e.g. radio button image in this example). Hence, one method would be to look for the presence of the "mouseover" event in the list of event listeners for the specific webelement - as highlighted right lower pane of the image. Unfortunately I don't have any idea how to check the "event listeners" associated with a defined webelement using selenium and VBA. For example if I fire the mouseover event for a webelement would it return an error if no such event existed or would there merely be no action? I assume it is the later, so can anyone tell me if it is possible to query whether a specific event is associated on the webpage for a defined webelement?

How to make backbutton work for a control, not just Page in UWP?

I followed this link http://www.wintellect.com/devcenter/jprosise/handling-the-back-button-in-windows-10-uwp-apps and "successfully" make my button work. I mean I can make my backbutton work between pages. However, if I navigate to a control which is inside this page and will cover the whole screen, then it would not allow me to back to the page. I will stuck in that control.
I'm wondering how to solve this problem. Currently I can think two possible ways (0) Override OnBackRequested() inside the control's code behind or viewmodel? (1) Override OnHardwareButtonsBackPressed() inside the control's code behind or viewmodel?. I don't know if these are correct way to do it or there is some better way to do it. Another reason for me to override is that I need to make some changes to the page navigation behavior.
As you have guessed, you simply need to hide the control again when the back button is pressed or back is requested in some other way. I would listen for the BackRequested event (not the HardwareButtons.BackPressed event) in the page's code-behind, and in the handling method you can check to see if the control is currently shown. The reason I recommend the BackRequested event is because it is universal, while HardwareButtons.BackPressed only works on a phone. Anyway, if the control is visible, then hide it, and set the Handled property of the event arguments to true. If the control is already hidden, don't do anything special to handle the event (because in that case you will want the navigation system to handle it by navigating to the previous page, if there is one). There are many aspects to navigation in Windows 10 -- please see these pages on Navigation and the SystemNavigationManager.

JSF: Create a "dummy" button which does nothing?

In our JSF web application, we have an input field where the user can enter a numeric ID, which is then looked up by the app. To help the user, the lookup is bound to "onchange", thus it will be triggered as soon as the user tabs out of the field or clicks elsewhere.
So, user enters "123", presses tab (or clicks), lookup runs. This works fine; however, for usability reasons, we also want to provide a button that users can click on, for users who will otherwise wonder "where should I click to trigger a lookup?". To do this, we'd like to provide something that looks and feels like a HTML / JSF button, but does nothing (as the click will trigger the "onchange" event anyway).
Is there a way to make a JSF button that does nothing? I tried using h:commandButton without the "action" attribute, but it still fires a request.
p:commandButton type="button" will just provide a push button.
Since you tagged this question also as a usability issue, I would advise against a button in the first place if the onchange already triggers the lookup.
From a user's perspective it is confusing whether or not clicking the button is mandatory. After they have entered the field and skipped to the next, they see the lookup occur without clicking the button. If there is a button they will assume it's there for a reason.
The option that I favour in these cases is a onkeypress handler with a timeout of half a second, after which the value is looked up.

Automatic show a dialog in ObjectListView, wxpython

I meet a problem in ObjectListView. When I choose some objects or use checkbox to choose them, the function on those objects will be called by pressing a button and utilizing GetCheckedObjects().
Is it possible for a dialog showed automatically when I choose or check an object like this?
If ObjectListView doesn't support that function, is there any other ways to realize it?
According to this previous SO question, the event that is triggered when a user clicks on a ObjectListView is the same as for a wx.ListCtrl, namely wx.EVT_LIST_ITEM_SELECTED.
So all you need to do is create your dialog (tutorials here and here) then bind a function to wx.EVT_LIST_ITEM_SELECTED that launches your dialog.

Saving the states of JavaFX controls on exit

I have a bunch of control objects (TextBoxes, to be precise) that get injected into my code using the #FXML annotation during the FXML load.
I would like to save the states of these controls, specifically the text values, when the user closes the Scene by clicking the close box on the title bar.
However, when I trap the CloseRequest event in an OnCloseRequest handler I find that the values of the control variables are null (the original injection works, so this is something that happens in between the loading of the FXML and the calling of OnCloseRequest).
Can anyone explain this behavior and/or suggest how I can get the functionality that I want?
TIA
onCloseRequest is
Called when there is an external request to close this Window. ...
(from Javadoc). One of the meanings of "external request" is when you close the window through OS native window close button. The closeRequest event is not triggered through the programmatic stage.close() or stage.hide() calls. So consider to handle onHiding or onHidden events.
Otherwise post your OnCloseRequest handler code.

Resources