Peter,
I do this with the Contextual click which indicates the user right-clicked.
Catch the On click form event in the listbox and then test for Contextual
click. Then you can easily construct a menu with whatever items you want.
Here are some code snippets

// ($form_object="itemGrid_listbox")

Case of
: (Form event=On Double Clicked)

//  some stuff


: (Form event=On Clicked)

If (Contextual click)  //  popup menu

IG_POPUP

End if

End case

And the IG_POPUP code works like so:


$menu:=Create menu


APPEND MENU ITEM($menu;"Delete selected items")

SET MENU ITEM PARAMETER($menu;-1;"delete")

APPEND MENU ITEM($menu;"---")


$subMenu:=Create menu


APPEND MENU ITEM($subMenu;"Last receivers")

SET MENU ITEM PARAMETER($subMenu;-1;"rep_lastRcvd")


APPEND MENU ITEM($subMenu;"Last pick tickets")

SET MENU ITEM PARAMETER($subMenu;-1;"rep_lastShip")



APPEND MENU ITEM($menu;"Reports...";$subMenu)

RELEASE MENU($subMenu)


If (Not(Is compiled mode))

APPEND MENU ITEM($menu;"---")

APPEND MENU ITEM($Menu;"test")

SET MENU ITEM PARAMETER($menu;-1;"rep_test")

End if


  // --------------------------------------------------------

  // .......... user selection ..........

  // --------------------------------------------------------


$menu_choice:=Dynamic pop up menu($menu)

RELEASE MENU($menu)


//  handle the menu choice here...


IG_POP builds and displays the menu. The user selection is in $menu_choice
and it's empty for no selection. This is very fast.

For something simple like see:
https://doc.4d.com/4Dv15/4D/15.6/Dynamic-pop-up-menu.301-3818393.en.html


On Tue, Nov 5, 2019 at 10:05 AM Peter Bozek via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I would like to implement Edit menu functionality in ListBoxes, where user
> would be able to copy lines and paste it into different listbox. However,
> it seems that 4D handles enabling / disabling of edit menu and I have not
> find a way how it could be overridden.
>
> A workaround would be to do a separate menu bar with edit menu items that
> do not have automatic action associated, and switch it on getting / losing
> focus, but maybe there is a simpler way.
>
> --
>
> Peter Bozek
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************



-- 
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to