how to create a pop up when write clicked on the application icon in the taskbar .
eg: on rightclicking the outlook 2013 . popup menu having Tasks such as
New-Email message
New Appointment
New meeting
New contact
New task
appears. How can this be achieved in Java (using swing).
I believe you are referring to the System Tray in Java, have a look at this tutorial provided by Oracle: http://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html.
Related
I am developing a Harmony application and I want to animate the Dialog window
this code is from android and this type of animation I want to add
Window dialogWindow = dialog.getWindow();
dialogWindow.setWindowAnimations(R.style.CustomDialogAnimation);
// properties that needs to be attached to Dialog window
duration="75"
fromXScale="0"
fromYScale="0"
toXScale="1"
toYScale="1"
I didn't find anything matching documentation like setWindowAnimations.
I tried writing this code but hit a dead end after getting the dialog window. How to add animation properties to this dialog window.
CommonDialog commonDialog = new CommonDialog(getContext);
Window dialogWindow = commonDialog.getWindow();
Is there any other way to code this?
According to the team, HarmonyOS does not currently support to add animation properties to dialog window. Please stay tuned on HarmonyOS official websites.
I am using Winium + Java for automation testing of Windows application, and trying to access tool bar menu.
When I tried to detect elements using UI Automation Verify, I couldn't see child elements under tool bar element like below screenshot.
enter image description here
But my tool bar definitely has sub menu items like screenshot and I need to access them.
enter image description here
I tried below java code, but it didn't work
WebElement el = driver.findElement(By.id('59398'));
el.click();
WebElement child = el.findElement(By.name('Start'));
child.click();
when I tried
driver.findElement(By.name"Start').click();
it clicked my windows start menu, not my application's menu.
Is there any way to access items under this tool bar?
You can try use another UI Inspector
eg. UI SPY or Inspector.exe
Probably your ID is not a AutomationID (process id?)
You should find a main window (parent of your app) (Example for calc) and get a parameter like AutomationId, ClassName or Name
I see this is MFC application, and this is an app side MFC library problem. If you hover mouse over toolbar button using Inspect.exe, the info is available but you can't reach this button from the hierarchy (the buttons have no parent somehow). Possible workaround involves combined Win32 API and UI Automation approach:
get button rectangle using Win32 API (but there is no text).
use ElementFromPoint method of UI Automation API and get actual texts to choose the right button.
P.S. My suggestion is applicable for Java + Winium in theory. But I can't estimate the complexity because I'm not a Java expert. So below is Python solution.
We have plans to implemented this mixed way in pywinauto. See issue #413. It contains Python code sample how to do that. We've had no chance to integrate it yet.
from ctypes.wintypes import tagPOINT
import pywinauto
app = pywinauto.Application().start(r'.\apps\MFC_samples\RebarTest.exe')
menu_bar = app.RebarTest.MenuBar.wrapper_object()
point = menu_bar.button(0).rectangle().mid_point()
point = menu_bar.client_to_screen(point)
elem = pywinauto.uia_defines.IUIA().iuia.ElementFromPoint(tagPOINT(point[0], point[1]))
element = pywinauto.uia_element_info.UIAElementInfo(elem)
print(element.name)
I am a new to this. I am working on WindowTester.I could not open a new discussion page or I would tag it as Windowtester
I am having difficulty of closing down windows native dialog box after pull down menu. The code is,
ui.click(new PullDownMenuItemLocator("Save Control ", new ViewLocator("com.SOAGateway.control.views.SOAGView")));
After choosing one of the option from the menu, a dialog box appear which is native window dialog.
I would like to cancel it but it is not working.
I tried different things such as,
a)
ui.click(new PullDownMenuItemLocator("Save Control ", new ViewLocator("com.SOAGateway.control.views.SOAGView")));
Display display = new Display();
if (shell != null) shell.dispose();
b)
Display display = new Display();
ui.click(new PullDownMenuItemLocator("Save Control ", new ViewLocator("com.SOAGateway.control.views.SOAGView")));
display.dispose();
But nothing is working.
Is there any idea how could I sort out this problem.
Thanks.
Interaction with native Dialogs is very limited in Windowtester.
However, you should be able to cancel a native dialog in Windows with the following line of code:
ui.keyClick(WT.ESC);
SWTBOT can't handle native dialogs - see http://wiki.eclipse.org/SWTBot/FAQ#How_do_I_use_SWTBot_to_test_native_dialogs_.28File_Dialogs.2C_Color_Dialogs.2C_etc.29.3F
I am trying to a display message when i will push save button saying that the content got saved using SWT. Can anyone please help me.
Note: I am not using Jface, Shell, Display. I am using a Composite.
Actually, you are using a Display and a base Shell. But these are hidden behind your Eclipse RCP app. I'm guessing you are creating your message dialog in the createContents(Composite) method of a ViewPart, correct?
You can access the Display with Display.getCurrent() anywhere in your code, and you can get the active Shell with parent.getActiveShell().
If you don't want to use JFace, use the MessageBox widget from SWT.
MessageBox box = new MessageBox(parent.getActiveShell(), SWT.CANCEL | SWT.OK);
box.setText("Title");
box.setMessage("This will be the message");
box.open(); // Call this on button pressed. Returns SWT.OK or SWT.CANCEL
If you want specific features for the MessageBox, you can either ask me in a comment, or check out these 18 Java code examples.
Alternatively you can use as below
MessageBox box = new MessageBox(comp.getShell(), SWT.CANCEL | SWT.OK);
Where comp is Composite.
I have a RCP applicaton from which I need to show a GEF Editor in a modal "dialog". But since the editor framework seems to be tightly coupled to the use of a workbench window etc I need to find a why to open a new workbench window (with its own WorkbenchWindowAdvisor etc) so that I can open my GEF editor within this workbench window. Once I get this workbenchWindow opened I will set the style of the WorkbenchWindow's shell to be application modal.
I have done this in a customer project using the following components:
A static class with a method openNewWindow(String type, ...). This is the method you call to open a new window. The type argument specifies the wanted type of window.
The class looks up the specified type via a new extension point to get an ILocalWorkbenchWindowAdvisor and the initial perspective ID.
It then saves the information in global variables and calls IWorkbench.openWorkbenchWindow(perspectiveID, ...)
In ApplicationWorkbenchAdvisor.createWorkbenchWindowAdvisor(...) a new advisor is create based on the saved ILocalWorkbenchWindowAdvisor - the returned advisor basically delegates all the postWindowCreate(...), etc to the same methods in ILocalWorkbenchWindowAdvisor...
If no ILocalWorkbenchWindowAdvisor is saved - which is the case for the very first window to be opened - the type "mainWindow" is looked up and used...
It works pretty well and let all parts of the project add new windows as needed.
Use the command "org.eclipse.ui.window.newWindow" to open a new window. In your WorkbenchWindowAdvisor.preWindowOpen(), set the shell style on the IWorkbenchWindowConfigurer to be application modal. You can also hide the coolbar, menu and status bars, so it looks more like a dialog than a window.