JavaFX Dialog Box (confirmation box) which is user can't skip - javafx-8

In my JavaFX application I want to pop up some dialog box (as confirmation box).
But I do not want to make chance user to skip that one.
That mean in many examples I have seen once Dialog Box is popup user can click out of that and can skipped it, then that dialog box is remains as it is ever.
Thanks.

To make a dialog modal (i.e. block input to other application windows), call on the dialog stage:
dialogStage.initModality(Modality.APPLICATION_MODAL)
Defines a modal window that blocks events from being delivered to any other application window.
OR
dialogStage.initModality(Modality.WINDOW_MODAL)
Defines a modal window that block events from being delivered to its entire owner window hierarchy. Note: A Stage with modality set to WINDOW_MODAL, but its owner is null, is treated as if its modality is set to NONE.

Related

GWT Activities and places: Reusing modal dialogs?

I am trying to get my head around GWT Activities and Places. And I am not sure how to implement a specific functionnality.
Let's assume here that I am also using MVP, and that my Activities are my Presenters.
Say I have an activity (let's call it activity A) (and its corresponding view) that is displaying a list of customers. The user can click on a "create customer" button in the view.
What I want to do is this: I want a "create customer" dialog to pop up on top of the current activity when the user clicks on the button. I also want all logic related to said dialog to be separated, so it can be reused later.
For example, the same dialog could be reused in a "create invoice" activity. So the user could click a similar "create customer" button in the "create invoice" activity, and be presented with the same dialog as used earlier.
Now, if I understand it correctly, I do not want to goTo() a new place, since it would terminate the current activity "list customers" or "create invoice".
I have thought about defining a "CreateCustomerPresenter" and a "CreateCustomerDialog" (which would be the corresponding view", and having my "list customers"/"create invoice" Activities (reminder: they also are my Presenters) extend the "CreateCustomerPresenter", but I don't know if it would be a wise idea...
What is the recommended way of reusing logic+view associated with a dialog in the context of an activity?
There are several valid approaches, but the one I usually prefer is this: Not to treat dialogs as places (activities) at all.
Reasoning: A place means, that you can reach it via bookmarks/browser history. Let's say I'm on the customer list, and I click "edit customer", a dialog opens. Do I want to "go back" to the list when I click the browser back button? And will the dialog open again when I click the browser forward button? I doubt it, and believe that a user wants to use the browser buttons to go back/forward entire 'pages' within the app (i.e. a concept that feels to the user like a page), but not open/close dialogs within the page.
I have done exactly this very recently.
The approach I took was to create an activity/view in the usual way for the content of the dialog. To launch, create the activity/view to embed in the dialog - I termed this a sub activity. Create the modal dialog and then call start on the sub-activity passing in the dialog content as the panel. In the main activity I then redirected the mayStop, stop etc to the sub-activity.
The tricky part was handling the dialog closing and passing control back to the main activity. I ended up adding a listener to the dialog and firing events on the event bus which were picked up my main activity. I am not 100% happy with this but it does work.
I have not used it but I think that GWTP supports this and other ways of creating sub-activities out-of-the box.

How to prevent GWT dialogbox from closing when clicking outside it

I plan to add a menu that pop ups when a user performs a certain action. This menu will include some fields that the user will fill out and then hit "Submit" which will close the dialog box and update the client based on information inputed.
However, I want the user to be able to close the dialog window by hitting cancel or submit, and not by clicking on the screen outside of the dialog box.
How can i do this? Or maybe I should just use a PopupPanel?
It's as easy as setting the auto-hide behavior to false, either at construction time or later.

How can I display a dialog canvas in Oracle Forms Builder?

I have built a form in which the user can view multiple rows of data pulled from a table. The user has the option to select a row, then pressing a button to reject the data in that row, (to be marked as rejected in some STATUS field).
I have also designed a rejection confirmation dialog with the ability for the user to enter some comments or reason for rejection.
I have set up the dialog canvas to appear on its own window with the Type proeperty set to Dialog.
When the user selects a row to reject, here is the code that gets executed:
BEGIN
GO_BLOCK('BLK_ALL_RECORDS');
FIRST_RECORD;
IF :FRM_ALL_ROWS.CHK_SELECT = 1 THEN
:FRM_REJECTION.ID := :FRM_ALL_ROWS.ID;
GO_BLOCK('BLK_REJECTION');
SHOW_VIEW('CNV_REJECTION');
EXIT;
ELSE
NEXT_RECORD;
END IF;
END;
And the rejection form has two buttons, one to confirm and one to cancel. Let's just focus on the cancel button for now. Here is the code that is executed once the Cancel button is pressed:
:BLK_ALL_ROWS.CHK_SELECT := 0; /* Forces removal of the check mark */
GO_BLOCK('BLK_ALL_RECORDS');
HIDE_VIEW('CNV_REJECTION');
The only problem is : once the dialog form appears, it hides the parent form, until the form is dismissed. How can display the dialog form ontop of the parent form with both of them visible (in a modal way?)
The navigation between different canvases can be little bit tricky to get to work. Hard to say what is the problem with not having the form in front of me but the first thing I should do is making sure that the 'Raise on entry' canvas property of the 'main' canvas is set to 'Yes'. This should force this canvas to be displayed when you are moving the cursor back to block 'BLK_ALL_RECORDS'.
Another alternative could be to use SHOW_VIEW() in the cancel dialog logic to force the main canvas to be displayed.
I found out what was the problem finally.
The parent Window had a property [Hide On Exit] which is defaulted to Yes and that made the parent form disappear everytime another window is on display. I set it to NO and called the other form. This time both windows are visible, with the modal one always on top.

Windows Forms Error Provider does not display in custom tab control

I'm trying to build a Wizard framework in Windows Forms. I've managed to glean a lot of useful tips from this and other sites which have gotten me very close to success. However, I'm having a problem with displaying an ErrorProvider on any tab page other than the first page of the wizard.
My Wizard control is a UserControl. It contains a custom tab control that I've derived from TabControl so that I can hide tabs and ignore attempts to navigate between tabs using keypresses, along with the usual collection of Back/Next/Finish/Cancel buttons at the bottom of the control.
I've used reflection to allow me to raise the validation events on a particular TabPage that belongs to the Wizard Control when I hit the Next button. (I don't want to validate the whole TabControl, only the currently active page.) When I do this, I see in the debugger that my Validating routine for the controls on the current tab page is correctly called and I see that I've called the ErrorProvider that I've attached to the particular control (a TextBox in this case) with a valid error message. I set Cancel to true for the CancelEventArgs in the validating routine and that's picked up by the code that uses the reflection mechanism so that I see that I've failed and don't change tabs. And I set the focus successfully to the control that failed validation.
So all that appears to be working just fine.
Unfortunately, I don't see the ErrorProvider's cheery blinking icon unless I'm on the first tab page. For all of the other tab pages, there's no message visible at all.
I'm baffled. Any thoughts? I can provide code snippets, if helpful.
Thanks!
I assume that in your case the button that moves to the next step of the wizard is placed outside (below) the TabControl
I noticed that the icon is displayed correctly if I pressed the button without releasing the mouse button. It seems that the button outside the container gets focused event though a validation error has occurred (normally you would not be able to leave the active control).
I worked around this issue by registering an event handler for the buttons MouseUp event to "refocus" the TabControl:
private void cmdOK_MouseUp(object sender, MouseEventArgs e)
{
tabControl1.Focus();
}
Note: you also need to set your forms ActiveControl property the one of the controls that failed validation.

GWT-Google web Toolkit-DialogBox

I have doubt regarding GWT .In Gwt if i click one button than it shows one dialog box at th same time the form outside the dialog box disabled.What component can be used for this task?
Thanks in advance
So, you want to open a popup dialog box, and at the same time disable the rest of the page until the user closes the dialog box?
If so, you can simply use gwt's DialogBox.
Use the constructor with the autohide flag set to false, and the box will not close until the user responds, thus disabling the rest of the page. If you want to make this even more clear, use the glass effect:
yourBox.setGlassEnabled(true);
You can also use the PopupPanel directly and build your own custom dialog box.
Now, if I got it wrong and you want to disable the form so it remains disabled after the popup, just disable it in the onClick handler of the button that opens the box.