How do I set the focus of a ZK framework messagebox to the text in the box, instead of the buttons? - zk

I have a messagebox in the ZK Framework that pops up when the user enters invalid input. It behaves as expected. We are trying to make JAWS and other screenreaders read the text of the box when it pops up.
{
Messagebox
.show("Verify that the correct Employee ID Number and/or last four of SSN were entered", "Error", Messagebox.OK, Messagebox.ERROR, -1);
}
The -1 at the end is to set the focus:
http://www.zkoss.org/javadoc/7.0.2/zk/org/zkoss/zul/Messagebox.html#show(int, int, int, java.lang.String, int)
but it sets the focus to the button itself, I've tried numbers ranging from -5 to 5 hoping it would use the button as a starting point, but that does not work. The screenreader will read the message if you use the mouse to click on it, so I know it's possible for the text to be read, but the requirement is that it's automatically read when it pops up.
Does anyone know of a way to make this happen?

Instead of using the built-in ZK MessageBox functionality, you can use the org.zkoss.zk.ui.util.Clients.evalJavaScript() function to call a JavaScript alert. This will bring focus to the popup. Although it will not be in a pretty ZK window, screen readers should read it.
Here's an example:
org.zkoss.zk.ui.util.Clients.evalJavaScript("alert('This is a popup message')");

Related

Mahapps Metro IDialogCoordinator.ShowMetroDialogAsync Execution Order

My goal is to make two successive calls to ShowMetroDialogAsync to display a custom input dialog box followed by a custom message box.
First this call
_dialogCoordinator.ShowMetroDialogAsync(this, _inputDialogView);
followed by
_dialogCoordinator.ShowMetroDialogAsync(this, _messageDialogView);
However instead of the input dialog getting shown first, the message dialog gets shown and the order seems random when I execute the Command consecutively, i.e. sometimes the input dialog gets displayed followed by the message dialog and vice versa.
Am I doing anything wrong?
Many thanks in advance.

Prevent focus loss while validating Input in JavaFX8 (as in Swing)

I'm trying to do the following. I have a TextField (or any other control) and I want to determine focus loss according to user’s input validation.
I’ve read this article https://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html#inputVerification but it seems that JavaFX does not handle focus as Swing does.
What I’m trying to achieve is: “A component's input verifier is consulted whenever the component is about to lose the focus. If the component's value is not acceptable, the input verifier can take appropriate action, such as refusing to yield the focus on the component or replacing the user's input with the last valid value and then allowing the focus to transfer to the next component.”
When a user is focused on a textfield (or any other control) I want to validate user’s input in 3 scenarios:
1) Enter key was pressed (I would listen to the KeyEvent, validate input and, if appropriate, ask to focus on the next control, but I don’t know how to do the latter).
2) TAB key was pressed (I need to intercept the focus change event).
3)Focus is lost (for example by clicking on another control or outside the Stage or even by pressing TAB key)
I need to validate user’s input and decide whether I let focus loss or no. In a way, I need to intercept the focus change event.
I can’t simply listen to de textField.focusedProperty because that only tells me that I’m loosing focus, but I can’t (or at least I don´t know how) stop it from happening.
I tried to get information about focus subsystem in JavaFX but couldn’t find any.
I’d like to know when the engine handles focus events and act according to:
a) The control that is loosing focus (and its content)
b) The possible next control in the focus sequence.
c) If the focus remains in the same Stage o if its send to another Stage or application.
I hope I’ve been clear enough with my explanation and please forgive my English if there are any mistakes.
Thank you very much in advance.

Prevent users from typing and clicking in MS Word Add-in

I am writting a MS Word Add-in, I create a button to run a long time work with text. My work requires that during the time it is excuted, no change can be made by user ( typing, clicking, deleting ...) When this work is completed, user can type and click as usual.
I have used
this.Application.Options.AllowClickAndTypeMouse = false;
However, this doesn't work.
Who can help me!
First, your approach is wrong. The Click and Type is Word functionality and has nothing to do with disabling user Mouse clicks
(For more information about Click and Type refer to here).
Now for your question, here is one approach I would suggest:
If the user is not able to do any action, I would expect an appropriate message, so my idea is to create a modal form by using:
myForm.ShowDialog();
It should do the job and block the active document until it get closed.
I would also add a nice progress bar and "Close" button which you will enable when work has done.

ImgButton : How to tell SmartGWT to not concatene state on the name of file source?

private ImgButton button = new ImgButton();
...
button.setSrc("iconName.jpg");
GWT or SmartGWT, I cannot tell exactly, generate state word to concatene it on the name of file.
Example to clarify :
On focus, iconName.jpg become iconName_Focus.jpg
On mouse down click, iconName.jpg become iconName_Down.jpg
On over, iconName.jpg become iconName_Over.jpg
Because these images are custom images, I want to tell GWT to take a default image when I didn't provide the corresponding image.
For example, when over event is fire and iconName_Over.jpg does not exist then use iconName.jpg.
Use the setShow{State} or setShow{State}Icon methods accordingly. For example for disabling the mouse down state, use setShowDown(Boolean.FALSE). For not showing a different icon when the mouse goes down on the button, use the setShowDownIcon(Boolean.FALSE). The rest of the actions have accordingly named methods you can look up at the ImgButton's javadoc page.

are there DOM events for controller presses on the PS3?

I want to develop a site which is easy to use from a Playstation 3 PS3 game console web browser. I thought it would be good to make screen actions on button presses on the console.
I can find no information on how to do this after quite a bit of searching.
Any info or links highly appreciated!
Why not write a function that displays a message for every "keystroke" and you'll see what values they represent:
$(document).keypress(function(event) {
alert(event.which);
});
Then you can use the number you get from this test and create some logic based on that.
Like this perhaps:
if(event.which == 13) {
// display cool menu maybe?
}
From what I've tested so far, the left stick generates mouse events, left pad with arrows generates keyboard events corresponding to arrows, while the right stick generates a mouseevent but unfortunately it does not move the mouse, but rather scrolls the window.
I do not know how to detect in which direction the stick is pushed (unless the cursor actually moved or the background scrolled, in which cases it is quite trivial).
Check: http://vanisoft.pl/~lopuszanski/public/ps3/