-
Notifications
You must be signed in to change notification settings - Fork 2
List of dialog boxes
yvlawy edited this page May 28, 2018
·
10 revisions
commonDlg.ShowError("You're wrong.");
commonDlg.ShowInformation("Yes, you like dogs.");
commonDlg.ShowWarning("Be carefull!");
commonDlg.ShowQuestion("Do you like dogs?");
string msg = "Yes, you like dogs, cats, birds, horses, worms, lions, ants, girafs, rabbits, ...";
commonDlg.ShowInformation(WHSize.WXL, msg);
string text;
CommonDlgResult res = commonDlg.ShowDlgInputText("Input", "Give a name:", "name", out text);
if (res != CommonDlgResult.Ok)
{...}
string text;
CommonDlgResult res = commonDlg.ShowDlgInputText(WHSize.WL, "Input", "Give a name:", "name", out text);
if (res != CommonDlgResult.Ok)
{ ... }
List<DlgComboChoiceItem> listItem = new List<DlgComboChoiceItem>();
DlgComboChoiceItem selectedBeforeItem = null;
// create some object
List<string> listString = new List<string>();
listString.Add("dog");
listString.Add("cat");
listString.Add("horse");
listString.Add("duck");
foreach (string s in listString)
{
var item = new DlgComboChoiceItem(s, s);
listItem.Add(item);
}
DlgComboChoiceItem selected;
CommonDlgResult res = commonDlg.ShowDlgComboChoice("Choose it", listItem, selectedBeforeItem, out selected);
if (res == CommonDlgResult.Ok)
{...}
List<DlgListChoiceItem> listItem = new List<DlgListChoiceItem>();
List<DlgListChoiceItem> listSelectedBeforeItem = null;
// create some object
List<string> listString = new List<string>();
listString.Add("Au revoir");
listString.Add("salut");
listString.Add("bye");
listString.Add("tchao");
foreach (string s in listString)
{
var item = new DlgListChoiceItem(s, s);
listItem.Add(item);
}
List<DlgListChoiceItem> listSelected;
CommonDlgResult res = commonDlg.ShowDlgListChoice("Choose it", listItem, listSelectedBeforeItem, out listSelected);
if (res == CommonDlgResult.Ok)
{...}
(Use the Windows built-in dialog box.)
// * is the current folder, where is executed the application
string folderStart="*";
string defaultExt="*.*";
// text displayed|filter extension
string filter="All | *.*";
res = commonDlg.ShowDlgSelectFile(folderStart, defaultExt, filter, out pathName, out fileName);
if (res == CommonDlgResult.Ok)
{ ... }
see: https://www.c-sharpcorner.com/uploadfile/mahesh/openfiledialog-in-C-Sharp/ to have more details.
Put two filters, exp: Text Files and All files:
filter= "Text files (*.txt)|*.txt|All files (*.*)|*.*";
(Use the Windows built-in dialog box).
res = commonDlg.ShowDlgSaveFile("C\\", "", "All | *.*", out pathName, out fileName);
if (res == CommonDlgResult.Ok)
{ ...}
The images of these dialog boxes are the folder: Docs\Dialogs.