show popup menu for an object
484278
def show_popup(self, selected, pos):
        ''''''
        state = self.state
        if selected.popup_menu is not None:
            import copy
            popup_menu = selected.popup_menu
            if state.default_popup is not None and state.default_popup.combine:
                popup_menu = copy.deepcopy(popup_menu)
                popup_menu.add(MPMenuSeparator())
                popup_menu.combine(state.default_popup.popup)
            wx_menu = popup_menu.wx_menu()
            state.frame.PopupMenu(wx_menu, pos)
152712
def set_popup_menu(self, menu):
        ''''''
        self.popup_menu = menu
        self.in_queue.put(MPImagePopupMenu(menu))
625922
def eventFilter(self, object, event):
        
        # popup the editor when clicking in the line edit for a checkable state
        if object == self.lineEdit() and self.isEnabled():
            if not self.isCheckable():
                return super(XComboBox, self).eventFilter(object, event)
            
            # show the popup when the user clicks on it
            elif event.type() == event.MouseButtonPress:
                self.showPopup()
            
            # eat the wheel event when the user is scrolling
            elif event.type() == event.Wheel:
                return True
            
        # make sure we're looking for the checkable popup
        elif object == self._checkablePopup:
            if event.type() == event.KeyPress and \
                 event.key() in (Qt.Key_Escape, Qt.Key_Return, Qt.Key_Enter):
                object.close()
            
            elif event.type() == event.MouseButtonPress:
                if not object.geometry().contains(event.pos()):
                    object.close()
        
        return super(XComboBox, self).eventFilter(object, event)
691435
def showMenu(self, pos):
        
        glbl_pos = self.viewport().mapToGlobal(pos)
        
        # lookup the specific item at the given position
        item = self.itemAt(pos)
        selected = self.selectedRecords()
        
        if not self._recordEditors:
            return
        
        if item and not isinstance(item, XOrbRecordItem):
            return
        
        menu = QMenu(self)
        acts = {}
        
        # modify a particular item
        if item:
            if self.editorFlags() & XOrbTreeWidget.EditorFlags.Edit:
                record = item.record()
                editor = self.recordEditor(type(record))
                
                if editor:
                    name = record.schema().displayName()
                    act = menu.addAction('Edit {}...'.format(name))
                    act.setIcon(QIcon(resources.find('img/edit.png')))
                    acts[act] = (editor, 'edit', record)
        
        # add items
        if self.editorFlags() & XOrbTreeWidget.EditorFlags.Create:
            menu.addSeparator()
            
            typs = self._recordEditors.keys()
            typs.sort(key=lambda x: x.schema().displayName())
            
            for typ in typs:
                name = typ.schema().displayName()
                act  = menu.addAction('Add {}...'.format(name))
                act.setIcon(QIcon(resources.find('img/add.png')))
                acts[act] = (self._recordEditors[typ], 'create', None)
        
        # remove selected items
        if selected and self.editorFlags() & XOrbTreeWidget.EditorFlags.Remove:
            menu.addSeparator()
            
            act = menu.addAction('Remove Selected Records')
            act.setIcon(QIcon(resources.find('img/remove.png')))
            acts[act] =(None, 'remove', selected)
        
        if not acts:
            return
        
        act = menu.exec_(glbl_pos)
        
        editor, action, record = acts.get(act, (None, None, None))
        
        # create a new record
        if action == 'create':
            record = editor.create(autoCommit=False)
            if record:
                self.recordCreated.emit(record)
                record.commit()
                self.refresh()
        
        # edit an existing record
        elif action == 'edit':
            self.editRecord(record, glbl_pos)
        
        # remove selected records
        elif action == 'remove':
            title = 'Remove Records'
            msg = 'Are you sure you want to remove these records?'
            btns = QMessageBox.Yes | QMessageBox.No
            ans = QMessageBox.information(self.window(), title, msg, btns)
            if ans == QMessageBox.Yes:
                self.recordsRemoved.emit(selected)
                if RecordSet(selected).remove():
                    self.refresh()
