On 26/04/12 19:40, Bart wrote:
On 4/25/12, patspiper<[email protected]>  wrote:

As for TBitBtn, I suggest Lazarus respects the button's modalresult and
acts accordingly.

By default a Button with ModalResult = mrNone will not close it's
parentform when clicked.
A TBitBtn with Kind = bkClose and ModalResult is the exception to this rule.
It should close the parentform, not setting it's ModalResult (which
will result in ModalResult of parentform being mrCancel).

A TBitBtn with ModalResult<>  mrNone should always set parentform's
ModalResult (regardless of Kind), which is what my patch does.
To summarize, your target is:

1- TBitButton:

a- TBitButton with ModalResult<>mrNone: Its ModalResult will act normally (close form and set its ModalResult to the BitButton's ModalResult).

b- TBitButton with Kind<>bkClose and ModalResult=mrNone: Does nothing.

c- TBitButton with Kind=bkClose and ModalResult=mrNone: Close form and set its ModalResult to mrCancel.


2- Native PromptUser():

a- Escape and [x] close the dialog and return mrCancel


3- LCL's CreateMessageDialog():

a- [x] closes the dialog and return mrCancel

b- Escape closes the dialog and returns mrCancel, mrNo, or mrOK if and only if one of mbCancel, mbNo, and mbOk is present repectively and in that order of precedence. Otherwise, Escape key does not have any effect.


IMHO:

- 1a and 1b are intuitive whereas 1c is not, irrespective of the different Delphi versions implementations. If one wants to close the form and return mrCancel, he should set the BitButton's ModalResult to mrCancel. I can't see why he would set it as mrNone and expect it to act as mrCancel.

- 2a is logical

- 3a is logical and is in accordance with 2a

- 3b deviates from 2a (I would assume native and LCL's dialogs should behave the same). Furthermore, I wonder how mbAbort is excluded. The current behaviour of MessageDlg under gtk2 is as described below. I suggest this is considered for the Escape key.
-------------------------------
Escape and [x] border icon are equivalent and always return the same modal result. They will return the following in high to low order of preference (assuming the corresponding button is present):
mrCancel
mrNo
mrAbort
mrIgnore
mrNoToAll
mrYes
mrOK
mrRetry
mrAll
mrYesToAll

If the only button in MessageDlg is mbClose, then Escape or [x] will return mrCancel. This corresponds exactly to what the ModalEscapeValue function does.
-------------------------------

Stephano

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to