- Code: Select all Expand view
#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