Because WComboBox widget is presented as html <SELECT>, then it is not possible to add an element and do not select it. Ie if in WComboBox there is one element it must be selected.
2010/12/27 Simon <[email protected]>: > On Thu, Dec 23, 2010 at 1:23 AM, Aleksey Chirkin <[email protected]> wrote: >> Hello! >> >> ~~~~ >> >> Wt::WComboBox* cBox = new Wt::WComboBox(this); >> cBox->addItem("item1"); >> >> std::cout << "cBox currentText = '" << cBox->currentText() << "'\n"; >> std::cout << "cBox currentIndex = " << cBox->currentIndex() << "\n"; >> >> ~~~ returns >> >> cBox currentText = '' >> cBox currentIndex = -1 >> >> ~~~~ > > Check the example in this page: > http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WComboBox.html#_details > > You're missing this line: > combo->setCurrentIndex(2); > > I believe the currentIndex() of -1 is useful to determine there was no > choice made by the user yet, in case you implement a timeout or > something like that. > > HTH, > Simon > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
