Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-12

Lazarus 1.6 and QuestionDLG

19 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jürgen Hestermann

I just saw that with Lazarus 1.6 QuestionDLG has been changed (too). My code:

                   Answer := QuestionDlg('File overwrite',S2,
                                          mtConfirmation,[mrNo, '&No','IsDefault',
                                                          mrYes, '&Yes',

mrIgnore,'ne&Ver',
mrAll, 'a&LL',
488, '&Older files only',
588, 'files with different &Size and date only',
188, 'copy/move with &Different name',
288, 'rename existing &Target file (prior to '+S+')', 388, '&Compare files',

                                                          mrAbort, '&Abort '+S],0);

(with S2 beeing the text) showed this dialog with Lazarus 1.4 :

Now it looks like this:

The idea of using a TMemo is not bad but then it should have the width of the window so that my text is not broken into more lines than neseccary.

Also, the escape key no longer selects mrAbort.
I cannot exit from the dialog with escape.
Is this intended?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151213/4698c20a/attachment-0001.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: fbaaahad.png
Type: image/png
Size: 16535 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151213/4698c20a/attachment-0002.png> -------------- next part --------------
A non-text attachment was scrubbed...
Name: bdedhbei.png
Type: image/png
Size: 15812 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151213/4698c20a/attachment-0003.png>

Reply by email

Ondrej Pokorny
to Jürgen Hestermann
J?rgen Hestermann wrote
Also, the escape key no longer selects mrAbort. I cannot exit from the dialog with escape. Is this intended?

The escape key selects mrCancel now (this was changed) - but you should definitely be able to exit the dialog with escape. See http://bugs.freepascal.org/view.php?id=26019 .

If you have any trouble with the code change, please attach a sample project so that we can discuss it more precisely.

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151213/37ca1f5c/attachment.html>

Reply by email

Jürgen Hestermann
to Ondrej Pokorny
Ondrej Pokorny wrote 5 lines
On 13.12.2015 16:38, J?rgen Hestermann wrote: > Also, the escape key no longer selects mrAbort. > I cannot exit from the dialog with escape. > Is this intended? The escape key selects mrCancel now (this was changed) - but you should definitely be able to exit the dialog with escape. See http://bugs.freepascal.org/view.php?id=26019 .

As you may have seen from my code snippet I do not use mrCancel. What happens in this case?
Should mrAbort used instead?
At least I am (no longer) able to exit from this dialog with Escape (on Windows 8.1)

If you have any trouble with the code change, please attach a sample project so that we can discuss it more precisely.

I would have no problem to switch from mrAbort to mrCancel. I am just wondering, why Escape no longer lets me , the TMemo issue is more severe to me (even though I am planning to write my own QuestionDLG but this may take a while, too many other things in the pipeline....)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151213/cba94476/attachment.html>

Reply by email

Juha Manninen
to Jürgen Hestermann: I just saw that with Lazarus 1.6 QuestionDLG has been changed (too). My code: Answer :=…

On Sun, Dec 13, 2015 at 5:38 PM, J?rgen Hestermann <

Show quoted text 6 lines
wrote: The idea of using a TMemo is not bad but then it should have the width of the window so that my text is not broken into more lines than neseccary.

Mattias committed in r50570 :
LCL: default QuestionDlg: use TMemo when text too big Revisions 50572 and 50574 also deal with QuestionDlg.

Yes, the Memo should be resized together with the dialog window, using anchors for example.
Can you please open a bug report.

Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151213/358a778c/attachment-0001.html>

Reply by email

Ondrej Pokorny
to Jürgen Hestermann: As you may have seen from my code snippet I do not use mrCancel. What happens in this…
J?rgen Hestermann wrote 10 lines
Am 2015-12-13 um 16:52 schrieb Ondrej Pokorny: > On 13.12.2015 16:38, J?rgen Hestermann wrote: >> Also, the escape key no longer selects mrAbort. >> I cannot exit from the dialog with escape. >> Is this intended? > The escape key selects mrCancel now (this was changed) - but you > should definitely be able to exit the dialog with escape. See > http://bugs.freepascal.org/view.php?id=26019 . As you may have seen from my code snippet I do not use mrCancel. What happens in this case?

As I said before, mrCancel is returned, unless you defined a specific "cancel" button.

Should mrAbort used instead? At least I am (no longer) able to exit from this dialog with Escape (on Windows 8.1)

I am able to exit from the native dialog with Escape. You forgot to notice that you are using the non-native dialog through disabling themes in the application (which is a fundamental information for this issue).

Show quoted text 6 lines
> > If you have any trouble with the code change, please attach a sample > project so that we can discuss it more precisely. I would have no problem to switch from mrAbort to mrCancel. I am just wondering, why Escape no longer lets me there is no Button defined with "Cancel" property set to true