104176
protected void onShowPopup(final MouseEvent e)
	{
		if (e.isPopupTrigger())
		{
			System.out.println(e.getSource());
			popupMenu.show(e.getComponent(), e.getX(), e.getY());
		}
	}
229617
function() {
		var popInButton = $( '<div class="lm_popin" title="' + this.config.labels.popin + '">' +
			'<div class="lm_icon"></div>' +
			'<div class="lm_bg"></div>' +
			'</div>' );

		popInButton.on( 'click', lm.utils.fnBind( function() {
			this.emit( 'popIn' );
		}, this ) );

		document.title = lm.utils.stripTags( this.config.content[ 0 ].title );

		$( 'head' ).append( $( 'body link, body style, template, .gl_keep' ) );

		this.container = $( 'body' )
			.html( '' )
			.css( 'visibility', 'visible' )
			.append( popInButton );

		/*
		 * This seems a bit pointless, but actually causes a reflow/re-evaluation getting around
		 * slickgrid's "Cannot find stylesheet." bug in chrome
		 */
		var x = document.body.offsetHeight; // jshint ignore:line

		/*
		 * Expose this instance on the window object
		 * to allow the opening window to interact with
		 * it
		 */
		window.__glInstance = this;
	}
1242145
def show_for(object, html_options={}, &block)
      html_options = html_options.dup

      tag = html_options.delete(:show_for_tag) || ShowFor.show_for_tag

      html_options[:id]  ||= dom_id(object)
      html_options[:class] = show_for_html_class(object, html_options)

      builder = html_options.delete(:builder) || ShowFor::Builder
      content = capture(builder.new(object, self), &block)

      content_tag(tag, content, html_options)
    end
1354567
private void checkPopup(MouseEvent e) {
        if (e.isPopupTrigger()) {
            popup.show(this, e.getX(), e.getY());
        }
    }
55297
function showObject (info) {
  var subProps = info.properties;
  if (subProps) {
    var names = [];
    for(var name in subProps) { // prototype ok
      names.push(name);
    }
    var subNames = names.join(',');
    console.log('サブプロパティ : ' + subNames);
  }
}
924872
def popupChoices(self, event=None):
        
        # don't bother if all items are disabled
        if NORMAL not in (self.browserEnabled, self.clearEnabled,
                          self.unlearnEnabled, self.helpEnabled):
            return

        self.menu = Menu(self.entry, tearoff = 0)
        if self.browserEnabled != DISABLED:
            # Handle file and directory in different functions (tkFileDialog)
            if capable.OF_TKFD_IN_EPAR:
                self.menu.add_command(label   = "File Browser",
                                      state   = self.browserEnabled,
                                      command = self.fileBrowser)
                self.menu.add_command(label   = "Directory Browser",
                                      state   = self.browserEnabled,
                                      command = self.dirBrowser)
            # Handle file and directory in the same function (filedlg)
            else:
                self.menu.add_command(label   = "File/Directory Browser",
                                      state   = self.browserEnabled,
                                      command = self.fileBrowser)
            self.menu.add_separator()
        self.menu.add_command(label   = "Clear",
                              state   = self.clearEnabled,
                              command = self.clearEntry)
        self.menu.add_command(label   = self.defaultsVerb,
                              state   = self.unlearnEnabled,
                              command = self.unlearnValue)
        self.menu.add_command(label   = 'Help',
                              state   = self.helpEnabled,
                              command = self.helpOnParam)

        # Get the current y-coordinate of the Entry
        ycoord = self.entry.winfo_rooty()

        # Get the current x-coordinate of the cursor
        xcoord = self.entry.winfo_pointerx() - XSHIFT

        # Display the Menu as a popup as it is not associated with a Button
        self.menu.tk_popup(xcoord, ycoord)
978402
protected void openPopup(final A_CmsContextMenuItem item) {

        m_popup.add(item.getSubMenu());
        m_popup.addAutoHidePartner(item.getElement());
        m_popup.setModal(false);
        m_popup.show();

        setSubMenuPosition(item);

        if (m_isFixed) {
            m_popup.setPositionFixed();
        }
    }
