TTreeview usage help needed.

TTreeview usage help needed.

Postby Horizon » Wed Mar 03, 2010 7:42 pm

Hi,

I want to start a popup menu in ttreeview class. I have used bRClicked. It opens the popup menu at right position but i also want to select the item that is right clicked position. but i could not select it.

Is there any way to do this?

Thanks
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: TTreeview usage help needed.

Postby Horizon » Thu Mar 04, 2010 8:17 am

Hi,

The sample prg is below. When I click right click, I want to select the item before showpopup.


Code: Select all  Expand view
#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
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 108 guests