Jump to content

HowTo: Connect popup menu to dbmemo


mierlp

Recommended Posts

How can i connect a popup menu to a uniDBmemo
and when the user clicks the right button to show the popup

NOTE:

I have set MainModule.BrowserOptions.boDisableMouseRightClick = True
but do not know if the solutions is working. I can use a key combination is to
show the popup that's not a problem.

Regards Peter

Link to comment
Share on other sites

43 minutes ago, mierlp said:

suggestion ?

For example:

UniDBMemo1 -> ...

function afterrender(sender, eOpts)
{
    var me=sender;
    me.el.dom.addEventListener('contextmenu', function(e){
        Ext.defer(function(){
            ajaxRequest(me, 'cmenu', ['x='+e.layerX,'y='+e.layerY]);
        }, 150);
    });
}
procedure TMainForm.UniDBMemo1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'cmenu' then
    UniPopupMenu1.Popup(StrToInt(Params.Values['x']),StrToInt(Params.Values['y']), Sender);

end;

 

Link to comment
Share on other sites

  • 3 weeks later...

Hi

I was out for a 14 days vacantion on the Dominican Republik :) so no time to develop

@Sherzod : Thanks ..this works fine

@GerhardV : i have several options for the user for this dbmemo field...default 2 options, but sometimes 4 or 6
                       and then buttons is to much. I did try it with buttons..but i want 1 solution for every dbmemo 
                       field i use..or buttons or popup...see attachment

 

ApplicationFrameHost_2018-10-02_18-43-34.png

ApplicationFrameHost_2018-10-02_18-43-47.png

Link to comment
Share on other sites

A typical challenge, and the downside of a context menu is 
that you have to know about it, as it is not visible at the outset.

Buttons with text makes it difficult to build a dynamic menu,
but then you have toolbars which give more flexibility.

A vertical toolbar with only icons initially, where it expands
to a menu horisontally with text at hovering...aligned right.

I see the need to put icon buttons into a memo field, like the editors.

Link to comment
Share on other sites

Join the conversation

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

Guest
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...