From: andrew7 <bd...@us...> - 2007-02-18 14:20:48
|
Update of /cvsroot/smartwin/SmartWin/tests/WidgetComboBox In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv793/tests/WidgetComboBox Modified Files: Main.cpp Log Message: Add combo box with choices always displayed. Index: Main.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/WidgetComboBox/Main.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Main.cpp 11 Dec 2006 23:54:03 -0000 1.10 +++ Main.cpp 18 Feb 2007 14:20:44 -0000 1.11 @@ -1,9 +1,9 @@ // $Revision$ /*! \file Main.cpp - \brief Unit test for WidgetTextBox. + \brief Unit test for WidgetComboBox. - It tries to instantiate all different forms of WidgetTextBox and it also tries to use all functions. + It tries to instantiate all different forms of WidgetComboBox and it also tries to use all functions. */ #include "SmartWin.h" @@ -37,9 +37,9 @@ windowCS.caption = _T( "WidgetComboBox compile and execute test" ); createWindow( windowCS ); + // Combo box. WidgetComboBox::Seed widgetComboBoxCS; - - widgetComboBoxCS.location = SmartWin::Rectangle( 50, 50, 200, 400 ); + widgetComboBoxCS.location = SmartWin::Rectangle( 20, 50, 120, 400 ); WidgetComboBoxPtr comboBox = createComboBox( widgetComboBoxCS ); @@ -62,8 +62,9 @@ comboBox->onSelectionChanged( & WidgetTest1::selectionChanged ); + // Combo box that is disabled WidgetComboBoxPtr comboBox2 = createComboBox(); - comboBox2->setBounds( SmartWin::Point( 100, 100 ), SmartWin::Point( 200, 400 ) ); + comboBox2->setBounds( SmartWin::Point( 20, 100 ), SmartWin::Point( 120, 400 ) ); comboBox2->addValue( _T( "Disabled Value1" ) ); comboBox2->addValue( _T( "Disabled Value2" ) ); comboBox2->addValue( _T( "Disabled Value3" ) ); @@ -75,6 +76,20 @@ comboBox2->setEnabled( false ); assert( !comboBox2->getEnabled() ); + + // Combo box with the choices always displayed + WidgetComboBox::Seed listBoxSeed; + listBoxSeed.location = SmartWin::Rectangle( 160, 50, 100, 100 ); + listBoxSeed.style = WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_HASSTRINGS | WS_VSCROLL; + + WidgetComboBoxPtr listBox = createComboBox( listBoxSeed ); + listBox->addValue( _T( "Value5" ) ); + listBox->removeAllItems(); + listBox->addValue( _T( "Value1" ) ); + listBox->addValue( _T( "Value2" ) ); + listBox->addValue( _T( "Value3" ) ); + listBox->addValue( _T( "Value4" ) ); + comboBox->setFocus(); } }; @@ -85,7 +100,7 @@ WidgetTest1 * testWnd1 = new WidgetTest1; testWnd1->initAndCreate(); WidgetTest1::WidgetComboBox * freeBox = testWnd1->createComboBox(); - freeBox->setBounds( 150, 150, 100, 100 ); + freeBox->setBounds( 20, 150, 100, 100 ); freeBox->addValue( _T( "TestingFree1" ) ); freeBox->addValue( _T( "TestingFree2" ) ); freeBox->setVisible( false ); |