I am facing a problem , i want to change data inside listview on left/right arrow click. I added Key_Up and Key_Down event to page but neither is called when i push buttons (it seems to me that those events only work with input type fields).
Is there a way to achieve this ?
What you are trying to do is more complicated than you probably anticipate. The key events on a single control are simply not sufficient to get you the data you want in a reliable manner. Instead, you need to handle the Accelerator Key Activated event on the Core Dispatcher.
To accomplish this, you can start by looking at my KeyboardHelper service just so you can see how to handle the basics of the keyboard. But the helper doesn't have anything to handle the arrow keys. If you want to handle arrow keys you will need to add some custom logic.
KeyboardHelper class http://xaml.codeplex.com/SourceControl/latest#MVA/201410_UniversalApp/Dispatchr.Client/Dispatchr.Client.Shared/Services/KeyboardService/KeyboardHelper.cs
You should notice that VirtualKey.Left and VirtualKey.Right are explicit in the VirtualKeys enumeration. This means checking for them should be a synch. I think this should be all you need to get this working. Feel free to copy any of the code you can use from that class.
Best of luck!
Related
I'm trying to lock an entry widget in tool mode like this:
tool
extends Node
export(bool) var locked=false
export(String) var entry="" setget set_entry
func set_entry(new_val):
if!(locked):
entry=new_val
In theory, this should prevent any changes made to the entry widget
as It would rapidly change back to the previous value hence giving the illusion of being disabled
but in reality, you can type freely and after you select another node and then reselect the original node then the value returns to what it was before locking
How do I disable it completely? (perhaps using _set()?)
Edit
This is the problem I'm facing
To disable it completely, I think you need an Inspector Plugin (I talked a little about creating one elsewhere). You could make one that handles the property you are interested in and displays its value, but does not allow to edit it, or only allows to edit it conditionally.
However, for a quick and dirty approach you can do is tell the inspector that the properties changed:
func set_entry(new_val):
if!(locked):
entry=new_val
property_list_changed_notify()
This will cause the inspector to re-read the values of the properties. It can be a bit annoying, depending on the case. By the way, it seems to be ignored in sub-resources, which I find frustrating.
By the way, Godot 4 has PROPERTY_USAGE_READ_ONLY.
Addendum: We can be a little more aggressive than property_list_changed_notify, by using EditorInterface.inspect_object (we can get an instance of EditorInterface from an instance of EditorPlugin). Godot would reload the inspector (which also results in losing the keyboard focus).
If there's any way to simulate a real mouse click (press + release) at the absolute position of current desktop with PyQt, without other extenal library like PyUserInput?
I search around and just found this and this. But If I don't misunderstand, they seem to send their click event to Qt application it self, instead of the desktop?
Use PyQt's QTest, together with unittest or such. See also for example http://www.voom.net/pyqt-qtest-example.
If this is not for unit testing, look at sendEvent and postEvent (See http://doc.qt.digia.com/qq/qq11-events.html#syntheticevents). There are some limitations to Qt's mechanism for generating "artificial" events but based on what you describe, it is likely to work. If you have tried those and it doesn't work, please post the code you tried.
Do anyone know why FocusOut event is not working on linux?
I have 1 enabled textbox and 3 disabled combobox.
I bind the textbox with FocusOut event where it will call a proc that enables or disables the 3 combobox.
It works perfectly on Windows. However, it doesn't seem to trigger the FocusOut event when this action is done on Linux. One weird thing is that if I click on buttons, FocusOut event seems to be triggered.
Could it be because my combobox are disabled?
But why does it work on Windows?
I really hope someone can help me please.
Thanks in advance.
I have observed in the past that some window managers steal the focus temporarily from Tk on each button click before setting it back; I suspect that this has to do with the way that key event handling works, but I am unable to check at the moment (due to being on OSX, where things are different). Because of the complexities involved, I'd suggest that if you bind to <FocusOut>, you should also check whether you get a <FocusIn> event shortly after; a little extra delay (e.g., 0.1s) before doing the update of the buttons' disabled status will not hurt.
Or you could hang the code to do the disabling off the entry widget validation engine, perhaps like this:
.e configure -validation focusout -validatecommand doButtonEnableDisable
The validation interface is the same for both the old style entry and the new style ttk::entry widgets. It's also supported by spinboxes. Just be aware that you need to return a boolean true from doButtonEnableDisable or you'll reject the change to the entry, and you should take care to ensure that your code does not produce an error or it will disable itself; the docs list the things to watch out for.
Per user feedback, I am opening a new question for this topic.
So I am currently using Struts-Menu to handle my menu needs for my Struts 2 J2EE application. It is not necessarily a package I wish to work with I have found by playing around with it. So what are some alternatives to this package? I immediately flocked to Struts-Menu because I saw a fair amount of web search traffic pointing to it, including those who use Struts2. What I am worried about is difficulty in the future of making it work with other packages, given its 2007 last update and the extra tap dance I had do to make it work with my configuration. It seems too fragile at this point for my taste.
I have several different menus in my app, but the one I am specifically addressing at the present is like this ... The top level menu drops down upon mouse hover over it. The submenus expand horizontally upon mouse hover. Exactly one menu item can be selected as no radio buttons or check boxes are contained in the menu. This particular menu does not require db access to populate its children. It works sort of like Velocity CoolMenus4 from the Struts-Menu demos.
I've never used struts-menu, but it looks like overkill to me.
I would recommend that you locate a menu that you like and then write a tag file to handle outputting it in your view layer. To me, that's a lot easier than using a framework or library just to output a menu. Plus, its specific to the actual menu you want to use. Your tag can handle doing security checks to ensure that the user only sees what they have permission to access, etc.
Is there a way to override the "undo" and "select all" in right click context menu of the browser over textarea?
Thank you.
You cannot edit the browser's built-in context menu, but you can disable it and replace it with your own using the oncontextmenu event on the window object. I would caution that this is often a bad idea. Users expect to find the built-in context menu and are often frustrated when it isn't there.
I know you can prevent the whole context menu from opening by registering to the click() event, doing some cross-browser mumbo-jumbo to get wich button was clicked, and then return false if the right one was clicked.
However, I don't think it's possible to modify the context menu itself, at least not using javascript.
I should add that you may want to rethink why you're doing this. This will never be a protection against anything (some try to prevent copying images from their website), as it may simply be disabled by turning javascript off.
UPDATE: Ok, so you don't want to prevent users to do things, bug have them doing things your way. Then, I guess the best thing to do is :
Provide users with a toolbar that allow them to do these things (and thus making them use your actions instead of the default one
Map the usual keyboard shortcuts to your actions (Ctrl+A, Ctrl+Z, etc...)
Replace the right click menu with your own.
You mentionned in another comment that you cannot reproduce copy/paste, which is correct, but you can implement you own clipboard (that will only work for your webapp) if you really have to.