Working with composable in Kotlin.
I have TreeView with Items which are already clickable, but now I need to distinguish between primary and secondary clicks (mouse buttons), but mouseclickable is experimental, so need to check it in another way to open a contextmenu.
Any ideas?
Related
If suppose there two or more controls(eg. Buttons) with exactly same properties on a screen and while recording user actions if one of the controls was clicked, how can the appropriate control be identified and replay back the same click by overcoming the ambiguity of that control?
Scenario:
Two 'cancel' buttons without an automation id or any useful assistive properties and let's say their hierarchy(ancestors) are same.
Replay script is being executed in UFT.
If UFT creates the objects, either via Record or by adding the object to repository, it will automatically add an ordinal identifier. This is a numeric value that selects the controls from the set of controls that match the (rest of the) description. The ordinal is usually based on the placement of the control (starting on the top left) and may not be the most robust way to identify the control.
It's probably better to use Visual Relations Identifier (VRI) which allows describing the control in relation to another control. This is similar to how a human would describe the button, e.g. "The cancel button to the left of the 'are you sure' text".
Is there any way to arrange the controls in the userform using only arrowkeys (not dragging) ?
The Designer does not seem to support this and the form does not seem to capture Arrow Keys as key press events.
I have tried hacking this together with number keys but it will not keep the values of where the element was placed and does not work inside any control that actually accepts input.
So I think the answer is No you cannot use the arrow keys to move controls.
This is an auto talker that i created, but it isn't very convenient to click on start and stop when the text is being typed at 10 milliseconds. So i wanted to create a key that when pressed starts the auto typer, and also stops it. I have a box where the user can press a key to assign to start and stop the auto typing. What code would i put for clicking on assign? I want assign to: get key from textbox5.text and use it as the shortcut key to start spamming. The key would be pressed when the Interface for the spam bot is minimized, so i can't use "&Spambot" for S to be the shortcut key.
Any help would be appreciated.
Please click on the link below to see image
http://s16.postimg.org/6xdxtjvg5/Interface.png
I successfully used some methods to read the numkey state, started my stuff when it is turned on, and stop it when it is turned off again, maybe you will like that solution.
If Control.IsKeyLocked(Keys.NumLock) Then ...
your alternative would be to 1. use an keyDown event (i think it gave more information about pressed keys than key pressed event), then store it in a local variable
And finally using an external dll to figure out if any key is pressed anywhere in windows. And if, then compare if it is the correct key, and then trigger whatever you want to trigger.
I'm using a TableViewer and I want to it perform like when I hold CTRL key. I mean if I click a row, it must be added to selection and not replace current selection.
I probably need to do this manually in selection listener. But may be there's a better (more convinient) way?
Tableviewer wraps a Table, which multi-select behavior is platform-specific, that means you cannot disable that. If you want to implement your own multi-select behavior you have to implement your own table-widget which does not depend on the Table widget from SWT. The Composite Table should be a good starting point...
How about adding the SWT.CHECK attribute when constructing the table so the table entries will be selected with a checkbox?
In my GWT project, I'm trying to get it so two DialogBoxes can pass information between each other. One of them holds a MapWidget, and when a button is pressed in the other DialogBox, the position information is received from that other DialogBox's MapWidget. Does anyone have any tips for how I should coordinate between having two different DialogBoxes show up? Should I wrap the code for the two in a Composite? Furthermore, is there an example anywhere of dealing with two DialogBoxes at once in GWT? For example, if I click outside of the two boxes, both should be dismissed. I'm wondering if there's a way to keep both of them in focus at once, so I can switch between the two without causing either to disappear.
Sharing Data Between Dialog Boxes
In my opinion, the "correct" way to do this would be to implement some sort of MVP structure in the application so that a presenter manages the view (DialogBoxes, among other things) and knows how to pass simple data to the view for it to display (the presenter would handle the MapWidget data, the view would take care of displaying it on the DOM).
However, if you're looking for a quicker/more simpler approach, you have a couple of options (which you choose really depends on the application structure):
Create a Composite, as you mentioned, that knows how to pass the necessary data back and forth. By having the Composite manage the data object and tell the two DialogBoxes how to display it, you are actually approaching an MVP architecture within your Composite.
Subclass DialogBox into a class that contains a HandlerManager (sometimes used as an "Event Bus") that fires events when the button is pressed. You can create events that are designed to pass data back and forth between the two DialogBoxes (even make them type-safe with type parameters). See this StackOverflow question for details on using a HandlerManager. The MVP article, linked above, also has some good information on using an event bus.
Model-View-Presenter is a tried-and-true method of structuring an application that results in more testable code, better project structure, and can help guide you when making decisions like this. I strongly recommend checking it out if you haven't already.
Sharing Auto-Hide Functionality
GWT's PopupPanel (on which DialogBox is based) offers a method addAutoHidePartner(Element) which is describe thusly:
Mouse events that occur within an autoHide partner will not hide a panel set to autoHide.
So, you can create two auto-hiding DialogBoxes that only close when you click outside both of them (e.g., they do not close when you click within either of the boxes) with the following code:
// Create the dialog boxes
DialogBox dbox1 = new DialogBox(true, false);
DialogBox dbox2 = new DialogBox(true, false);
// Set some visual options
dbox1.setPopupPosition(10, 10);
dbox2.setPopupPosition(200, 10);
dbox1.setAnimationEnabled(true);
dbox2.setAnimationEnabled(false);
// Set the dialog boxes' caption and content
dbox1.setHTML("Dialog Box 1");
dbox2.setHTML("Dialog Box 2");
dbox1.setWidget(new HTML("This is the first dialog box."));
dbox2.setWidget(new HTML("This is the second dialog box."));
// Making dobx2 a partner of dbox1 means clicking
// in dbox2 won't cause dbox1 to close
dbox1.addAutoHidePartner(dbox2.getElement());
// Similarly, setting dbox1 as a partner of dbox2 means
// clicking in dbox1 won't cause dbox2 to close
dbox2.addAutoHidePartner(dbox1.getElement());
// Show the dialog boxes
dbox1.show();
dbox2.show();
You can interact with either of the dialog boxes without the other closing. Omit the appropriate call to setAutoHidePartner if you only want a one-way partnership.