Page 1 of 1

xBrowse and menu

Posted: Fri Mar 20, 2020 1:37 am
by mgsoft
Dear Mr. Nages,

Is it possible to show a menu with several options when clicking on a field in a row?

Thank you. Best regards

Re: xBrowse and menu

Posted: Fri Mar 20, 2020 5:36 am
by nageswaragunupudi

Code: Select all

oBrw:bPopup := { |oCol| MyPopMenuFunction( oCol ) }
 
The "MyPopMenuFunction( oCol )" should return a PopMenu object.
The parameter oCol is the currently selected column.

Right-clicking on any column opens the popup menu just below the current cell..

If you want to implement this only for a specific column then

Code: Select all

oCol:bPopup := { |oCol| MyPopMenuFunction( oCol ) }
 
In this case, right-click on that column only activates the popup menu.

For implementation sample, please see \fwh\samples\testxbr3.prg

Re: xBrowse and menu

Posted: Tue Mar 24, 2020 7:28 pm
by mgsoft
Hi,

And what about bLClicked?

I need to show the menu in this event, but it does not work. The menu does not show up.

If you need, I can build a sample code.

Thank you.

Re: xBrowse and menu

Posted: Tue Mar 24, 2020 8:03 pm
by cnavarro
Try with this code

Code: Select all

      :bLClicked         := { | nR, nC, nF | MyPopupMnu( oBrw, nR, nC ) }
.../...

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

Function MyPopupMnu( o, nRow, nCol )

   local oMnu

   MENU oMnu POPUP 

      MENUITEM "Option 1"    ACTION Msginfo( o:oWnd:ClassName() )
      SEPARATOR
      MENUITEM "Exit" RESOURCE "close" ACTION ( o:oWnd:End() )

   ENDMENU
   ACTIVATE MENU oMnu AT nRow, nCol OF o:oWnd

Return oMnu

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

Re: xBrowse and menu

Posted: Tue Mar 24, 2020 9:52 pm
by nageswaragunupudi
My advice works with right-click.

We advise you not to use single click for any action because single click is used for navigation

Right click and popup menu is a standard user interface

Re: xBrowse and menu

Posted: Wed Mar 25, 2020 8:47 am
by ukoenig
my solution on left mouseclick
using a defined style connected to the cell
( radio, combo, listbox, fieldedit, dateselection ... )

Image

more samples radio and listbox

Image

regards
Uwe :D

Re: xBrowse and menu

Posted: Wed Mar 25, 2020 7:25 pm
by mgsoft
Thank you Cristóbal, works perfect!!!