Recent

Author Topic: [fixed] [bug 39155] Title of TColorDialog is not shown  (Read 13435 times)

Muso

  • Sr. Member
  • ****
  • Posts: 362
[fixed] [bug 39155] Title of TColorDialog is not shown
« on: July 04, 2021, 03:40:02 pm »
I use Lazarus 2.3.0 r65354 FPC 3.2.2 x86_64-win64-win32/win64

and when executing a TColorDialog, the content of its Title property is not shown.

In my case the title is "Select Chart Background Color" but when the color dialog is shown, I can't see the title anywhere, see the attached screenshot.

Is there a further setting necessary to get the title displayed?

Another issue is that my program is in English because since the Windows is a German ones not every colleague who should use the program can read German well. So how can I translate the dialog to English?
I found how to translate in general:
https://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs#Translating_at_start_of_program
but maybe the standard dialogs are already translated and I just have to call them differently to get them in English?

« Last Edit: July 05, 2021, 08:17:16 pm by Muso »

wp

  • Hero Member
  • *****
  • Posts: 13264
Re: Title of TColorDialog is not shown
« Reply #1 on: July 04, 2021, 05:27:36 pm »
Debugging into this issue I noticed that the TColorDialog.Execute in case of the win32_64 widgetset calls the Windows function ChooseColor - this means that all you see is done by Windows. ChooseColor accepts a pointer to a record with parameters, but the form Title is not among them. So, you either live with this deficiency, or you write your own color dialog.

jamie

  • Hero Member
  • *****
  • Posts: 7396
Re: Title of TColorDialog is not shown
« Reply #2 on: July 04, 2021, 06:51:31 pm »
ChooseColor can have its caption altered but because its a modal form its hard to get to the handle unless you scan for the active form which would be the Dialog at the time. I guess this could be done in the OnShow maybe but I am not so sure if the form is ready at that time ?

 But in any case, the real issue is that a Callback was never created in the widget (flag and Callback address) for the dialog initiation event. In this event you can use the Windows.SetWindowText('xxxxx') and you will get what you need.

 Looking in the other Win32WSDilogs examples you can see how it's done.
The only true wisdom is knowing you know nothing

Muso

  • Sr. Member
  • ****
  • Posts: 362
Re: Title of TColorDialog is not shown
« Reply #3 on: July 04, 2021, 07:02:03 pm »
ChooseColor accepts a pointer to a record with parameters, but the form Title is not among them. So, you either live with this deficiency, or you write your own color dialog.

I don't fully understand because for example the SaveDialog works fine - I get the title displayed.
Is it not possible to fix the ColorDialog to behave like the SaveDialog or FileOpen dialog of the LCL?

Muso

  • Sr. Member
  • ****
  • Posts: 362
Re: Title of TColorDialog is not shown
« Reply #4 on: July 04, 2021, 07:09:38 pm »
But in any case, the real issue is that a Callback was never created in the widget (flag and Callback address) for the dialog initiation event. In this event you can use the Windows.SetWindowText('xxxxx') and you will get what you need.

Looking in the other Win32WSDilogs examples you can see how it's done.

Maybe because I am still quite a noob, I don't understand your post. I mean I develop a 64bit program, so no Win32 specials should be used. I only use the dialogs provided by the LCL and since TFileOpenDialog has a title I thought TColorDialog's title works the same way. if not, I think that the Title property should then not be offered in the IDE.

In any case, what should I do as bug report? Report that the title is not shown or that this property is offered while it won't be used?

jamie

  • Hero Member
  • *****
  • Posts: 7396
Re: Title of TColorDialog is not shown
« Reply #5 on: July 04, 2021, 07:13:16 pm »
 You can file a bug report If you wish.
 
 If you do, make sure you point back to this thread and explain a little that it needs a callback for the dialog in the Widget, the DEVS will understand.
The only true wisdom is knowing you know nothing

Muso

  • Sr. Member
  • ****
  • Posts: 362
Re: Title of TColorDialog is not shown
« Reply #6 on: July 05, 2021, 12:03:57 am »
You can file a bug report If you wish.
  If you do, make sure you point back to this thread and explain a little that it needs a callback for the dialog in the Widget, the DEVS will understand.

Done, here is the bug report: https://bugs.freepascal.org/view.php?id=39155

