Tree as menu : how have the value nOpt ?

Tree as menu : how have the value nOpt ?

Postby Silvio.Falconi » Mon Sep 30, 2024 7:53 am

the test

Image


Code: Select all  Expand view  RUN

#include "fivewin.ch"
#include "constant.ch"



Function test2()
     local  oDlg,oBar,oBar2,oFont,oBold,oLbx,oTree
     local  nBottom   := 35
     local  nRight    := 90
     local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
     local  nHeight := nBottom * DLG_CHARPIX_H
     local cTitle:= "test"
     local oBtnConfirm,oBtnClose,oBtnAiuto
     local nClrText := CLR_BLACK
      local nOpt
     local cdata:= dtoc(date())

     DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 12
     DEFINE FONT oBold NAME "MS Sans Serif" SIZE 0, 12 BOLD


     DEFINE DIALOG  oDlg ;
      SIZE nWidth, nHeight  PIXEL  ;
      TITLE cTitle  RESIZABLE
 @ 100,10 BUTTON oBtnConfirm PROMPT "Conferma" of oDlg SIZE 45,15 DEFAULT ACTION (oDlg:end( IDOK  ) )
      @ 100,10 BUTTON oBtnClose PROMPT "Annulla" of oDlg  SIZE 45,15 CANCEL ACTION ( oDlg:end( IDCANCEL ) )
      @ 100,10 BUTTON oBtnAiuto PROMPT "Aiuto" of oDlg  SIZE 45,15 CANCEL ACTION NIL

      oDlg:bResized  := <||
             local oRect        := oDlg:GetCliRect()
                oBtnConfirm:nTop   := oRect:nBottom - 40
                oBtnConfirm:nLeft  := oRect:nRight - 310
                oBtnClose:nTop     := oRect:nBottom - 40
                oBtnClose:nLeft    := oRect:nRight - 210
                oBtnAiuto:nTop     := oRect:nBottom - 40
                oBtnAiuto:nLeft    := oRect:nRight - 110

        return nil
        >
ACTIVATE DIALOG oDlg CENTER;
   ON INIT  (AddItems( oDlg,oTree,@nOpt),eval(oDlg:bResized))


              ? nOpt

RETURN NIL
function AddItems(oDlg,oTree,nOpt )

   local oItem1, oItem2, oItem3,oItem4,oItem5
   local oImageList := TImageList():New()


   oImageList := TImageList():New()

                   oImageList:AddImage("open.png")
                   oImageList:AddImage("arrow.png")

   @ 15, 1 TREEVIEW oTree OF oDlg SIZE 190, 180
              oTree:SetImageList( oImageList )


   oItem1 = oTree:Add( "Estratti",0 )
        oItem1:Add( "Numeri dispari",1, {|| nOpt:=1 } )
        oItem1:Add( "Numeri Fibonacci",1, {|| nOpt:=2 }  )
        oItem1:Add( "Numeri pari tutti",1, {|| nOpt:=3 }  )
        oItem1:Add( "Numeri primi",1, {|| nOpt:=4 } )
        oItem1:Add( "Numeri tutti" ,1, {|| nOpt:=5 } )

   oItem2 = oTree:Add( "Ambi"  )
   oItem2:Add( "Ambi al quadrato" ,1, {|| nOpt:=6 } )
   oItem2:Add( "World", 1, {|| nOpt:=7 } )

   oItem3 = oTree:Add( "Terzine" )
   oItem3:Add( "Last" ,1, {|| nOpt:=8 } )
   oItem3:Add( "item" ,1, {|| nOpt:=9 } )

   oItem4 = oTree:Add( "Quartine" )
   oItem4:Add( "Last" ,1, {|| nOpt:=10 } )
   oItem4:Add( "item" ,1, {|| nOpt:=11 } )
return nil



 


I wish have the value nOpt
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Tree as menu : how have the value nOpt ?

Postby Antonio Linares » Mon Sep 30, 2024 8:46 am

Dear Silvio,

What is it nOpt ? What value should contain ?

The currently selected item ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Tree as menu : how have the value nOpt ?

Postby Antonio Linares » Mon Sep 30, 2024 8:52 am

Our dear Otto posted on a wrong thread:
Silvio, I have the feeling that treeview is not a particularly supported class.
Wouldn't you be better off using xbrowse with indentation? I use xbrowse instead of treeview.
Regards,
Otto

Class TTreeView is actively suported in fact we have greatly updated to develop "BuildIt" the AI + FWH apps generator :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Tree as menu : how have the value nOpt ?

Postby Silvio.Falconi » Mon Sep 30, 2024 11:26 am

Antonio Linares wrote:Our dear Otto posted on a wrong thread:
Silvio, I have the feeling that treeview is not a particularly supported class.
Wouldn't you be better off using xbrowse with indentation? I use xbrowse instead of treeview.
Regards,
Otto

Class TTreeView is actively suported in fact we have greatly updated to develop "BuildIt" the AI + FWH apps generator :-)



right
oExplPanel:AddLink( "Load App", { || LoadApp() } )

I made the same only I assign to nOpt a value
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Tree as menu : how have the value nOpt ?

Postby Silvio.Falconi » Mon Sep 30, 2024 11:27 am

Antonio Linares wrote:Dear Silvio,

What is it nOpt ? What value should contain ?

The currently selected item ?


a number

oItem1:Add( "Numeri dispari",1, {|| nOpt:=1 } )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 97 guests