any more. I fixed that.

Nevertheless, the TMemo issue is more severe to me (even though I am planning to write my own QuestionDLG but this may take a while, too many other things in the pipeline....)

The memo width is computed from the text. But the width should be increased with the scrollbar and memo border width so that the text fits inside. If this is done, the memo doesn't have to be maximized (although it can) - Mattias added support for the memo, so I let him decide.

Ondrej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151213/d6b11c27/attachment.html>

Reply by email

Mattias Gaertner
to Ondrej Pokorny
Show quoted text 5 lines
[...] The memo width is computed from the text. But the width should be increased with the scrollbar and memo border width so that the text fits inside. If this is done, the memo doesn't have to be maximized (although it can) - Mattias added support for the memo, so I let him decide.

Fixed.

Mattias

Reply by email

Mattias Gaertner
to Juha Manninen: On Sun, Dec 13, 2015 at 5:38 PM, J?rgen Hestermann < Mattias committed in r50570 : LCL:…
Show quoted text 15 lines
On Sun, Dec 13, 2015 at 5:38 PM, J?rgen Hestermann < > wrote: > The idea of using a TMemo is not bad but then it should have the width of > the > window so that my text is not broken into more lines than neseccary. > Mattias committed in r50570 : LCL: default QuestionDlg: use TMemo when text too big Revisions 50572 and 50574 also deal with QuestionDlg. Yes, the Memo should be resized together with the dialog window, using anchors for example. Can you please open a bug report.

I made the dialog resizable in case a memo is shown.

Mattias

Reply by email

Jürgen Hestermann
to Ondrej Pokorny: The escape key selects mrCancel now (this was changed) - but you should definitely be…
Ondrej Pokorny wrote
The escape key selects mrCancel now (this was changed) -

I am not sure I understand this right.
Does it mean, mrCancel needs to be
checked too in a case statement like this?

case QuestionDlg('COPYING',
'Abort?',
mtConfirmation,
[mrNo, '&No','IsDefault',
mrYes,'&Yes'],0) of
mrYes : ...
mrNo : ...

    end; // of case

Can the result be mcCancel even when it's not part of the parameter list of the QuestionDlg function? That would be strange.

Reply by email

Mattias Gaertner
to Jürgen Hestermann
Show quoted text 18 lines
Am 2015-12-13 um 16:52 schrieb Ondrej Pokorny: > The escape key selects mrCancel now (this was changed) - I am not sure I understand this right. Does it mean, mrCancel needs to be checked too in a case statement like this? case QuestionDlg('COPYING', 'Abort?', mtConfirmation, [mrNo, '&No','IsDefault', mrYes,'&Yes'],0) of mrYes : ... mrNo : ... end; // of case Can the result be mcCancel even when it's not part of the parameter list of the QuestionDlg function?

Yes. Many widgetsets support an Escape key and/or have a close button. That's why there is the 'IsCancel' option to redirect the cancel to a button of your choice.

I fixed the case where a button is 'IsDefault' and 'IsCancel'.

Mattias

Reply by email

Ondrej Pokorny
to Mattias Gaertner
Mattias Gaertner wrote 24 lines
On Sat, 19 Dec 2015 11:17:26 +0100 J?rgen Hestermann wrote: > Am 2015-12-13 um 16:52 schrieb Ondrej Pokorny: > > The escape key selects mrCancel now (this was changed) - > > I am not sure I understand this right. > Does it mean, mrCancel needs to be > checked too in a case statement like this? > > case QuestionDlg('COPYING', > 'Abort?', > mtConfirmation, > [mrNo, '&No','IsDefault', > mrYes,'&Yes'],0) of > mrYes : ... > mrNo : ... > end; // of case > > Can the result be mcCancel even when it's not part > of the parameter list of the QuestionDlg function? Yes. Many widgetsets support an Escape key and/or have a close button. That's why there is the 'IsCancel' option to redirect the cancel to a button of your choice.

Mattias is completely right here. I just add that you had to care for mrCancel before as well (if default dialog was shown). It was returned when the dialog was closed with the system close button in the window caption. So the test code you sent isn't good for 1.4 either. Now the behavior should be consequent:
no 'iscancel' button defined: mrCancel is returned on ESC/close. 'iscancel' defined: its modal result is always returned on ESC/close.

Ondrej

Reply by email

Jürgen Hestermann
to Mattias Gaertner: On Sat, 19 Dec 2015 11:17:26 +0100 Yes. Many widgetsets support an Escape key and/or have…
Mattias Gaertner wrote 6 lines
On Sat, 19 Dec 2015 11:17:26 +0100 J?rgen Hestermann wrote: > Can the result be mcCancel even when it's not part > of the parameter list of the QuestionDlg function? Yes. Many widgetsets support an Escape key and/or have a close button. That's why there is the 'IsCancel' option to redirect the cancel to a button of your choice.

