IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Highly configurable interactive message box with custom buttons, message, and possibly editable text. More...
Public Member Functions | |
DialogControl () | |
Creates a new message box. More... | |
DialogControl (string title, string message, string initialText, bool isTextVisible, params string[] buttons) | |
Creates a new message box with specific properties. More... | |
bool | IsPredefinedButtonText (string buttonText) |
Returns true if the specified string is a pre-defined button's text (case sensitive). More... | |
bool | ContainsButton (string buttonText) |
Returns true if buttons contained in the message box contain a button with the specified text (case sensitive), false if not. More... | |
void | AddButton (string buttonText) |
Adds a button with the specified button text to the list of buttons of the current message box. More... | |
void | RemoveButton (string buttonText) |
Removes thebutton with the specified tbutton text from the current message box. More... | |
void | RemoveAllButtons () |
Removes all buttons from the message box. More... | |
void | ZoomTextBox (double zoomFactor) |
Zooms the text box by the specified factor. More... | |
void | ZoomInTextBox (double zoomFactor=0) |
Zooms the text box in (enlarges it) by the specified factor. More... | |
void | ZoomOutTextBox (double zoomFactor=0) |
Zooms the text box out (shrinks it) by the specified factor. More... | |
override string | ToString () |
Returns a string describing state of the current message box. More... | |
DialogControl () | |
Creates a new message box. More... | |
DialogControl (string title, string message, string initialText, bool isTextVisible, params string[] buttons) | |
Creates a new message box with specific properties. More... | |
bool | IsPredefinedButtonText (string buttonText) |
Returns true if the specified string is a pre-defined button's text (case sensitive). More... | |
bool | ContainsButton (string buttonText) |
Returns true if buttons contained in the message box contain a button with the specified text (case sensitive), false if not. More... | |
void | AddButton (string buttonText) |
Adds a button with the specified button text to the list of buttons of the current message box. More... | |
void | RemoveButton (string buttonText) |
Removes thebutton with the specified tbutton text from the current message box. More... | |
void | RemoveAllButtons () |
Removes all buttons from the message box. More... | |
void | ZoomTextBox (double zoomFactor) |
Zooms the text box by the specified factor. More... | |
void | ZoomInTextBox (double zoomFactor=0) |
Zooms the text box in (enlarges it) by the specified factor. More... | |
void | ZoomOutTextBox (double zoomFactor=0) |
Zooms the text box out (shrinks it) by the specified factor. More... | |
override string | ToString () |
Returns a string describing state of the current message box. More... | |
Public Attributes | |
const double | DefaultZoomFactor = 1.2 |
Protected Member Functions | |
virtual void | SetText (string text, bool changeControlTextUnconditionally=false) |
Sets the dialog's text (which is considered its returned value) to the specified string. More... | |
void | UpdateTextVisibility () |
Updates control according to the intended visibility of the text box. More... | |
Button | GetPredefinedButton (string buttonText) |
Returns the pre-defined button whose text corresponds to the specified text. More... | |
Button | GetButton (string buttonText) |
Returns the Button contained on the message box whose text corresponds to the specified text (case sensitve), or null, if there is no such button. More... | |
void | OnTextChanged () |
Fires the TextChanged event. More... | |
void | OnButtonResultChanged () |
Fires the ButtonResultChanged event. More... | |
void | OnButtonPressed (object sender) |
Fires the ButtonPressed event. More... | |
void | CloseForm () |
void | ButtonClickHandler (object sender, EventArgs e) |
General event handler that is executed on button click for all dialog buttons. More... | |
void | ButtonClickHandlerPredefined (object sender, EventArgs e) |
Event handler that is executed on button click for all pre-defined buttons (such as ButtonTextOk or ButtonTextCancel). More... | |
override void | Dispose (bool disposing) |
Clean up any resources being used. More... | |
virtual void | SetText (string text, bool changeControlTextUnconditionally=false) |
Sets the dialog's text (which is considered its returned value) to the specified string. More... | |
void | UpdateTextVisibility () |
Updates control according to the intended visibility of the text box. More... | |
Button | GetPredefinedButton (string buttonText) |
Returns the pre-defined button whose text corresponds to the specified text. More... | |
Button | GetButton (string buttonText) |
Returns the Button contained on the message box whose text corresponds to the specified text (case sensitve), or null, if there is no such button. More... | |
void | OnTextChanged () |
Fires the TextChanged event. More... | |
void | OnButtonResultChanged () |
Fires the ButtonResultChanged event. More... | |
void | OnButtonPressed (object sender) |
Fires the ButtonPressed event. More... | |
void | CloseForm () |
void | ButtonClickHandler (object sender, EventArgs e) |
General event handler that is executed on button click for all dialog buttons. More... | |
void | ButtonClickHandlerPredefined (object sender, EventArgs e) |
Event handler that is executed on button click for all pre-defined buttons (such as ButtonTextOk or ButtonTextCancel). More... | |
override void | Dispose (bool disposing) |
Clean up any resources being used. More... | |
Protected Attributes | |
readonly double | MinZoomFactor = 0.25 |
Minimal zoom factor. More... | |
readonly double | MaxZoomFactor = 4 |
Maximal zoom factor. More... | |
Properties | |
string | Title [get, set] |
Message box' title, displayet on the top. More... | |
string | Message [get, set] |
Message box' message, display under the title. More... | |
new string | Text [get, set] |
Value of the possibly editable text of the message box. More... | |
string | ControlText [get, set] |
Proxy for accessing the base class' Text property, since this property is redefined in the current class and is given another meaning. More... | |
bool | IsTextPassword [get, set] |
If true then text is treated as password, i.e. for all charactes of the text the same system character is shown. More... | |
bool | IsTextVisible [get, set] |
Specifies whether text box (displaying contents of the Text property) is visible or not. More... | |
bool | IsTextCausesVisible [get, set] |
If true then TextValue property becoming non-null and non-empty string will automatically cause the text control containing that text become visible. More... | |
bool | IsTextEditable [get, set] |
Specifies whether text can be edited or not. More... | |
bool | IsTextSettable [get, set] |
Specifies whether text can be set programatically or not. More... | |
bool | IsTextSetThrows [get, set] |
Whether setting text programmatically throws an InvalidOperationException in the case that this is not allowed (i.e., when the IsTextSettable property is false). More... | |
bool | IsTextMultiLine [get, set] |
Specifies whether text box is multiline. More... | |
int | TextBoxWidth [get, set] |
Gets or sets the text box width. More... | |
int | TextBoxHeight [get, set] |
Gets or sets the text box height. More... | |
string[] | Buttons [get, set] |
Array of texts that appear on dialog box's buttons. More... | |
Button[] | PredefinedButtons [get] |
List of pre-defined buttons. More... | |
IEnumerable< string > | PredefinedButtonTexts [get] |
Returns array of predefined button's texts. More... | |
bool | IsTextChangedEventOnValidationOnly [get, set] |
If true then the TextChanged event is fired only when the text obtained from the text box is validated. If true then the event fires every time the Text Box control's where text can be edited is fired. More... | |
bool | HasTextChangesUnnoticed [get, protected set] |
Indicates whether text has been changed in the text box control but the TextChanged event has not been fired on the current compound control. More... | |
List< string > | ButtonsList [get] |
string | ButtonTextOk [get, set] |
string | ButtonTextCancel [get, set] |
string | ButtonTextClose [get, set] |
string | ButtonResult [get, protected set] |
Text of the last button pressed on the current form. This can be used by creator of the dialog in order to be informes about which button was pressed by the user. More... | |
double | ZoomFactor [get, set] |
Zoom factor, factor by which controls are enlarged or shrinked when zoomed in or out. More... | |
Events | |
new EventHandler | TextChanged |
This event is fired each time the text is changed on the current control. More... | |
EventHandler | ButtonResultChanged |
This event is fired each time button result changes, which happens when a button is pressed on the dialog. More... | |
EventHandler | ButtonPressed |
This eventt is fired each time the dialog button is pressed. More... | |
Private Member Functions | |
void | btnOk_Click (object sender, EventArgs e) |
void | btnCancel_Click (object sender, EventArgs e) |
void | btnClose_Click (object sender, EventArgs e) |
void | menuCopyMessage_Click (object sender, EventArgs e) |
void | menuCopyTitleAndMessage_Click (object sender, EventArgs e) |
void | menuClose_Click (object sender, EventArgs e) |
void | menuCopyText_Click (object sender, EventArgs e) |
void | menuZoomInTextBox_Click (object sender, EventArgs e) |
void | menuZoomOutTextBox_Click (object sender, EventArgs e) |
void | menuZoomInText_Click (object sender, EventArgs e) |
void | menuZoomOutText_Click (object sender, EventArgs e) |
void | menuTextVisible_CheckedChanged (object sender, EventArgs e) |
void | menuSummary_Click (object sender, EventArgs e) |
Launches a fading message that summarizes the state of the current message box. More... | |
void | txtText_Validated (object sender, EventArgs e) |
void | txtText_TextChanged (object sender, EventArgs e) |
void | menuShowPasswordShortly_Click (object sender, EventArgs e) |
void | InitializeComponent () |
Required method for Designer support - do not modify the contents of this method with the code editor. More... | |
void | btnOk_Click (object sender, EventArgs e) |
void | btnCancel_Click (object sender, EventArgs e) |
void | btnClose_Click (object sender, EventArgs e) |
void | menuCopyMessage_Click (object sender, EventArgs e) |
void | menuCopyTitleAndMessage_Click (object sender, EventArgs e) |
void | menuClose_Click (object sender, EventArgs e) |
void | menuCopyText_Click (object sender, EventArgs e) |
void | menuZoomInTextBox_Click (object sender, EventArgs e) |
void | menuZoomOutTextBox_Click (object sender, EventArgs e) |
void | menuZoomInText_Click (object sender, EventArgs e) |
void | menuZoomOutText_Click (object sender, EventArgs e) |
void | menuTextVisible_CheckedChanged (object sender, EventArgs e) |
void | menuSummary_Click (object sender, EventArgs e) |
Launches a fading message that summarizes the state of the current message box. More... | |
void | txtText_Validated (object sender, EventArgs e) |
void | txtText_TextChanged (object sender, EventArgs e) |
void | menuShowPasswordShortly_Click (object sender, EventArgs e) |
void | InitializeComponent () |
Required method for Designer support - do not modify the contents of this method with the code editor. More... | |
Private Attributes | |
string | _title = null |
string | _message = null |
string | _text = null |
bool | _isTextPassword = false |
bool | _isTextVisible = false |
bool | _textCausesVisible = false |
bool | _isTextEditable = true |
bool | _isTextSettable = true |
bool | _isTextSetThrows = true |
bool | _isTextMultiLine = true |
Button[] | _predefinedButtons = null |
bool | _isTextChangedOnVaalidationOnly = false |
bool | _isTextChangedUnnoticed = false |
List< string > | _buttonTexts = new List<string>() |
string | _buttonResult = null |
double | _zoomFactor = DefaultZoomFactor |
System.ComponentModel.IContainer | components = null |
Required designer variable. More... | |
System.Windows.Forms.FlowLayoutPanel | pnlOuter |
System.Windows.Forms.Button | btnOk |
System.Windows.Forms.Button | btnCancel |
System.Windows.Forms.Label | lblTitle |
System.Windows.Forms.Label | lblMessage |
System.Windows.Forms.TextBox | txtText |
System.Windows.Forms.FlowLayoutPanel | pnlText |
System.Windows.Forms.FlowLayoutPanel | pnlButtons |
System.Windows.Forms.FlowLayoutPanel | pnlTitle |
System.Windows.Forms.FlowLayoutPanel | pnlMessage |
System.Windows.Forms.ContextMenuStrip | menuMain |
System.Windows.Forms.ToolStripMenuItem | menuCopyMessage |
System.Windows.Forms.ToolStripMenuItem | menuClose |
System.Windows.Forms.Button | btnClose |
System.Windows.Forms.ToolStripMenuItem | menuCopyTitleAndMessage |
System.Windows.Forms.ToolStripMenuItem | menuText |
System.Windows.Forms.ToolStripMenuItem | menuCopyText |
System.Windows.Forms.ToolStripMenuItem | menuZoomInTextBox |
System.Windows.Forms.ToolStripMenuItem | menuZoomOutTextBox |
System.Windows.Forms.ToolStripMenuItem | menuZoomInText |
System.Windows.Forms.ToolStripMenuItem | menuZoomOutText |
System.Windows.Forms.ToolStripMenuItem | menuTextVisible |
System.Windows.Forms.ToolStripMenuItem | menuSummary |
System.Windows.Forms.ToolStripMenuItem | menuShowPasswordShortly |
Highly configurable interactive message box with custom buttons, message, and possibly editable text.
This message box display an optional title, message, additional text that can be edited (dpeendent on settings) and optional buttons. Any of these components can be withdrawn (hidden). Control adapts its size with accordance to what is displayed.
Title displays contents of the Title string on the top of the message box. If that property is an empty or null string then the appropriate label is not displayed and control is resized accordingly.
Contents of the Message property is displayed below title. If set to null or empty string then the message box shrinks accordingly because the corresponding label is not visible.
|
inline |
Creates a new message box.
|
inline |
Creates a new message box with specific properties.
title | Message box' title. |
message | Message box' message. |
initialText | Initial message box text. |
isTextVisible | Whether message box contains text. |
buttons | Aray of strings that are displayed on message box's buttons. |
If any of the buttons is pressed, the ButtonResult property contains the corresponding string from this argument.
|
inline |
Creates a new message box.
|
inline |
Creates a new message box with specific properties.
title | Message box' title. |
message | Message box' message. |
initialText | Initial message box text. |
isTextVisible | Whether message box contains text. |
buttons | Aray of strings that are displayed on message box's buttons. |
If any of the buttons is pressed, the ButtonResult property contains the corresponding string from this argument.
|
inlineprotectedvirtual |
Sets the dialog's text (which is considered its returned value) to the specified string.
This method should always be used internally, while Text property's setter is intended for use only by external callers.
Reason for the above is that this method does not throw when setting text programatically is not allowed.
text | |
changeControlTextUnconditionally | If true then text in the text box control is changed unconditionally, even if the text box has focus (this must be used when triggered by external callers). If false then tect in the text box control is cnaged only if the text box does not have focus (this should be used internally). |
|
inlineprotected |
Updates control according to the intended visibility of the text box.
|
inline |
Returns true if the specified string is a pre-defined button's text (case sensitive).
buttonText | String that is checked to be a predefined button text. |
|
inlineprotected |
Returns the pre-defined button whose text corresponds to the specified text.
If the text does not correspond to any pre-defined button then null is returned.
buttonText | Butotn's text. |
|
inline |
Returns true if buttons contained in the message box contain a button with the specified text (case sensitive), false if not.
buttonText | Button text against which button existence is checked. |
|
inlineprotected |
Returns the Button contained on the message box whose text corresponds to the specified text (case sensitve), or null, if there is no such button.
buttonText | Button text by which the corresponding button is searched for. |
|
inline |
Adds a button with the specified button text to the list of buttons of the current message box.
buttonText | Text of the button to be added. |
If this is the text of one of the predefined text buttons, then the corresponding pre-defined button is associated with this. Otherwise, a new button is created.
A button is added to the set of visible buttons that are contained in the buttons panel, and is set visible.
|
inline |
Removes thebutton with the specified tbutton text from the current message box.
buttonText |
|
inline |
Removes all buttons from the message box.
|
inlineprotected |
Fires the TextChanged event.
|
inlineprotected |
Fires the ButtonResultChanged event.
|
inlineprotected |
Fires the ButtonPressed event.
|
inline |
Zooms the text box by the specified factor.
zoomFactor | Factor by which size of the text box is changed (enlarged or shrinked). |
If smaller than MinZoomFactor or larger than MaxZoomFactor then the corresponding of these two bounds is taken.
|
inline |
Zooms the text box in (enlarges it) by the specified factor.
zoomFactor | Factor by which text box is enlarged. |
If less shan 1 then ZoomFactor is taken. Default is 0 which implies this factor.
MaxZoomFactor is taken as upper bound.
|
inline |
Zooms the text box out (shrinks it) by the specified factor.
zoomFactor | Factor by which text box is enlarged. |
If less shan 1 then ZoomFactor is taken. Default is 0 which implies this factor.
MaxZoomFactor is taken as upper bound.
|
inlineprotected |
|
inlineprotected |
General event handler that is executed on button click for all dialog buttons.
|
inlineprotected |
Event handler that is executed on button click for all pre-defined buttons (such as ButtonTextOk or ButtonTextCancel).
In addition to this, each pre-defined button can also have its own specific handlers added.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
Returns a string describing state of the current message box.
|
inlineprivate |
Launches a fading message that summarizes the state of the current message box.
References IG.Forms.FadingMessage.Launch().
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprotected |
Clean up any resources being used.
disposing | true if managed resources should be disposed; otherwise, false. |
|
inlineprivate |
Required method for Designer support - do not modify the contents of this method with the code editor.
|
inlineprotectedvirtual |
Sets the dialog's text (which is considered its returned value) to the specified string.
This method should always be used internally, while Text property's setter is intended for use only by external callers.
Reason for the above is that this method does not throw when setting text programatically is not allowed.
text | |
changeControlTextUnconditionally | If true then text in the text box control is changed unconditionally, even if the text box has focus (this must be used when triggered by external callers). If false then tect in the text box control is cnaged only if the text box does not have focus (this should be used internally). |
|
inlineprotected |
Updates control according to the intended visibility of the text box.
|
inline |
Returns true if the specified string is a pre-defined button's text (case sensitive).
buttonText | String that is checked to be a predefined button text. |
|
inlineprotected |
Returns the pre-defined button whose text corresponds to the specified text.
If the text does not correspond to any pre-defined button then null is returned.
buttonText | Butotn's text. |
|
inline |
Returns true if buttons contained in the message box contain a button with the specified text (case sensitive), false if not.
buttonText | Button text against which button existence is checked. |
|
inlineprotected |
Returns the Button contained on the message box whose text corresponds to the specified text (case sensitve), or null, if there is no such button.
buttonText | Button text by which the corresponding button is searched for. |
|
inline |
Adds a button with the specified button text to the list of buttons of the current message box.
buttonText | Text of the button to be added. |
If this is the text of one of the predefined text buttons, then the corresponding pre-defined button is associated with this. Otherwise, a new button is created.
A button is added to the set of visible buttons that are contained in the buttons panel, and is set visible.
|
inline |
Removes thebutton with the specified tbutton text from the current message box.
buttonText |
|
inline |
Removes all buttons from the message box.
|
inlineprotected |
Fires the TextChanged event.
|
inlineprotected |
Fires the ButtonResultChanged event.
|
inlineprotected |
Fires the ButtonPressed event.
|
inline |
Zooms the text box by the specified factor.
zoomFactor | Factor by which size of the text box is changed (enlarged or shrinked). |
If smaller than MinZoomFactor or larger than MaxZoomFactor then the corresponding of these two bounds is taken.
|
inline |
Zooms the text box in (enlarges it) by the specified factor.
zoomFactor | Factor by which text box is enlarged. |
If less shan 1 then ZoomFactor is taken. Default is 0 which implies this factor.
MaxZoomFactor is taken as upper bound.
|
inline |
Zooms the text box out (shrinks it) by the specified factor.
zoomFactor | Factor by which text box is enlarged. |
If less shan 1 then ZoomFactor is taken. Default is 0 which implies this factor.
MaxZoomFactor is taken as upper bound.
|
inlineprotected |
|
inlineprotected |
General event handler that is executed on button click for all dialog buttons.
|
inlineprotected |
Event handler that is executed on button click for all pre-defined buttons (such as ButtonTextOk or ButtonTextCancel).
In addition to this, each pre-defined button can also have its own specific handlers added.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
Returns a string describing state of the current message box.
|
inlineprivate |
Launches a fading message that summarizes the state of the current message box.
References IG.Forms.FadingMessage.Launch().
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprotected |
Clean up any resources being used.
disposing | true if managed resources should be disposed; otherwise, false. |
|
inlineprivate |
Required method for Designer support - do not modify the contents of this method with the code editor.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
const double IG.Forms.DialogControl.DefaultZoomFactor = 1.2 |
|
private |
|
protected |
Minimal zoom factor.
|
protected |
Maximal zoom factor.
|
private |
Required designer variable.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
getset |
Message box' title, displayet on the top.
If null lor empty string then the corresponding controls are not displayed.
|
getset |
Message box' message, display under the title.
If null lor empty string then the corresponding controls are not displayed.
|
getset |
Value of the possibly editable text of the message box.
Setter should only be used by external callers; internally SetText() should be used.
|
getset |
Proxy for accessing the base class' Text property, since this property is redefined in the current class and is given another meaning.
|
getset |
If true then text is treated as password, i.e. for all charactes of the text the same system character is shown.
Both setter and getter update the text box' properties accordingly, so calling any of these ensures that the mode (password - hidden text / non-password - visible text) is reflecte correctly in behavior.
|
getset |
Specifies whether text box (displaying contents of the Text property) is visible or not.
|
getset |
If true then TextValue property becoming non-null and non-empty string will automatically cause the text control containing that text become visible.
Default should be false isn most cases (e.g. when used in a window or when embedded).
|
getset |
Specifies whether text can be edited or not.
|
getset |
Specifies whether text can be set programatically or not.
|
getset |
Whether setting text programmatically throws an InvalidOperationException in the case that this is not allowed (i.e., when the IsTextSettable property is false).
|
getset |
Specifies whether text box is multiline.
|
getset |
Gets or sets the text box width.
|
getset |
Gets or sets the text box height.
|
getset |
Array of texts that appear on dialog box's buttons.
When set, corresponding buttons are created.
Setter also creates buttons that appear visually on the control, and sets their properties and events.
A small number of buttons with pre-defined text are considered special buttons. These buttons are created in advance, and any string appearing in this property that correspond to the Button.Text property of any of these special buttons will not cause creation of a new button, but the existing special button will be associated with the text, added to the appropriate panel control, and made visible. This makes possible that special behavior of these such special buttons is defined in advance (e.g. in this class' definitioon) and that this special behavior will not be affected by subsequent removals or additions of these buttons.
|
getprotected |
List of pre-defined buttons.
|
get |
Returns array of predefined button's texts.
|
getset |
If true then the TextChanged event is fired only when the text obtained from the text box is validated. If true then the event fires every time the Text Box control's where text can be edited is fired.
The
|
getprotected set |
Indicates whether text has been changed in the text box control but the TextChanged event has not been fired on the current compound control.
This situation appears when IsTextChangedEventOnValidationOnly is true, and not each change in the text box' textt fire the control's TextChanged event.
|
getprotected |
|
getsetprotected |
|
getsetprotected |
|
getsetprotected |
|
getprotected set |
Text of the last button pressed on the current form. This can be used by creator of the dialog in order to be informes about which button was pressed by the user.
|
getset |
Zoom factor, factor by which controls are enlarged or shrinked when zoomed in or out.
Setter takes care that the value is greater than 1. If i
new EventHandler IG.Forms.DialogControl.TextChanged |
This event is fired each time the text is changed on the current control.
If the
EventHandler IG.Forms.DialogControl.ButtonResultChanged |
This event is fired each time button result changes, which happens when a button is pressed on the dialog.
EventHandler IG.Forms.DialogControl.ButtonPressed |
This eventt is fired each time the dialog button is pressed.
The event has similar role as the ButtonResultChanged, however that event does not get fired each time this evend does. If the same button is pressed twice in a row, for example, the ButtonResultChanged event is not fired the second time (because the ButtonResult remains the same as after the first button press and is therefore not changed), but this event does get fired both times. It is important to have separate events because button press can have important implications (e.g. the dialog goes invisible) even if the ButtonResult property does not change because of this (e.g. because the same value resulted from previous press on the same button).