490120
function () {
			if (this._bOpenAsContextMenu && this._oContextMenuPosition.x === null && this._oContextMenuPosition.y === null) {
				this._bOpenAsContextMenu = false;
			}

			// fires the open event after popover is opened
			this.getPopover().attachAfterOpen(this._handleAfterOpen, this);

			this.getPopover().attachBeforeClose(this._handleBeforeClose, this);

			//place the Popover and get the target DIV
			this._oTarget = this._placeContextMenu(this._oTarget, this._bOpenAsContextMenu);

			// set the PopOver visible
			this.getPopover().setVisible(true);
			this.bOpen = true;
			this.bOpenNew = false;
		}
1165751
function MenuItem (opts) {
    MenuItem.superclass.constructor.call(this, opts)

    var callback = opts.callback

    this.anchorPoint = ccp(0.5, 0.5)
    this.callback = callback
}
978473
function Menu(element) {
        this.element = element;
        _trigger(this.element, "showgoto", 1, true);
        window.setTimeout(window.remoteShowGoto);
        this.remove = this.remove.bind(this);
    }
943821
private void showSystemMenu() {
        Insets insets = frame.getInsets();

        if (!frame.isIcon()) {
            systemPopupMenu.show(frame, insets.left, getY() + getHeight());
        } else {
            systemPopupMenu.show(menuButton, getX() - insets.left - insets.right,
                                 getY() - systemPopupMenu.getPreferredSize().height - insets.bottom - insets.top);
        }
    }
868704
function(menu, data) {
        if (!data.children || !data.children.length) {
            return;
        }

        var options = this.options,
            groups = [],
            ul,
            li,
            tag,
            limit = options.itemLimit,
            i, l;

        if (options.className) {
            menu.addClass(options.className);
        }

        menu
            .aria('expanded', false)
            .attr('role', 'menu');

        if (limit && data.children.length > limit) {
            i = 0;
            l = data.children.length;

            while (i < l) {
                groups.push(data.children.slice(i, i += limit));
            }
        } else {
            groups.push(data.children);
        }

        for (var g = 0, group, child; group = groups[g]; g++) {
            ul = $('<ul/>');

            for (i = 0, l = group.length; i < l; i++) {
                child = group[i];

                // Build tag
                if (child.url) {
                    li = $('<li/>');
                    tag = $('<a/>', {
                        text: child.title,
                        href: child.url,
                        role: 'menuitem'
                    });

                    // Add icon
                    $('<span/>')
                        .addClass(child.icon || (Toolkit.isRTL ? 'caret-left' : 'caret-right'))
                        .prependTo(tag);

                } else {
                    li = this.render(options.template);
                    tag = $('<span/>', {
                        text: child.title,
                        role: 'presentation'
                    });
                }

                if (child.attributes) {
                    tag.attr(child.attributes);
                }

                // Build list
                if (child.className) {
                    li.addClass(child.className);
                }

                li.append(tag).appendTo(ul);

                if (child.children && child.children.length) {
                    var childMenu = this.render(options.template)
                        .conceal()
                        .appendTo(li);

                    this._buildMenu(childMenu, child);

                    li.addClass('has-children')
                        .aria('haspopup', true)
                        .on('mouseenter', this.onPositionChild.bind(this, li))
                        .on('mouseleave', this.onHideChild.bind(this, li));
                }
            }

            menu.append(ul);
        }

        // Only monitor top level menu
        if (options.mode !== 'click' && menu.hasClass('is-root')) {
            menu.on({
                mouseenter: function() {
                    this.clearTimer('hide');
                }.bind(this),
                mouseleave: function() {
                    this.startTimer('hide', options.hideDelay);
                }.bind(this)
            });
        }
    }
296524
function(e) {
            // show menu
            var $this = $(this);
            if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) {
                e.preventDefault();
                e.stopImmediatePropagation();
                $currentTrigger = $this;
                $this.trigger($.Event("contextmenu", { data: e.data, pageX: e.pageX, pageY: e.pageY }));
            }
            
            $this.removeData('contextMenuActive');
        }