Hi,
The sample prg is below. When I click right click, I want to select the item before showpopup.
#include "FiveWin.ch"
function Main()
local oDlg, oTree
DEFINE DIALOG oDlg
@ 0, 0 TREEVIEW oTree OF oDlg SIZE 200, 200
oTree:bRClicked := { | nRow, nCol, nKeyFlags, oSelf | ShowPopup( nRow, nCol, nKeyFlags, oSelf)}
ACTIVATE DIALOG oDlg CENTERED ON INIT DefineTree( oTree )
return nil
function DefineTree(oTree)
local oMenu := array(3), ;
oSubMenu := array(10)
oMenu[1]:= oTree:Add( "Principal" )
oSubMenu[1]:= oMenu[1]:Add( "Imprimir..." )
oMenu[2]:= oTree:Add( "Proyectos" )
oSubMenu[6]:= oMenu[2]:Add( "Definir Proyectos" )
oSubmenu[7]:= oMenu[2]:Add( "Actualización datos" )
oTree:expand()
return nil
STATIC function ShowPopup( nRow, nCol, nKeyFlags, oTree)
local oPopup
//local oItem := oTree:GetSelected()
IF oTree:ClassName="TTREEVIEW"
//oTree:Select(oItem)
MENU oPopup POPUP
MENUITEM "Print" ACTION Dummy()
SEPARATOR
MENUITEM "Change" ACTION Dummy()
MENUITEM "Send to PDF" ACTION Dummy()
SEPARATOR
MENUITEM oTree:GetSelText()+" Properties" ACTION Dummy()
ENDMENU
ACTIVATE POPUP oPopup AT nRow, nCol OF oTree
ENDIF
RETURN
FUNCTION DUMMY()
RETURN