Author: sh-sh-sh Date: Tue Dec 11 18:39:48 2007 New Revision: 42983 URL: http://svn.opensuse.org/viewcvs/yast?rev=42983&view=rev Log: Fixed bug #347634: Cannot pass empty string to editable ComboBox Added: trunk/core/libyui/doc/examples/ComboBox-set-empty.ycp Modified: trunk/core/libyui/src/YCPPropertyHandler.cc trunk/core/package/yast2-core.changes Added: trunk/core/libyui/doc/examples/ComboBox-set-empty.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/doc/examples/ComboBox... ============================================================================== --- trunk/core/libyui/doc/examples/ComboBox-set-empty.ycp (added) +++ trunk/core/libyui/doc/examples/ComboBox-set-empty.ycp Tue Dec 11 18:39:48 2007 @@ -0,0 +1,44 @@ +// Create a combo box with three entries. +// All entries have IDs to identify them independent of locale +// (The texts might have to be translated!). +// Entry "Funghi" will be selected by default. +{ + UI::OpenDialog( + `VBox( + `ComboBox(`id(`pizza), `opt(`editable), + "Select your Pizza:", + [ + `item(`id(`nap), "Napoli" ), + `item(`id(`fun), "Funghi", true ), + `item(`id(`sal), "Salami" ) + ] ), + `PushButton(`id(`empty), "&Empty"), + `PushButton(`id(42), "42"), + `PushButton(`id(`ok),"&OK") + ) + ); + + any button = nil; + + repeat + { + y2debug( "Waiting" ); + button = UI::UserInput(); + y2debug( "button: %1", button ); + + if ( button == 42 ) + UI::ChangeWidget(`pizza, `Value, 42 ); + + if ( button == `empty ) + UI::ChangeWidget(`pizza, `Value, "" ); + } until ( button == `ok ); + + + // Get the input from the selection box. + // + // Notice: The return value of UI::UserInput() does NOT return this value! + // Rather, it returns the ID of the widget (normally the PushButton) + // that caused UI::UserInput() to return. + any pizza=UI::QueryWidget(`id(`pizza), `Value); + y2milestone( "Selected %1", pizza ); +} Modified: trunk/core/libyui/src/YCPPropertyHandler.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCPPropertyHandle... ============================================================================== --- trunk/core/libyui/src/YCPPropertyHandler.cc (original) +++ trunk/core/libyui/src/YCPPropertyHandler.cc Tue Dec 11 18:39:48 2007 @@ -387,7 +387,12 @@ { if ( comboBox->editable() ) { - if ( val->isString() || val->isInteger() ) + if ( val->isString() ) + { + comboBox->setValue( val->asString()->value() ); + return true; + } + else if ( val->isInteger() ) { comboBox->setValue( val->toString() ); return true; Modified: trunk/core/package/yast2-core.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?r... ============================================================================== --- trunk/core/package/yast2-core.changes (original) +++ trunk/core/package/yast2-core.changes Tue Dec 11 18:39:48 2007 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Tue Dec 11 18:39:03 CET 2007 - sh@suse.de + +- Fixed bug #347634: Cannot pass empty string to editable ComboBox + +------------------------------------------------------------------- Tue Dec 11 18:22:22 CET 2007 - sh@suse.de - Fixed byproduct of fix for bug #346158 and bug #346165: -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org