FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TTreeview usage help needed.
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM

TTreeview usage help needed.

Posted: Wed Mar 03, 2010 07: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.06
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM

Re: TTreeview usage help needed.

Posted: Thu Mar 04, 2010 08:17 AM
Hi,

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


Code (fw): Select all Collapse
#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.06

Continue the discussion