I want to create a dialog using Glade 3 (or gtk and Python). In Glade 2 if you wanted to create a dialog box there was an option to set a "standard button layout" which would automatically create an Ok button and a Cancel button which return either gtk.RESPONSE_OK or gtk.REPONSE_CANCEL. This feature has not been reimplmented in Glade 3.
How can I create a dialog which will have ok and cancel buttons which return the correct response?
Cheers,
Pete
You can create them manually in Glade; the response code can unfortunately only be set to a number. The numbers you need are here: OK is -5, Cancel is -6.
Or you can create it in code:
dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL,
buttons=gtk.BUTTONS_OK_CANCEL,
message_format='Are you sure you want to reticulate the splines?')
response = dialog.run()
dialog.destroy()
Related
Trying to automate amazon affiliate report generation. cannot change the value of a checkbox
need to mark this checkbox
this is HTML of that checkbok
radio = driver.find_element_by_xpath(
"//input[#value='custom' and #name='ac-daterange-radio-report-download-timeInterval']")
driver.execute_script("arguments[0].click();", radio)
# driver.execute_script(
# "arguments[0].setAttribute('checked', 'checked';", radio)
If more clarity needed can ask here.
thanks in advance
You are not sending click event to java script executor, instead of this you directly click by .click() method. If you want to click one of the checkbox you use one of the following commands, change the text contains: Today, Yesterday and other. See this:
driver.find_element_by_xpath("//span[contains(text(), 'Today')]/ancestor::label/input").click()
driver.find_element_by_xpath("//span[contains(text(), 'Yesterday')]/ancestor::label/input").click()
driver.find_element_by_xpath("//span[contains(text(), 'Custom Date Range')]/ancestor::label/input").click()
I wish to save information entered by user on my form using a dialogue box.
Dialog d=new.dialog();
d.show("save info","Do you want to save?","OK","Cancel");
Can i add a textfield (edit-textbox) in the dialog box for the user to enter the desired name (alphanumeric) before pressing ok. and if not interested he can simply cancel. I will be saving the information as a hashtable in an object with user selected name.
If it cannot be done in dialog what is the next best way. pl add a piece of code or tutorial for better understanding.
Its a mobile app developed in Codename one. Therefore, even LWUIT users can help.
thanks
try this:
Textfield myTF = new textfield();
Dialog abc = new Dialog();//how ever u wish to initialize it
abc.addComponenet(myTF);//add text field to dialog
abc.show();//show dialog.
Note: Dialog extends a Form. so u get the propertied of a form in your dialog.
I'm Working on Ruby on rail 3.1 with Netzke 0.7.4 and Cucumber.
I use Cucumber with Netzke it work great but I have found some problem on choose radio step.
I use this step.
When /^(?:|I )choose "([^"]*)"$/ do |field|
choose(field)
end
It show this error message.
And choose 'Yes' for GST field
cannot choose field, no radio button with id, name, or label 'Yes' found (Capybara::ElementNotFound)
(eval):2:in `choose'
It's look like choose(locator) method can't find any radio button on my page.
That very strange because it have only 2 radio on page.
Question is how can I do with this radio?
Thanks.
Finally I have found answer I search check box instead of combo box and it work.
Is ExtJs 4 transform check box to radio?
How can I display a messagebox like the Microsoft error message in C#.net
The message box should have an OK button and an Show details button.
The Show details button should display the error details. Is there a built in class for this?
Thank you
There isn't a standard dialog to do this; you'll have to create your own Form and display it with a ShowDialog.
You can have the Click event of the 'Details' button change the size of the form and toggle the visibility of the details text.
There is no built in class available to do this.
you can create a custom form with Ok and Show Details button.
set height and width as per the need.
handle click event for the button with appropriate code.
create an instance of this form and use ShowDialog() method to show the dialog box
In my code, I have lines like this:
Builder builder = new Builder();
builder.AddFromFile(gladefile);
FileChooserDialog dialog =
(FileChooserDialog) builder.GetObject("dialog");
dialog.DefaultResponse = ResponseType.Ok;
Is there a way to set the default response in the glade file, rather than doing it manually?
Yes. When you create a GtkFileChooserDialog in Glade, you add the buttons to the dialog's button box. For example, "OK" and "Cancel". To make the "OK" button default, select the "OK" button, go to the "Common" properties, and turn on "Can default" and "Has default".