we are trying to change the background color of Popup menu by using the following script:
import system
if system.tag.readBlocking(['[System]Client/System/SystemFlags'])[0].value > 3:
from javax.swing import JMenuItem
from javax.swing.border import EmptyBorder
def doMenuItem1(event):
import system
system.gui.messageBox("Report 1 selected")
def doMenuItem2(event):
import system
system.gui.messageBox("Report 2 selected")
def doMenuItem3(event):
import system
system.gui.messageBox("Report 3 selected")
import system
menu = system.gui.createPopupMenu([],[])
menuitem1 = JMenuItem ("Report 1",actionPerformed=doMenuItem1)
menuitem1.selectionBackground = system.gui.color(255,0,0)
menuitem1.foreground = system.gui.color(0,0,0)
menu.add(menuitem1)
menuitem2 = JMenuItem ("Report 2",actionPerformed=doMenuItem2)
menuitem2.background = system.gui.color(255,0,0)
menuitem2.foreground = system.gui.color(0,0,0)
menu.add(menuitem2)
menu.addSeparator()
menuitem3 = JMenuItem ("Report 3",actionPerformed=doMenuItem3)
menuitem3.background = system.gui.color(255,0,0)
menuitem3.foreground = system.gui.color(0,0,0)
menu.add(menuitem3)
menu.setPopupSize(150, 25*3)
menu.setBackground(system.gui.color(255,0,0))
menu.show(event,event.source.parent.x,event.source.parent.y+25)
This code has been written on Power Table’s onPopupTrigger Extension function using Ignition v8.0.7
we were trying to set the background to red but we still get the default color