OfficeJs - How to display modal dialog - ms-word

I am using OfficeJs to create word add-in. In that i want to show modal dialog on click on ribbon button. I have used below API
Office.context.ui.displayDialogAsync(url, {height: 30, width: 20}); to display dialog but it is non-modal dialog. Is there any API to display modal dialog using officeJS.

Office.js doesn't provide any other method for displaying dialogs. From MSDN:
The following design considerations apply to dialog boxes:
An Office Add-in task pane can have only one dialog box open at any time. Multiple dialogs can be open at the same time from Add-in Commands (custom ribbon buttons or menu items).
Every dialog box can be moved and resized by the user.
Every dialog box is centered on the screen when opened.
Dialog boxes appear on top of the host application and in the order in which they were created.
Use a dialog box to:
Display authentication pages to collect user credentials.
Display an error/progress/input screen from a ShowTaskpane or ExecuteAction command.
Temporarily increase the surface area that a user has available to complete a task.

Custom application will load inside side loaded panel or we can say inside iFrame
You can write some restrict code inside your dailog window using check if loaded application running inside sidepanel
function inIframe () {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}

Related

WicketTester: How to click secondary mouse button?

I want to test a wicket component which shows a context menu on click with the secondary mouse button.
With WicketTester.click(Component) I can click obviously simulate a click on a component. But how do I simulate a click with the secondary mouse button?
WicketTester does not provide means to test JavaScript!
If the context menu is being shown with Wicket Ajax call to the server to make it visible then you can do tester.executeAjaxBehavior(...).
If the menu is shown via JavaScript in the browser then WicketTester cannot check whether it is visible or not. But in that case you should be able to test selecting a menu item, i.e. sending an Ajax call with the appropriate value for the item.

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

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.

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.

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.

Ajax Control Toolkit - Use client-side button to activate tab

I'm using the TabContainer/TabPanel components of the Ajax Control Toolkit.
I'd like to hide the tabs themselves and use a button elsewhere on the page to activate (bring to the front) one of the tabs without posting back to the server.
I can show and hide the tabs by grabbing their clientIDs and manually setting the visibility and display styles.
But is there a javascript function I can call to do this and perform whatever magic happens behind the scenes when I click an actual tab?
Example:
var tab = $find(“tabContainer’s ClientID”);
tab.set_activeTabIndex(1); // active the second tab panel
tab.getFirstTab().set_enabled(false); // disable the first panel