Tree xBrowse Menu (ONE MORE)

Tree xBrowse Menu (ONE MORE)

Postby ctoas » Wed Feb 21, 2018 1:43 pm

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 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.
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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Tree xBrowse Menu

Postby Adolfo » Wed Feb 21, 2018 3:05 pm

Hi ctoas


Code: Select all  Expand view

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, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Tree xBrowse Menu

Postby ctoas » Wed Feb 21, 2018 6:38 pm

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 view

    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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Tree xBrowse Menu

Postby Otto » Thu Feb 22, 2018 9:12 am

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
Otto
 
Posts: 5994
Joined: Fri Oct 07, 2005 7:07 pm

Re: Tree xBrowse Menu

Postby ctoas » Thu Feb 22, 2018 9:48 am

Hello Otto.

That's right, I use DEFINE.

Code: Select all  Expand view

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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Tree xBrowse Menu

Postby nageswaragunupudi » Thu Feb 22, 2018 3:26 pm

1) Change 3rd column of aMenu as a codeblock.
Example:
Code: Select all  Expand view

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


2) Change
Code: Select all  Expand view

TREEITEM aMENU[i][2]
 

as
Code: Select all  Expand view

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


3) Assign this codeblock (as Mr Adolofo suggested)
Code: Select all  Expand view

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
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tree xBrowse Menu

Postby ctoas » Fri Feb 23, 2018 7:25 pm

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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Tree xBrowse Menu

Postby cnavarro » Sat Mar 10, 2018 8:05 pm

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
cnavarro
 
Posts: 6498
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Tree xBrowse Menu

Postby ctoas » Thu May 21, 2020 2:26 am

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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Tree xBrowse Menu

Postby nageswaragunupudi » Thu May 21, 2020 3:42 am

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 view
oBrw:bKeyChar := {|nKey| If( nKey == 13, ( XEval( oBrw:oTreeItem:bAction ), 0), nil ) }
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tree xBrowse Menu

Postby ctoas » Sun May 24, 2020 1:20 am

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 view
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 view

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

Re: Tree xBrowse Menu

Postby ctoas » Tue May 26, 2020 12:20 am

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

Re: Tree xBrowse Menu (ONE MORE)

Postby ctoas » Mon Jun 14, 2021 6:01 pm

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 view
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
User avatar
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 18 guests