glade aboutDialog doesn't close - gtk

I have an AboutDialog box made in glade, but the Close button doesn't work. I don't know how to connect this button to a separate function, since it sits in a widget called dialog-action_area.
Another problem is if I use the close button created by the window manager, I can't open it again because it has been destroyed.
How can I change this so it just hides?

As any other Dialog window, they require you to
Make use of the run method.
Make use of the "reponse" signal
The first will block the main loop and will return as soon as the dialog receives a response, this may be, click on any button in the action area or press Esc, or call the dialog's response method or "destroy" the window, the last don't mean that the window wil be destroyed, this means that the run() method will exit and return a response. like this:
response = dialog.run()
If you use a debugger, you will notice that the main loop stays there until you click on a button or try to close the dialog. Once you have received yout response, then you can useit as you want.
response = dialog.run()
if response == gtk.RESPONSE_OK:
#do something here if the user hit the OK button
dialog.destroy()
The second allow you to use the dialog in a non-blocking stuff, then you have to connect your dialog to the "response" signal.
def do_response(dialog, response):
if response == gtk.RESPONSE_OK:
#do something here if the user hit the OK button
dialog.destroy()
dialog.connect('response', do_response)
Now, you notice that you have to destroy your dialog

You need to call the widget's hide() method when you receive delete or cancel signals:
response = self.wTree.get_widget("aboutdialog1").run() # or however you run it
if response == gtk.RESPONSE_DELETE_EVENT or response == gtk.RESPONSE_CANCEL:
self.wTree.get_widget("aboutdialog1").hide()
You can find the Response Type constants in the GTK documentation

Related

How can I disable the Close button of a waitbar in MATLAB?

I want to create a waitbar that should be processed without any interruption. How can I achieve this?
I have tried setting
h=waitbar(0,'please wait','CreateCancelBtn','setappdata(gcbf,''Cancel'',0)');
This disables the Close button on the waitbar, but it also shows me a Cancel button too. I don't want that button.
When you use the CreateCancelBtn option of waitbar, it creates a Cancel button, takes the string you supply, and then sets that string to be both the Callback of the Cancel button (i.e. the thing that happens when you press the button) and the CloseRequestFcn of the figure window (i.e. the thing that happens when you click the Close button on the window frame).
You can avoid this by just directly setting the CloseRequestFcn of the figure window yourself:
h = waitbar(0,'Please Wait...');
h.CloseRequestFcn = '';
The Close button is now disabled.
Bear in mind that the CloseRequestFcn is also what gets executed when you call close(h), so you now won't be able to close it with close(h). You can either call delete(h) instead, or you can make sure that before you call close(h) you reset the CloseRequestFcn back to the default, which is the buit-in function closereq (type edit closereq to see what this does, it basically just calls delete anyway).
Hope that helps!

how to know when an action was performed and close automatically the modal

Let's consider the situation where we send, for example, a request and we are waiting a response.
While we are waiting a modal pops-up with a glyphicon, showing that the request is being processed. The result of this process is going to be an object, when it is null it means that the request was accepted with success, otherwise this object will come with an error message.
I would like to close the modal after receiving the notification, no matter if it was successful or not
can anyone give me an hint of java and wicket?
Wicket gives you full control over ajax request life-cycle and you can implement your own listener as shown in the user guide
If you want to close the modal window after notification recieved, you can make this modal window invinsible, just:
public void recieveNotification(AjaxRequestTarget target) {
Notification notification = service.getNotification;
target.add(modalWindow.setVisible(false));
}
and you wouldn't see it.

Vaadin (7.0.5) Window not opening until end of calling procedure

I am trying to open a modal window during a click handler to verify the user action but the window doesn't appear until the handler completes. The window code can be as simple as the following and it still will not display so it isn't something to do with my abstract class.
Window w = new Window();
w.setModal(true);
w.setImmediate(true);
// Add components etc etc
UI.getCurrent().addWindow(w);
I could add the action code to the windows OK/Yes handler but that would stop me creating a generic Message class to simplify/stop code duplication.
I am guessing there is something I dont understand about how Vaadin/GWT works (still a newbie!), could someone point me in the right direction?
Cheers
For UI stuff, you have to stop thinking of sequencial programming,
better to think about event-driven concepts.
For Vaadin you could create a Dialog Window which asks the yes/no question.
In you app you create this dialog and display it.
And you attach a event-handler which is fired when the user clicks yes/no,
and inside this handler you then do the required actions in your code.
You can also look at this add-on
https://vaadin.com/de/directory#addon/confirmdialog
The right direction is architecture overview https://vaadin.com/book/vaadin7/-/page/architecture.html#architecture.overview
In other words your code makes only response from server side, but only client side can show "modal" window.
In your case you have to create handler for ok button click event and wait for this event

lift disabling back button actions

I'm creating a transaction related site using lift. In here, there's a requirement to show a success page after the user action.
when i make action happen and press the browser's back button. it again goes to the previous page(before transaction page) making the transaction doable again. I need to limit this behavior. Is there any way of limiting the access to previous page by browser back button in lift.
There is no way to reliably stop the user from returning to the URL, but you can stop them from invoking the action more than once. Take a look at S.oneShot. From the Scala Doc:
All functions created inside the oneShot scope will only be called
once and their results will be cached and served again if the same
function is invoked
If you wrap the function that occurs when the button is pressed, even if the user does return to the page and click the button a second time, the body of the function shouldn't be invoked again.

How to cancel SWFUpload dialog open?

I have a situation where it is somtimes not appropriate to upload files (The page elements need to be in some conditions for the user to be able to upload files). In that case, I want to show the user alert box explaining the reason without opening the file select dialog box.
So what I want to do is,
function beforeDialogOpen() {
if ($('#txt1').val().length == 0)
alert('Please fill in the field first.');
return false; // cancel
else
return true; // proceed
}
set this event handler.
I would simply hide the SWFUpload flash button and put another html on it's place that looks just the same. In the click event you display your error message.
Or it could even have a grayed-out disabled look and simplay do nothing.