Mailinglist Archive: yast-devel (55 mails)

< Previous Next >
[yast-devel] Libyui How to use RadioButton and RadioGroupButton
  • From: Manu Gupta <manugupt1@xxxxxxxxx>
  • Date: Sun, 27 Mar 2011 15:57:48 +0530
  • Message-id: <AANLkTi=xqB8X+qe-rCgwtxFPU7sOfPhc=jR-=gmSSjtP@mail.gmail.com>
Hi All

I have been trying to use RadioButton and RadioButtonGroup using
libyui but I am unable to do so Can anyone have a look at my code and
tell me how do I do it?


--
Regards
Manu Gupta
#include<iostream>
//#include<stdlib.h>
#define YUILogComponent "quizgame"
#include "YUILog.h"
#include "YUI.h"
#include "YWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
#include "YRadioButtonGroup.h"
#include "YRadioButton.h"
#include "YLabel.h"
#include "YPushButton.h"
#include "YEvent.h"
#include "YAlignment.h"
#include "YMenuItem.h"
#include "YMenuButton.h"

#include "base.h"

YItemCollection fillMenu(){
YItemCollection items;
items.push_back( new YMenuItem("&Close"));
return items;
}

int main(){
// item("Manu","Gagan","Tiger","Lion","Duck",4).getAnswer(4);

YUILog::setLogFileName("/tmp/quiz/quiz.log");
YUILog::enableDebugLogging();


YDialog * dialog = YUI::widgetFactory()->createPopupDialog();
YAlignment * minSize =
YUI::widgetFactory()->createMinSize(dialog,100,4);
YLayoutBox * mbox = YUI::widgetFactory()->createVBox(minSize);

YAlignment * margin = YUI::widgetFactory()->createMarginBox(mbox,1,1);


YLayoutBox * vbox = YUI::widgetFactory()->createVBox(margin);

YMenuButton * mFile =
YUI::widgetFactory()->createMenuButton(YUI::widgetFactory()->createLeft(vbox),"&File");
//MenuItem * item = new YMenuItem("&Close");
mFile->addItems(fillMenu());

YLabel * question =
YUI::widgetFactory()->createLabel(YUI::widgetFactory()->createLeft(vbox),"Manu
akjsdhkashd adsk askdjksahd ksa dkhdsakjdsa dsa");


YRadioButtonGroup * ansGroup =
YUI::widgetFactory()->createRadioButtonGroup(YUI::widgetFactory()->createLeft(vbox));
YRadioButton * ans1 =
YUI::widgetFactory()->createRadioButton(YUI::widgetFactory()->createLeft(vbox),"ANS
1dasda da dsa daslk sad lsakjd ldks ");
YRadioButton * ans2 =
YUI::widgetFactory()->createRadioButton(YUI::widgetFactory()->createLeft(vbox),"ANS
2 sadkjhsakjd sakdhj dsakasdhk sadhlkdsa");
YRadioButton * ans3 =
YUI::widgetFactory()->createRadioButton(YUI::widgetFactory()->createLeft(vbox),"ANS
3 asdljsald sad lasjdlkas d adlsjlkd ");
YRadioButton * ans4 =
YUI::widgetFactory()->createRadioButton(YUI::widgetFactory()->createLeft(vbox),"ANS
4");
ansGroup->addRadioButton(ans1);
ansGroup->addRadioButton(ans2);
ansGroup->addRadioButton(ans3);
ansGroup->addRadioButton(ans4);


YPushButton * nextButton =
YUI::widgetFactory()->createPushButton(YUI::widgetFactory()->createRight(vbox),"&Next");
YEvent * event = dialog->waitForEvent();

return 0;
}
< Previous Next >
List Navigation
Follow Ups