by Horizon » Wed Dec 01, 2010 1:01 pm
Daniel,
Compile and run sample.
Select Imprimir.
Right click on "Definir Proyectos"
In ShowPopup function, I want to say "Definir Proyectos". The parameter oItem is TTreeview class handle not TTVItem.
Thanks,
- Code: Select all Expand view
#include "FiveWin.ch"
function Main()
local oDlg, oTree
DEFINE DIALOG oDlg SIZE 400, 400
@ 0, 0 TREEVIEW oTree OF oDlg SIZE 400, 400
oTree:bKeyDown = { | nKey, nFlags | KeyDown(nKey, nFlags, oTree)}
oTree:bRClicked := { | nRow, nCol, nKeyFlags, oItem | ShowPopup( nRow, nCol, nKeyFlags, oItem )}
oTree:nDlgCode = DLGC_WANTALLKEYS
oTree:Expand()
ACTIVATE DIALOG oDlg CENTERED ON INIT DefineTree( oTree )
return nil
function DefineTree(oTree)
local oMenu := array(3), ;
oSubMenu := array(10), otemp
oMenu[1] = oTree:Add( "Principal" )
oSubMenu[1] = oMenu[1]:Add( "Imprimir..." )
oTemp = oSubMenu[1]:Add( "Test 1" )
oTemp = oTemp:Add( "Test 1" )
oTemp = oTemp:Add( "Test 1" )
oTemp = oTemp:Add( "Test 1" )
oTemp = oTemp:Add( "Test 1" )
oTemp = oTemp:Add( "Test 1" )
oTemp = oTemp:Add( "Test 1" )
oTemp:Add( "Test 1" )
oTemp:Add( "Test 1" )
oTemp:Add( "Test 1" )
oTemp:Add( "Test 1" )
oTemp:Add( "Test 1" )
oSubMenu[1]:Add( "Test 2" )
oSubMenu[1]:Add( "Test 3" )
oSubMenu[1]:Add( "Test 4" )
oMenu[2] = oTree:Add( "Proyectos" )
oSubMenu[6] = oMenu[2]:Add( "Definir Proyectos" )
oSubmenu[7] = oMenu[2]:Add( "Actualización datos" )
oTree:expand()
return nil
function KeyDown(nKey, nFlags, oTree)
local oItem := oTree:GetSelected()
IF nKey=VK_RETURN
MsgInfo( "Level: " + Str( oItem:ItemLevel() ) )
ENDIF
RETURN
function ShowPopup( nRow, nCol, nKeyFlags, oItem )
? oItem:ClassName(), nKeyFlags
// oItem is a TTreeview not TTVItem.
// How Can I say Test4:cCaption ?
return
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04