Jump to content

mouse position


Recommended Posts



I have a unipanel, with a custom button.


The action of the button, is popup a menu with some options.


When click the button on the panel header, the menu popup ok, but I can't control its position on the screen.


I'd like it to be shown at the same position of the button, but I don't know how.


I've tried with GetCursorPos and Mouse.CursorPos, but the menu is shown in a wrong place, never where I want.


Any idea?




Link to comment
Share on other sites

Maybe you wanted like this?!:


related with: http://forums.unigui.com/index.php?/topic/6947-panel-header-icons-tools/

function beforeInit(sender, config)
    config.tools = [{
        type: 'gear',
        handler: function(e) {
            ajaxRequest(sender, "_gear", ["x="+e.browserEvent.clientX, "y="+e.browserEvent.clientY])
    }, {
        type: 'pin'
procedure TMainForm.UniPanel1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
  x, y: Integer;
  if EventName = '_gear' then
    x := StrToInt(Params.Values['x']);
    y := StrToInt(Params.Values['y']);
    UniPopupMenu1.Popup(x, y);
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...