
# Test to see if we can create a new panel.
appExtend {
    *test_objects:\
	toplevel	TopLevelShell	testPanel\
	testPanel	Form		testForm\
	testForm	Label		testLabel\
	testForm	Command		testQuit

    *testPanel.geometry:		250x40
    *testLabel.label:			Hello, world!
    *testQuit.fromHoriz:		testLabel
    *testQuit.label:			Quit
}
createObjects test_objects


#------------------------------------------------------------------------------
# Test to see if we can add a widget to an existing widget tree, i.e. create
# a widget and assign an existing parent.  Try adding a new button to the
# ximtool panelbar.

appExtend {
    *par_objects:\
        panelbar        Toggle          pbTest
	
    *pbTest.label:			TESTING
}
createObjects par_objects

# change the layout to include the new widget.
#send panelbar unmap
send panelbar set layout "horizontal \{ \
        pbTest     < +inf -inf * > 1 < -1 > \
        pbDisplayP < +inf -inf * > 1 < -1 > \
        pbPrintP   < +inf -inf * > 1 < -1 > \
        pbLoadP    < +inf -inf * > 1 < -1 > \
        pbSaveP    < +inf -inf * > 1 < -1 > \
        pbInfoP    < +inf -inf * > 1 < -1 > \
        pbTileP    < +inf -inf * > 1 < -1 > \
        pbCoordP   < +inf -inf * > 1 < -1 > \
        pbPanM     < +inf -inf * > 1 < -1 > \
        pbMagM     < +inf -inf * > 1 < -1 > \
        pbWcsM     < +inf -inf * > 1 < -1 > \
        pbIsm      < +inf -inf * > 1 < -1 > \
        helpButton < +inf -inf * > 1 < -1 > \
        pbQuit     < +inf -inf * > 1 < -1 > \
    \}"
#send panelbar map

# Do the callbacks
proc testToggle { widget type state args } \
{
    if {$state} { send testPanel map } else { send testPanel unmap }
} ; send pbTest addCallback testToggle
send testQuit addCallback "send testPanel unmap; send pbTest set state False"