I just had a look at this
http://wiki.freepascal.org/Dialog_Examples#QuestionDlg but I can't find any mentioning of 'IsCancel'.

It also says:
"If the user cancels the dialog, be sure to check the result! In the above code, the result on cancelling the original dialog will be mrNo." That seems to be wrong if the result is always mrCancel.

Reply by email

Jürgen Hestermann
to Ondrej Pokorny: Mattias is completely right here. I just add that you had to care for mrCancel before as…
Ondrej Pokorny wrote
I just add that you had to care for mrCancel before as well (if default dialog was shown). It was returned when the dialog was closed with the system close button in the window caption. So the test code you sent isn't good for 1.4 either.

Before (with Lazarus 1.4) typing escape had the expected behaviour. Now (with Lazarus 1.6) the same code does nothing on escape. So something has changed.

Now the behavior should be consequent: no 'iscancel' button defined: mrCancel is returned on ESC/close. 'iscancel' defined: its modal result is always returned on ESC/close.

As already written in my other mail there is no documentation of 'iscancel' on http://wiki.freepascal.org/Dialog_Examples#QuestionDlg and here
http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/questiondlg.html neither 'isdefault' nor 'iscancel' is mentioned.

I simply did not know about should I, if it's undocumented?

Reply by email

Ondrej Pokorny
to Jürgen Hestermann
J?rgen Hestermann wrote 24 lines
Am 2015-12-20 um 08:06 schrieb Ondrej Pokorny: > I just add that you had to care for mrCancel before as well (if default dialog was shown). > It was returned when the dialog was closed with the system close button in the window caption. So the test code you sent isn't good for 1.4 either. Before (with Lazarus 1.4) typing escape had the expected behaviour. Now (with Lazarus 1.6) the same code does nothing on escape. So something has changed. > Now the behavior should be consequent: > no 'iscancel' button defined: mrCancel is returned on ESC/close. > 'iscancel' defined: its modal result is always returned on ESC/close. As already written in my other mail there is no documentation of 'iscancel' on http://wiki.freepascal.org/Dialog_Examples#QuestionDlg and here http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/questiondlg.html neither 'isdefault' nor 'iscancel' is mentioned. I simply did not know about 'iscancel' at all. How should I, if it's undocumented?

It's completely OK that you don't know it - we are trying to explain it to you , not to abuse you.

It's a feature from trunk added by me on Dec 13th 2015 and it is documented in trunk (although with some delay). I also merged it to 1.6 branch on Dec 14th 2015. Don't get me wrong - I don't want to be offensive but I expect everybody asking for bug fixes to check the trunk/fixes_1_6 SVN changes. You cannot see the implementation details otherwise.

You have to understand that new features in trunk are being developed and so they can change. Writing a documentation for features in development is not very reasonable.

Always look for documentation in trunk or the fixes branch. http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/questiondlg.html isn't automatically updated and unfortunately there is no datestamp when it was generated. It is told to be updated with new stable versions so now it should reflect 1.4. Of course you don't find the latest features there.

I updated the wiki page accordingly.

As latest, you have the source code, so you can check it as well - that usually is better than any documentation.

Ondrej

Reply by email

Jürgen Hestermann
to Ondrej Pokorny
Ondrej Pokorny wrote
It's a feature from trunk added by me on Dec 13th 2015 and it is documented in trunk (although with some delay). I also merged it to 1.6 branch on Dec 14th 2015. Don't get me wrong - I don't want to be offensive but I expect everybody asking for bug fixes to check the trunk/fixes_1_6 SVN changes. You cannot see the implementation details otherwise.

I did not even know that 'iscancel' is a bug fix.
I thought it existed in version 1.4 too.

You have to understand that new features in trunk are being developed and so they can change.

How do I know what are new features?
I just upgraded from Lazarus 1.4 to Lazarus 1.6 RC1 not knowing that the latter is just a development version. I never use(d) trunk versions.

Writing a documentation for features in development is not very reasonable.

Realy?
I thought that it is very important to document the *intended* behaviour somewhere before (or at least while) coding it so that everybody knows how things *should* work and can distinguish bugs from features.
Without documentation every bug becomes an intended behaviour.

Always look for documentation in trunk or the fixes branch.

Where do I find it?
I use official (pre) releases only.

It is told to be updated with new stable versions so now it should reflect 1.4. Of course you don't find the latest features there.

Okay, so the main reason for my problems is that I did not wait until the official release of Lazarus 1.6. I thought that RC1 should already be stable and wanted to help with testing (expecting only minor bugs only). But it seems that was not a good idea.

