[yast-devel] A few questions about libYUI
Hi I am trying a few things in libYUI to ask of 1. How to set a value in a ComboBox? I have tried with both editable and non-editable comboBoxes I have a YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Manu"); In this case, the value Manu is not set and highlighted Now lets take this case YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah"); Same thing blah is not highlighted case 3 YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah"); I get a YUI::Exception So if anyone can cross check this case and let me know if it is a bug or not? Second Question is related to event handling If a selection in a comboBox changes, how would I able to recognise it Currently I follow this approach YDialog * dialog = YUI::widgetFactory->createDialog(); YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); YWidgetEvent * event = (YWidgetEvent*)dialog->waitForEvent(); while(1){ if(event->reason()==SelectionChanged){ cout<<"XYZ"; } }; this does not seem to work ie the dialog is not recognising changes in my combobox, how do I solve them? -- Regards Manu Gupta -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
---------- Forwarded message ---------- From: Manu Gupta <manugupt1@gmail.com> Date: Thu, Jun 23, 2011 at 2:58 AM Subject: A few questions about libYUI To: yast-devel@opensuse.org Hi I am trying a few things in libYUI to ask of 1. How to set a value in a ComboBox? I have tried with both editable and non-editable comboBoxes I have a YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Manu"); In this case, the value Manu is not set and highlighted Now lets take this case YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah"); Same thing blah is not highlighted case 3 YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah"); I get a YUI::Exception So if anyone can cross check this case and let me know if it is a bug or not? Second Question is related to event handling If a selection in a comboBox changes, how would I able to recognise it Currently I follow this approach YDialog * dialog = YUI::widgetFactory->createDialog(); YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); YWidgetEvent * event = (YWidgetEvent*)dialog->waitForEvent(); while(1){ if(event->reason()==SelectionChanged){ cout<<"XYZ"; } }; this does not seem to work ie the dialog is not recognising changes in my combobox, how do I solve them? -- Regards Manu Gupta -- Regards Manu Gupta -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Thu, Jun 23, 2011 at 02:58:01AM +0530, Manu Gupta wrote:
Hi
I am trying a few things in libYUI to ask of
1. How to set a value in a ComboBox? I have tried with both editable and non-editable comboBoxes
http://doc.opensuse.org/projects/libyui/HEAD/classYComboBox.html says: In non-editable mode, a ComboBox works very much like a SelectionBox that uses fewer screen space. In that mode, it is recommended to use selectedItem() to retrieve its current value and selectItem() to set it. In editable mode, a ComboBox is more like an InputField with a list to pick predefined values from (for less typing). In that mode, it is recommended to use value() and setValue().
I have a YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Manu");
In this case, the value Manu is not set and highlighted
Now lets take this case YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah");
Same thing blah is not highlighted
I think both should work.
case 3 YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah");
I get a YUI::Exception
That is as expected, for non-editable comboboxes selectItem should be used.
So if anyone can cross check this case and let me know if it is a bug or not?
Second Question is related to event handling
If a selection in a comboBox changes, how would I able to recognise it
Currently I follow this approach YDialog * dialog = YUI::widgetFactory->createDialog(); YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); YWidgetEvent * event = (YWidgetEvent*)dialog->waitForEvent(); while(1){ if(event->reason()==SelectionChanged){ cout<<"XYZ"; } };
this does not seem to work ie the dialog is not recognising changes in my combobox, how do I solve them?
Maybe you need to set the boolean Notify property? http://doc.opensuse.org/projects/YaST/openSUSE11.3/tdg/AAA_All-Widgets.html http://svn.opensuse.org/viewvc/yast/trunk/libyui/src/YWidget.cc?revision=60778&view=markup#l418 Hmm, the @property tags in the source are not handled by any docs generator AFAICT. Prashanth, it would be good to enable that. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
On Wednesday, June 22, 2011 11:28:01 pm Manu Gupta wrote:
Hi
I am trying a few things in libYUI to ask of
1. How to set a value in a ComboBox? I have tried with both editable and non-editable comboBoxes
I have a YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Manu");
In this case, the value Manu is not set and highlighted
Now lets take this case YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",true); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah");
Same thing blah is not highlighted
case 3 YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); cc->addItem("XYZ"); cc->addItem("Blah"); cc->setValue("Blah");
I get a YUI::Exception
So if anyone can cross check this case and let me know if it is a bug or not?
Second Question is related to event handling
If a selection in a comboBox changes, how would I able to recognise it
Currently I follow this approach YDialog * dialog = YUI::widgetFactory->createDialog(); YComboBox * cc = YUI::widgetFactory(dialog,"SELECT",false); YWidgetEvent * event = (YWidgetEvent*)dialog->waitForEvent(); while(1){ if(event->reason()==SelectionChanged){ cout<<"XYZ"; } };
this does not seem to work ie the dialog is not recognising changes in my combobox, how do I solve them?
For setting a ComboBox value please have a look at YCPPropertyHandler::trySetComboBoxValue() in http://svn.opensuse.org/svn/yast/trunk/ycp-ui- bindings/src/YCPPropertyHandler.cc Concerning your second question it might make sense to move the line that retrieves event into the loop. Hope that helps. Please feel free to ask if you have further questions. Cheers, Thomas -- Thomas Goettlicher SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Maxfeldstraße 5 90409 Nürnberg Germany -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (3)
-
Manu Gupta
-
Martin Vidner
-
Thomas Goettlicher