Dropdown list function required

Dear Colleagues

i have multiple of Main Windows and i need to navigate it using dropdown list not using the tabs

how i can do this function?

please assist

regards

Have you looked at the Menus section of the client event scripts? That’s probably the most intuitive way to navigate while keeping maximum screen space for your windows.

Can you show me how from by screen shots and if you can also give me a solution for dropdown menu will be much appreciate it

Regards

i am new at ignition

[quote=“msamiryusuf”]i am new at ignition[/quote]You should seriously consider going through the entire Inductive University curriculum (free), but for the moment just jump to this video.

what if i have 300 RTU’s and i need to navigate anyone of them in this case i need something customized like a drop down list but using client scripting it will be a long script need to be done for example if i need to navigate from RTU1 to RTU300 using database and dropdown list how it can be done

i was checking the help and i found this syntax

dropdown = event.source.parent.getComponent(“Dropdown”)
system.nav.swapTo(“MyWindow”, {“paramValue”:dropdown.selectedValue)

i tried to manipulate it but anyone try this syntax before and can you give me example

[quote=“msamiryusuf”]i was checking the help and i found this syntax

dropdown = event.source.parent.getComponent(“Dropdown”)
system.nav.swapTo(“MyWindow”, {“paramValue”:dropdown.selectedValue)

i tried to manipulate it but anyone try this syntax before and can you give me example[/quote]


dropdown = event.source.parent.getComponent("Dropdown")
system.nav.swapTo("MyWindow", {"paramValue":dropdown.selectedValue})

you are missing a curly bracket

i tried it my friend and i have a window is called RTU2 and i get the error

Traceback (most recent call last):
File “event:menu:RTU2”, line 1, in
NameError: name ‘event’ is not defined

at org.python.core.Py.NameError(Py.java:260)
at org.python.core.PyFrame.getname(PyFrame.java:257)
at org.python.pycode._pyx0.f$0(<event:menu:RTU2>:2)
at org.python.pycode._pyx0.call_function(<event:menu:RTU2>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:623)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:582)
at com.inductiveautomation.factorypmi.application.runtime.RuntimeMenu$JythonMenuActionListener.actionPerformed(RuntimeMenu.java:206)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.8.2 (b2016030813)
Java: Oracle Corporation 1.8.0_77

any advice ???

yes it is very useful.
but my requirement is dropdown should be on designer window and by selecting dropdown corresponding window should open.
where we need to write the code.
image

Please guide, it will be very useful for my project.

The simplest approach would probably be to use the dropdown's propertyChange event handler.

First, add a column to the dropdown's data called path, and then use your window name in the label column like so:

The dropdown will look as follows:
image

The propertyChange script will use the selected value to find the path in the data to open your window. Here is the example code:

if event.propertyName == "selectedValue":
	data = event.source.data
	path = data.getValueAt(event.newValue, 2)
	system.nav.openWindow(path)
1 Like

Wow! Thank you so much. Its working perfect

1 Like