Tree xBrowse Menu (ONE MORE)

Post Reply
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Tree xBrowse Menu (ONE MORE)

Post by ctoas »

Hello friends.

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?

Image

Code: Select all | Expand


     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


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.
Last edited by ctoas on Mon Jun 14, 2021 5:57 pm, edited 2 times in total.
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
Adolfo
Posts: 861
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile
Contact:

Re: Tree xBrowse Menu

Post by Adolfo »

Hi ctoas


Code: Select all | Expand


oBrwTree:aCols[1]:bLDClickData:= { |r,c,f,o| If( oBrwTree:oTreeItem:bAction != nil, EVAL(oBrwTree:oTreeItem:bAction),Null() ) }
oBrwTree:bKeyChar                 := { | nKey | If( nKey == 13 .and. oBrwTree:oTreeItem:bAction !=Nil,Eval(oBrwTree:oTreeItem:bAction), Null() )}
 


Hope it helps

Greetings from Chile
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Tree xBrowse Menu

Post by ctoas »

Hello Adolfo, thank you for replying.

It worked, but I could not adapt to my need.

I need something simple like this:

Code: Select all | Expand


    TREE oTreMENU
        TREEITEM "CADASTROS"
        TREE
            TREEITEM "Empresa"
            TREEITEM oItem1 PROMPT "Agenda Telefônica" ACTION MSGALERT()
            TREEITEM oItem PROMPT "Clientes"
            TREEITEM oItem PROMPT "Operadores"
        ENDTREE 
    ENDTREE
 


Where would you put a different action for each item, but in this case the "ACTION" added to the item does not respond, it's as if it did not.
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
Otto
Posts: 6400
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: Tree xBrowse Menu

Post by Otto »

oBrwMENU:oFont := ARIAL14B

Hello Christiano,
can you please explain the logic how you handle FONTs.
ARIAL14B
Do you use DEFINE or how do you do.


Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Tree xBrowse Menu

Post by ctoas »

Hello Otto.

That's right, I use DEFINE.

Code: Select all | Expand


DEFINE FONT ARIAL14B NAME "Arial" SIZE 0,-14 BOLD
PUBLIC ARIAL14B
 
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 10712
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Tree xBrowse Menu

Post by nageswaragunupudi »

1) Change 3rd column of aMenu as a codeblock.
Example:

Code: Select all | Expand


{ 1, "Empresas", { |o|F1001() } },
 


2) Change

Code: Select all | Expand


TREEITEM aMENU[i][2]
 

as

Code: Select all | Expand


TREEITEM oItem PROMPT aMENU[i][2]
oItem:bAction := aMenu[i][3]
 


3) Assign this codeblock (as Mr Adolofo suggested)

Code: Select all | Expand


oBrw:aCols[ 1 ]:bLDClickData := { |r,c,f,o| If( o:oBrw:oTreeItem:oTree == nil,,;
                                  ( o:oBrw:oTreeItem:Toggle(), o:oBrw:Refresh() ) ), ;
                                  XEval( o:oBrw:oTreeItem:bAction, o:oBrw:oTreeItem ) } )
 

Note: From FWH1802, it will be necessary to add this codeblcock. We are incorporating this into xbrowse
Regards

G. N. Rao.
Hyderabad, India
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Tree xBrowse Menu

Post by ctoas »

Hello friends...

It worked perfectly, thank you.
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: Tree xBrowse Menu

Post by cnavarro »

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Tree xBrowse Menu

Post by ctoas »

Hello friends

I think I am a little rusty and I need help in this old case and I need two more situations that I couldn't put it:
1) Add a BMP in resource on each line;
2) Activate the function in the array with an [Enter].

I appreciate any help.

PS .: C. Navarro, I looked at your linked post and found nothing.
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 10712
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Tree xBrowse Menu

Post by nageswaragunupudi »

1) Add a BMP in resource on each line;


Same way you put bitmaps in other xbrowses.

2) Activate the function in the array with an [Enter].


Code: Select all | Expand

oBrw:bKeyChar := {|nKey| If( nKey == 13, ( XEval( oBrw:oTreeItem:bAction ), 0), nil ) }
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Tree xBrowse Menu

Post by ctoas »

Thanks for answering Rao.

It didn't work, maybe I didn't know how to express myself.

Regarding the bitmap on each line, it would be like an icon on each line based on the assembly array.

{0 , "IMG_AGENDA", "AGENDA", {| o | AGENDA ()}
{Level, image , title , function }


I think of something like this:

Code: Select all | Expand

oItem:AddImage:= aMenu[i][2]


But I didn't find anything in the class.

With respect to running the function with Enter, the code below works, but without it I can expand or retract the menu options with Enter, which does not work when added.

Code: Select all | Expand


oBrw:bKeyChar: = {| nKey | If (nKey == 13, (XEval (oBrw:oTreeItem:bAction), 0), nil)}
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Tree xBrowse Menu

Post by ctoas »

Hello friends...

Problems solved, although the image issue didn't look the way I wanted, it was fine.

Thank you all.
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
ctoas
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Tree xBrowse Menu (ONE MORE)

Post by ctoas »

Hello friends!!

In this menu where the images are in this line, I can replace them with common characters, like "+", "-" and ">" ???

Code: Select all | Expand

oBrwMENU:aCols[1]:AddResource({"TREE_MENU_MENOS","TREE_MENU_MAIS","TREE_MENU_OPCAO"})


I've already looked, but maybe through carelessness I didn't find how to do it.

Thanks
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
Post Reply