When a user clicks on my button there appears a SharePoint modal dialog. The popup shows the user a confirmation message. This is already working.
Now I want the following: When the users clicks on the YES button, the first popup closes and and a new modal dialog opens.
Is this possible? And how? Or can i resize the dialog dynamicly when he's already open?
here are my methods to open the dialogs:
function OpenPopup() {
var options = SP.UI.$create_DialogOptions();
options.url = "popup.aspx";
options.width = 230;
options.height = 235;
options.title = "";
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallbackNew);
SP.UI.ModalDialog.showModalDialog(options);
}
function OpenSecondPopup() {
var options = SP.UI.$create_DialogOptions();
options.url = "popup2.aspx";
options.width = 630;
options.height = 235;
options.title = "";
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallbackNew);
SP.UI.ModalDialog.showModalDialog(options);
}
Is it not as simple as
Create a copy of your function CloseCallbackNew called CloseCallbackNewSecond
Change OpenSecondPopup to reference this new copy instead of the original
Add a call to OpenSecondPopup at the end of CloseCallbackNew, referencing the dialog result so as to only call it if the user clicked YES
It seems like this should call the second popup when the first is closed.
Related
I need to show a menu on an NSTableView when user right clicks anywhere on the table row. Just like when we right click anywhere in the browser and menu shows up.
NSTableView has Menu property that can be assigned to your NSMenu.
Of course all this can be done in Xcode's IB, but if you are doing this programmatically you need to construct a NSMenu, add the NSMenuItem(s) required and assign it to the NSTableView.
var menu = new NSMenu("A context menu")
{
Delegate = this
};
menu.AddItem(new NSMenuItem { Title = "StackOverflow" Action = SomeMenuAction });
aTableView.Menu = menu;
I have to make a table with possible filters in C#.
So I want to show the filters in another form using a button which switches between "Show filters >" and "< Hide filters" in the main form.
I open the filters form side by side the main form by using this code:
var frmFilters = new FrmFilterSearch();
frmFilters.SetDesktopLocation(Location.X + Size.Width, Location.Y);
if (!Filters)
{
Filters = true;
btn_show_filters.Text = "< Hide filters";
frmFilters.Show();
}
else
{
Filters = false;
btn_show_filters.Text = "Show filters >";
frmFilters.Hide();
}
The filters form open very well and the button is switching his text, but I can't close (hide) the filters form. If I click again on the button, it opens a new filter form.
I hope someone can help me with that.
Right now, you're creating a new instance of the Form each time the button is clicked.
You'll want to create an instance of FrmFilterSearch and set its location once, outside of the button click event, then show/hide the same Form. I'd suggest using the constructor:
FrmFilterSearch frmFilters = new FrmFilterSearch();
public YourConstructor()
{
frmFilters.SetDesktopLocation(Location.X + Size.Width, Location.Y);
}
private void FilterButton_Click(object sender, EventArgs e)
{
if (!Filters)
{
Filters = true;
btn_show_filters.Text = "< Hide filters";
frmFilters.Show();
}
else
{
Filters = false;
btn_show_filters.Text = "Show filters >";
frmFilters.Hide();
}
}
I bind "Enabled" property of button to datasource member. I use Infragistics.Win.Misc.UltraButton control and its method DataBindings.Add( System.Windows.Forms.Binding ). The button is on dialog form. When I open dialog for the first time binding is added ok. After I close dialog and open it second time I get exception in System.Windows.Forms.ControlBindingsCollection.Add(Binding binding), message says that "Enabled" property of button is read-only. How to solve this?
Dialog opening code is like this:
using (PickItemDialog dialog = new PickItemDialog())
{
dialog.ViewModel = new PickItemViewModel();
dialog.ViewModel.Items = new BindingList<T>(records.ToList());
dialog.ViewModel.Title = title;
dialog.ViewModel.Notification = notification;
if (dialog.ShowDialog() == DialogResult.OK)
return (DataItem)dialog.ViewModel.SelectedItem;
}
I would like to know how to open new window in the browser with focus while keeping the other window open too.
I have a button in my silverlight app that must open a pdf in another window or tab, i want the new window to have focus while keeping the initial page open.
I can get the new window to open but without focus or i can get it to replace the current page , then returning to the app requires login etc.
So i need 3 things...
1)open new window
2)focus new window
3)leave old window open
Uri myUri = new Uri(#"http://......./ViewPDF.aspx");
HtmlPage.Window.Navigate(myUri, "_newWindow");
HtmlPage.Window.Navigate(myUri);
HtmlPage.Window.Eval("window.focs()")
HtmlPage.PopupWindow(myUri, "_blank", null);
None of these meet all 3 requirements.
please help..
Thanking you in advance
HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
options.Left = 300;
options.Top = 150;
options.Width = 1024;
options.Height = 768;
options.Directories = false;
options.Location = false;
options.Menubar = false;
options.Status = false;
options.Toolbar = false;
Uri myUri = new Uri(#"http://......./ViewPDF.aspx");
HtmlPage.PopupWindow(Uri, "_blank", options);
The Message Boxes of WPF could be customized as i understand.
I was wondering is it possible to add a CheckBox to the WPF MessageBox with say - Don't show this message again etc.?
Possible, you can change the WPF control styles and templates as per your requirement, see these links for further references:
Custom Message Box
http://blogsprajeesh.blogspot.com/2009/12/wpf-messagebox-custom-control.html
http://www.codeproject.com/Articles/201894/A-Customizable-WPF-MessageBox
http://www.codeproject.com/Articles/22511/WPF-Common-TaskDialog-for-Vista-and-XP
Could just use a Window
Passed checked in the ctor so you can get the value back
bool checked = false;
Window1 win1 = new Window1(ref input);
Nullable<bool> dialogResult = win1.ShowDialog();
System.Diagnostics.Debug.WriteLine(dialogResult.ToString());
System.Diagnostics.Debug.WriteLine(checked.ToString());
I realize this is a very old thread, but I was searching this matter today and was surprised to see no replies mentioning Ookii: https://github.com/ookii-dialogs/ookii-dialogs-wpf
I was already using it for Folder Browsing. Now I wanted to add a "Don't Show Again" checkbox whenever the main window is closed, and it's really simple to use it.
Here's my code:
using Ookii.Dialogs.Wpf;
//create instance of ookii dialog
TaskDialog dialog = new();
//create instance of buttons
TaskDialogButton butYes = new TaskDialogButton("Yes");
TaskDialogButton butNo = new TaskDialogButton("No");
TaskDialogButton butCancel = new TaskDialogButton("Cancel");
//checkbox
dialog.VerificationText = "Dont Show Again"; //<--- this is what you want.
//customize the window
dialog.WindowTitle = "Confirm Action";
dialog.Content = "You sure you want to close?";
dialog.MainIcon = TaskDialogIcon.Warning;
//add buttons to the window
dialog.Buttons.Add(butYes);
dialog.Buttons.Add(butNo);
dialog.Buttons.Add(butCancel);
//show window
TaskDialogButton result = dialog.ShowDialog(this);
//get checkbox result
if (dialog.IsVerificationChecked)
{
//do stuff
}
//get window result
if (result != butYes)
{
//if user didn't click "Yes", then cancel the closing.
e.Cancel = true;
return;
}