Handle event on disabled Node - javafx

Is there any way to handle, mouse click, for example on disabled element? My task is to have disabled list and make it enabled after double click on it.

A disabled Node does not receive mouse or key events.
See the official documentation.
You could wrap the node into another node and handle the mouse events there in case the child node is disabled.

Related

Force focus client under mouse

There are recipes on how to change focus on mouse move or client change.
But what I want, is to prevent any window from stealing focus. E.g. I open a new terminal via the default meta-Enter shortcut, and when it opens it immediately steals focus. Is there any way to prevent it?
Yes, it's possible. Focus events can happen in many ways. In the case of the new clients, just comment the focus line in your rules.
For the focus follow mouse, remove the client.focus = c in the mouse::enter section of rc.lua
For specific clients, you can add focus filters:
https://awesomewm.org/apidoc/libraries/awful.ewmh.html#add_activate_filter
For the deepest and most advanced focus control, you can disconnect the default focus handler (awful.ewmh.activate) from the request::activate (Awesome 4.0+) signal and implement your own. In that case, you will have absolute control over every focus events.

How to completly disable focus system

I'd like to disable focus system in a JavaFX application. That means no focus traversal, no control could receive focus, so it would never have corresponding graphic decoration and would never receive keyboard events. All keyboard events should be caught and processed by the root node (or stage).
What should I extend/rewrite to disable focus system?
To process all keyboard events in the root node, do
root.addEventFilter(KeyEvent.ANY, e -> {
// handle keyboard event...
e.consume();
});

Detect right clicks on a RichEditableText

I am currently implementing squiggly in a flex application to enable spell checking. Due to certain requirements, I can not use SquigglyUI to hook onto my spark RichEditableText. I have successfully used com.adobe.linguistics.utils.TextTokenizer to tokenize and highlight mispelt words.
I would like to be able to let the user rightclick on a mispelled word and show a list of suggestions in the context menu using getSuggestions.
I have tried to attach a listener to my RichEditableText:
richtexteditor.addEventListener("rightClick", showSuggestions);
And this is my event handler:
private function showSuggestions(event:MouseEvent):void{
trace('hi there');
}
The problem is when debugging the application, I never get the trace in my console as the rightclick event is never dispatched. In addition, I need to detect the word the user has right clicked on. How can I go about doing this and how can I detect right clicks?
Cheers
All I had to do was add an event handler to the contextmenu property of the richeditable text:
richtexteditor.contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, doSomething);
r.addEventListener(MouseEvent.RIGHT_CLICK, listener)
This will listen for the right-click of the mouse (Flex4.5)

Recognize a holding/long touch on a list component in Flex Mobile

I´am trying to create my own custom list component in a Flex mobile Project which fires an Event when the user touches a listitem and holds the finger down for a given time.
Some kind of "longTouch"-Event like its implemented on native android listitems to edit the entry for example.
I tried to listen for the MOUSE_DOWN Event to start a timer and dispatch an event when the timer finished. But this approach failed because i cant get the listitem that was pressed by the user because the List component updates the "selectedItem"-property only after the user lifts his finger from the list.
thanks in advance
Andre Uschmann
There is no longTouch (or longPress) event exposed through the Flash Player Native APIs.
One option is to roll your own using TOUCH_BEGIN, TOUCH_END, and a timer.
Basically:
When user starts the touch, start the timer.
When the touch_End event fires; check the timer to see how long it has been running using currentCount. If it is long enough to be considered a "long touch", then dispatch your custom longPress event. If not; then stop the timer and ignore.
This could all happen inside the renderer; so you'd know exactly what item was pressed.
I expect this would be more solid than using mouse events, which seem to be inconsistent on touch based devices

Receive events when QCustomContextMenu is open

I have an issue capturing the key and mouse events. I have a class which inherits QGLWidget. I invoke a context menu QCustomContextMenu by setting the context menu policy of the widget. As the context menu is open, I am unable to capture the mouse and key events. I will need the events to be captured even when the context menu is open.
Thanks!
i believe you have heard about the installEventFilter.
you have to install the event filter for the object you want events to be received (e.g Contextmenu).
install event filter, and create event filter method to handle event in a way you want.

Resources