As latest, you have the source code, so you can check it as well - that usually is better than any documentation.

You cannot mean this seriously, do you?
You mean I should wade through *all* the
lines of code and understand each and every
line to discover new features and how they work?
Otherwise I would not have known that 'iscancel' was added recently. There could be changes in many other functions too.

What if there is a bug?
When looking at the code I would consider this bug to be an intended behaviour and rely on it (until it gets fixed and bytes me back).

Not a good advice IMO.

Reply by email

Ondrej Pokorny
to Jürgen Hestermann
J?rgen Hestermann wrote 9 lines
> Writing a documentation for features in development is not very reasonable. Realy? I thought that it is very important to document the *intended* behaviour somewhere before (or at least while) coding it so that everybody knows how things *should* work and can distinguish bugs from features. Without documentation every bug becomes an intended behaviour.

Yes, that's true. But you have to understand that a scope of some days between bug fixing and documenting should be tolerable.

J?rgen Hestermann wrote
> Always look for documentation in trunk or the fixes branch. Where do I find it? I use official (pre) releases only.

You find the documentation if you keep your mouse on the identifier in the source code in the official (pre) releases.
http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/questiondlg.html is generated from the same source.

J?rgen Hestermann wrote 7 lines
> It is told to be updated with new stable versions so now it should reflect 1.4. > Of course you don't find the latest features there. Okay, so the main reason for my problems is that I did not wait until the official release of Lazarus 1.6. I thought that RC1 should already be stable

RCs are not stable :(

and wanted to help with testing (expecting only minor bugs only). But it seems that was not a good idea.

On the contrary! It was a great idea and you pointed us/me to the fact that there is information missing. Please test RCs in the future as well. Thanks to you, it will be fixed for the 1.6 stable.

J?rgen Hestermann wrote 7 lines
> As latest, you have the source code, so you can check it as well - that usually is better than any documentation. You cannot mean this seriously, do you? You mean I should wade through *all* the lines of code and understand each and every line to discover new features and how they work?

Yes, I mean this seriously. You don't have to go through all the code, just the code that doesn't work as you expect. I do the same - if there is something I don't understand or it behaves differently from the docs, I look into the code and check why.

Ondrej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151220/9487efcd/attachment.html>

Reply by email

Michael Van Canneyt
to Ondrej Pokorny
Ondrej Pokorny wrote 9 lines
> You cannot mean this seriously, do you? > You mean I should wade through *all* the > lines of code and understand each and every > line to discover new features and how they work? Yes, I mean this seriously. You don't have to go through all the code, just the code that doesn't work as you expect. I do the same - if there is something I don't understand or it behaves differently from the docs, I look into the code and check why.

That is why I only ever use components that come with source code. The source is always the best reference for anything.

Michael.

Reply by email

Ondrej Pokorny
to Jürgen Hestermann: I did not even know that 'iscancel' is a bug fix. I thought it existed in version 1.4 too.
J?rgen Hestermann wrote
Where do I find it? I use official (pre) releases only.

Btw. if you read
http://wiki.lazarus.freepascal.org/Lazarus_1.6.0_release_notes , you find this information there:

* Added 'iscancel' parameter to QuestionDlg. If no cancel button is explicitely set, mrCancel is returned in case the dialog is closed with ESC or system close button.

I added it there on Dec 14th 2015...

Ondrej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151220/4baee678/attachment.html>

Reply by email

Jürgen Hestermann
to Ondrej Pokorny
Ondrej Pokorny wrote 11 lines
On 20.12.2015 17:51, J?rgen Hestermann wrote: > Where do I find it? > I use official (pre) releases only. Btw. if you read http://wiki.lazarus.freepascal.org/Lazarus_1.6.0_release_notes , you find this information there: * Added 'iscancel' parameter to QuestionDlg. If no cancel button is explicitely set, mrCancel is returned in case the dialog is closed with ESC or system close button. I added it there on Dec 14th 2015...

Well, I downloaded RC1 on Dec 10th and read the release notes before but it came not to my mind to read it again daily just in case some changes were made (to the changes ;-)).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151221/6eb13846/attachment.html>

Reply by email

Ondrej Pokorny
to Jürgen Hestermann
J?rgen Hestermann wrote
Well, I downloaded RC1 on Dec 10th and read the release notes before but it came not to my mind to read it again daily just in case some changes were made (to the changes ;-)).

Yes, sorry. I added the 'IsCancel' parameter as a bug fix upon your request because I realized that people may need it. Again, thanks for testing - without your question the code change without "IsCancel" would make it to 1.6 stable. Now it is corrected.

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151221/2e0790a9/attachment.html>

Reply by email