I have changed FWH/Samples/TestTre2.prg like below.
When the focus is Page-1, The Test1 function could not be called. But "xBase & OOPS" that is under Page-1 calls the Test1.
How Can I solve my problem.
Thanks,
Code: Select all
// -- testtre2.prg
// WinAPI Trees (SysTreeView32) !!!
// Window with a Tree, a Vertical Splitter & a resizable dialog
#include "FiveWin.ch"
#include "Splitter.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd, oDlg, oBar, oTree, oItem1, oItem2, oImageList, oSplit
DEFINE WINDOW oWnd FROM 3, 6 TO 20, 70 ;
TITLE "Welcome to " + FWVERSION COLOR "N/W"
oTree := TTreeView():New( 2, 0, oWnd )
oTree:bChanged := {|oTree,oItem| ;
oWnd:SetText( If( oTree:GetSelected():GetParent() != nil,;
oTree:GetSelected():GetParent():cPrompt + " + ", "" ) + ;
oTree:GetSelText() ), ;
oItem := oTree:GetSelected(), ;
If( oItem # nil .and. ValType( oItem:cargo ) == "B", Eval( oItem:cargo ), nil ) }
oItem1 := oTree:Add( "Page - 1", 1, {|| Test1( oDlg )})
oItem1:Add( "xBase & OOPS", 1, {|| Test1( oDlg ) } )
oItem2 := oTree:Add( "Page - 2", 1, {|| Test2( oDlg )})
DEFINE DIALOG oDlg OF oWnd ;
STYLE nOR( WS_CHILD, WS_VISIBLE ) ;
@ 29, 200 SPLITTER oSplit ;
VERTICAL _3DLOOK ;
PREVIOUS CONTROLS oTree ;
HINDS CONTROLS oDlg ;
SIZE 4, 200 PIXEL ;
LEFT MARGIN 20 ;
RIGHT MARGIN 25 ;
OF oWnd
ACTIVATE DIALOG oDlg NOMODAL
ACTIVATE WINDOW oWnd ;
ON INIT ( oDlg:Move( 0, oSplit:nRight, oWnd:nWidth, oWnd:nHeight, .f. ), ;
oWnd:bResized := {|| oSplit:AdjClient(), oDlg:SetSize( oWnd:nWidth - oTree:nWidth - oSplit:nWidth - 8, oSplit:nHeight - 1, .t. ) }, ;
oDlg:refresh(.t.), oTree:refresh(.t.) ) // required so that objects around splitter paint correctly on init
oImageList:End()
return nil
//----------------------------------------------------------------------------//
static function CleanSlate( oDlg )
while Len( oDlg:aControls ) > 0
ATail( oDlg:aControls ):end()
end
return nil
//----------------------------------------------------------------------------//
static function Test1( oDlg )
Local oGet1, oGet2
Local cGet1 := PadR( "Type something!", 50 )
Local cGet2 := PadR( "Type something else!", 50 )
CleanSlate( oDlg )
@ 5,10 Say "Some data:" Of oDlg Pixel
@ 3,70 Get oGet1 Var cGet1 Of oDlg Pixel ;
Size 150,22
@ 30,10 Say "Other data:" Of oDlg Pixel
@ 28,70 Get oGet2 Var cGet2 Of oDlg Pixel ;
Size 150,22
Return nil
//----------------------------------------------------------------------------//
static function Test2( oDlg )
Local oCbx1, oChk1
Local cCbx1 := "", lChk1 := .t.
CleanSlate( oDlg )
@ 5,10 Say "Choose:" Of oDlg Pixel
@ 3,70 Combobox oCbx1 Var cCbx1 Of oDlg Pixel ;
Items { "Uno", "Dos", "Tres", "Mambo!" } ;
Size 80,18
@ 28,70 Checkbox oChk1 Var lChk1 Of oDlg Pixel ;
Prompt "Tick tock tick tock" ;
Size 150,22
Return nil
//----------------------------------------------------------------------------//
procedure AppSys // Xbase++ requirement
return
//----------------------------------------------------------------------------// 9