I'm setting up a menu using xbrowse tree, but I'm not getting it to execute the function by clicking on the option. Could someone give me a light?
- Code: Select all Expand view
oTreMENU := MONTAMENU()
@ 79,00 XBROWSE oBrwMENU SIZE 400,n2 PIXEL OF oWnd ;
DATASOURCE oTreMENU CELL LINES NOBORDER
oBrwMENU:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrwMENU:lrecordselector := .F.
oBrwMENU:lHeader := .F.
oBrwMENU:lFooter := .F.
oBrwMENU:lHScroll := .F.
oBrwMENU:lVScroll := .F.
oBrwMENU:oFont := ARIAL14B
oBrwMENU:nRowHeight := 35
oBrwMENU:nColDividerStyle := 0
oBrwMENU:nRowDividerStyle := 0
oBrwMENU:bClrStd := {||{RGB(255,255,255), RGB(88,88,88)}}
oBrwMENU:bClrSelFocus := {|| {nRGB(255,255,255), nRGB(000,152,218)} }
oBrwMENU:SetColor(RGB(255,255,255), RGB(88,88,88))
oBrwMENU:aCols[1]:AddResource({"TREE_MENU_MENOS","TREE_MENU_MAIS","TREE_MENU_OPCAO"})
oBrwMENU:CreateFromCode()
- Code: Select all Expand view
STATIC FUNCTION MONTAMENU()
PRIVATE aMENU := { {0,"CADASTROS" ,"" },;
{1,"Empresas" ,"F1001()"},;
{1,"Agenda Telefônica" ,"F1004()"},;
{1,"Clientes" ,"F1003()"},;
{1,"Operadores" ,"F1002()"},;
{1,"CEP" ,"F1005()"} }
TREE oTreMENU
nTREECOUNT:=0
nLEVEL:=aMENU[1][1]
FOR i:=1 TO LEN(aMENU)
IF aMENU[i][1] > nLEVEL
TREE
nTREECOUNT++
ELSEIF aMENU[i][1] < nLEVEL
nPREVLEVEL := nLEVEL
nCURLEVEL := aMENU[i][1]
nLEVELDIFF := nPREVLEVEL-nCURLEVEL
FOR j:=1 TO nLEVELDIFF
ENDTREE
nTREECOUNT--
NEXT
ENDIF
TREEITEM aMENU[i][2]
nLEVEL:=aMENU[i][1]
NEXT
IF nTREECOUNT > 0
FOR i:=nTREECOUNT TO 1 STEP -1
ENDTREE
NEXT
ENDIF
ENDTREE
return oTreMENU
Thank you.