Bart

  • Hero Member
  • *****
  • Posts: 5643
    • Bart en Mariska's Webstek
Re: Title of TColorDialog is not shown
« Reply #7 on: July 05, 2021, 10:58:14 am »
Done, here is the bug report: https://bugs.freepascal.org/view.php?id=39155

As explained to you by wp, this is not a bug.
As Lazarus tries to use (by design) native dialogs (as in: native to the underlying OS/widgetset), it simply displays the normal colordialog that Windows provides.
And you cannot set the title of that dialog.

I therefore resolve this bugreport as "no change required".
Please close it.

W.r.t. TOpen/TSaveDialog: Windows (and most other widgetsets) let you specify it's title, since the dialog can be used to select one or mer files and then do with those files (actually the filenames) whatever the progeam sees fit: open them, displaye the names in a TMemo, send the names to another process, upload them to somewehere else etc etc. If the dialog would alway have the title "Open" then this would not be correct in most of these scenario's.

Bart

Muso

  • Sr. Member
  • ****
  • Posts: 362
Re: Title of TColorDialog is not shown
« Reply #8 on: July 05, 2021, 11:07:45 am »
As explained to you by wp, this is not a bug.

Sorry, but I still don't understand the IDE then.

* TOpenDialog: I set "Title" to "Open Sensor Definition File" and get correctly the dialog with this title, see attached.
* TColorDialog: The IDE provides a "Title" but this will never appear.

So either the bug is that the title handling is different for color than wit the other dialogs or the bug is that a title is offered at all.

As it is it is definitely a bug because it costs time for the user to find out why the offered property is not used.

Soner

  • Sr. Member
  • ****
  • Posts: 326
Re: [bug 39155] Title of TColorDialog is not shown
« Reply #9 on: July 05, 2021, 11:12:18 am »
Somethings are going wrong on creation of the colordialog. Look at my notice on the bug report.
The handle of colordialog is invalid when onshow fired while the handle of opendialog is valid.
I could not find the error, I think it is bug.

wp

  • Hero Member
  • *****
  • Posts: 13264
Re: Title of TColorDialog is not shown
« Reply #10 on: July 05, 2021, 11:18:48 am »
* TColorDialog: The IDE provides a "Title" but this will never appear.
This statement is correct only for Windows. On Linux gtk2, the user-defined title will be used. It is similar to the Font or Color properties of some controls - the properties are there, but it depends on the widgetset if they can be used or not.

When you look at page "Restricted" of the object inspector you'll see the entry "Title" for the TColorDialog - this means that there are restrictions regarding this TColorDialog property
« Last Edit: July 05, 2021, 03:46:31 pm by wp »

Bart

  • Hero Member
  • *****
  • Posts: 5643
    • Bart en Mariska's Webstek
Re: [bug 39155] Title of TColorDialog is not shown
« Reply #11 on: July 05, 2021, 12:12:57 pm »
I closed that bugreport.

Bart

Muso

  • Sr. Member
  • ****
  • Posts: 362
Re: [bug 39155] Title of TColorDialog is not shown
« Reply #12 on: July 05, 2021, 01:40:27 pm »
I closed that bugreport.

Despite user Soner just stated that he too thinks it is a bug?

Muso

  • Sr. Member
  • ****
  • Posts: 362
Re: Title of TColorDialog is not shown
« Reply #13 on: July 05, 2021, 01:44:34 pm »
When you look at page "Restricted" of the object inspector you'll see the entry "Title" for the TColorDialog - this means that there are restrictions regarding this TColorDialog .property

Interesting, I did not know this. To make this more clear for the users, restricted fields should become disabled in the IDE

However, the question remains why does the title work for the other dialogs but not for the ColorDialog? In the bugreports users posted methods how to achieve the title in Delphi and I thought what is possible with system dialogs in Delphi is then also possible on Windows in general and therefore should also be somehow doable in Lazarus.

jamie

  • Hero Member
  • *****
  • Posts: 7396
Re: [bug 39155] Title of TColorDialog is not shown
« Reply #14 on: July 05, 2021, 02:34:24 pm »
Sorry..

I have both a local work around and patch ready for submission to include the Callback hook in the Widget so the title can be assigned..

I see the report was closed, no surprise..

I'll file this back in my archives for my use if I ever decide I need it.

I can't deal with the politics of a few individuals, someone else will have to fight the battle.

Enjoy.



The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018