I took the example of the "menu" from the examples folder as a basis, there are no problems when reworking to fit my needs, I want to add a pop-up menu on the right click.
Help prompts:

"The popup menu is the function of the IupPopup function (usually on the mouse position) and the item is selected."

While the problem is not solved. Please minimal working example.

    1 answer 1

    The idea is to create an ordinary menu, but not to tie to the window. At the right time, simply call the popup function of this menu.

     require("iuplua") cv = iup.canvas {size="300x100", xmin=0, xmax=99, posx=0, dx=10} dlg = iup.dialog{iup.frame{cv}; title="IupCanvas"} mnu = iup.menu { iup.submenu { iup.menu { iup.item{title="IupItem 1 Checked",value="ON"}, iup.separator{}, iup.item{title="IupItem 2 Disabled",active="NO"} } ;title="IupSubMenu 1" }, iup.item{title="IupItem 3"}, iup.item{title="IupItem 4"} } function cv:button_cb(button, pressed, x, y, status) local _, _, screen_x, screen_y = string.find(self.SCREENPOSITION, "(%d+),(%d+)") if button == 51 and pressed == 0 then mnu:popup(tonumber(screen_x) + x, tonumber(screen_y) + y) end end dlg:showxy(iup.CENTER,iup.CENTER) if (iup.MainLoopLevel()==0) then iup.MainLoop() iup.Close() end