Recent

Author Topic: [SOLVED] ChartListBox: Check and Radio not showing in COCOA  (Read 7756 times)

AL

  • Sr. Member
  • ****
  • Posts: 264
[SOLVED] ChartListBox: Check and Radio not showing in COCOA
« on: January 30, 2020, 03:54:08 pm »
The Chart listBox component does not show the checkbox in Cocoa the icon (line) is shown.
With the radio button activated.  The radio button is not shown and the icon (line) not shown.

This is with cross compiling win10-Darwin
FPC 3.3.1 Laz 2.1.0
Tested in VMWare Mac 10.14
« Last Edit: February 18, 2020, 12:56:46 am by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 11908
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #1 on: January 30, 2020, 04:53:49 pm »
The ChartListBox is similar to a TCheckListBox (on palette "Additional"). Does is show the same issue? Or are the checkboxes drawn correctly, but the radion buttons not?

Again, could you also post the screenshot taken on Windows so that I can see what you are expecting? (Or post the entire project).

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #2 on: January 30, 2020, 06:28:30 pm »
The listbox is drawn correctly, only the checkbox is not shown when checkbox is selected and the radiobutton and icon are not shown when radio button is selected.

Here is a windows version for comparison.
This is an empty project just to demonstrate the behavior.
Would it be better to post this in COCOA?
« Last Edit: January 30, 2020, 06:31:50 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 11908
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #3 on: January 30, 2020, 08:01:47 pm »
And is the checkbox displayed correctly for the CheckListBox? If yes I could look for the differences.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #4 on: January 30, 2020, 10:19:00 pm »
The check square is not displayed but the icon is displayed.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 11908
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #5 on: January 31, 2020, 01:24:34 am »
Icon in the TCheckListbox? You probably don't understand what I mean. I am talking of the TCheckListbox on palette "Additional" - see screenshot. It is as standard component with similar functionality as TChartListbox but it draws the checkbox a bit differently.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #6 on: January 31, 2020, 01:45:05 am »
Oh, sorry my bad, checklistbox, chartlistbox with check,... confusing.

Yes the CHECKlistbox show properly in MacOS as you can see on the attached.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 11908
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #7 on: January 31, 2020, 09:47:46 am »
Here's another test: Could you show me how the attached demo behaves in MacOS? It shows two more LCL controls, a TStringGrid with checkbox column, and a TCheckCombobox. In both controls, the checkboxes are drawn using the theme services, like in TChartlistbox. If checks are not displayed here again then this is an argument that theme services for checkboxes are not correctly implemented for MacOS. (TCheckListBox that you already tested passes the drawing task to the widget set).

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #8 on: January 31, 2020, 03:28:24 pm »
Here is the result in VM MacOS and Win64

Edit:   added new printscreen with combobox drop down.

There is a little glitch when not dropdown but it show the checkbox correctly
« Last Edit: January 31, 2020, 03:36:57 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #9 on: February 12, 2020, 01:35:36 am »
WP, could you make sense of why this is happening?
Would it be better to make a bug report in Cocoa?
Thanks
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 11908
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #10 on: February 12, 2020, 04:05:32 pm »
Could you try the attached project on Mac? It draws a checked and an unchecked checkbox onto two paintboxes. In the first paintbox the checkbox size is determined by the code as is done in TChartListbox, in the second it is determined by the theme services as is done by the other LCL controls. It's hard to believe that this would make a difference, but beyond that the drawing code looks fairly similar.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #11 on: February 12, 2020, 10:06:44 pm »
You were right! There is no difference. None of them show a check.
Also the Mac does not show the label.
This is on a virtual Mac.  May be we need someone to try it on a real Mac.
Trev has been very helpfull in another problem, I will send a PM and ask him to try the attached.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #12 on: February 12, 2020, 10:39:27 pm »
Result of the test.zip project on a 2018 Mac mini running  Mojave 10.14.6 is attached.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #13 on: February 12, 2020, 10:47:27 pm »
Thank you Trev,  this give the same as in my Vm MAC.
It look like this is more work for the Cocoa team!
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 11908
Re: ChartListBox: Check and Radio not showing in COCOA
« Reply #14 on: February 12, 2020, 10:57:18 pm »
"No themes enabled" in the title? How is that? I thought themes are always enabled nowadays... Comparing with the TCustomStringGrid code I see that the check for "ThemeServices.ThemesEnabled" is skipped. Could you please remove the line "if ThemeServices.ThemesEnabled" (and the associated "else" block) so that the entire OnPaint handler of the paintboxes is like this:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.PaintBox1Paint(Sender: TObject);
  2. const
  3.   THEMED_FLAGS: array [Boolean] of TThemedButton = (
  4.     tbCheckBoxUncheckedNormal, tbCheckBoxCheckedNormal
  5.   );
  6. var
  7.   rcb: TRect;
  8.   te: TThemedElementDetails;
  9.   ch: Boolean;
  10.   sz: TSize;
  11.   paintbox: TPaintBox;
  12.   lbl: TLabel;
  13. begin
  14.   paintbox := TPaintBox(Sender);
  15.   if Sender = Paintbox1 then
  16.     lbl := Label1
  17.   else
  18.     lbl := Label2;
  19.  
  20.   paintbox.Canvas.Brush.Color := clWhite;
  21.   paintbox.Canvas.FillRect(Rect(0, 0, paintbox.Width, paintbox.Height));
  22.  
  23.   //if ThemeServices.ThemesEnabled then begin   // <---------- REMOVE THIS LINE ...
  24.     ch := true;
  25.     te := ThemeServices.GetElementDetails(THEMED_FLAGS[ch]);
  26.     if Sender = Paintbox1 then
  27.       sz := Size(30, 30)
  28.     else
  29.       sz := ThemeServices.GetDetailSize(te);;
  30.     rcb := Rect(0, 0, sz.CX, sz.CY);
  31.     lbl.Caption := Format('rcb = %d %d %d %d', [rcb.Left, rcb.Top, rcb.Right, rcb.Bottom]);
  32.     ThemeServices.DrawElement(paintbox.Canvas.Handle, te, rcb);
  33.  
  34.     OffsetRect(rcb, 40, 0);
  35.     ch := false;
  36.     te := ThemeServices.GetElementDetails(THEMED_FLAGS[ch]);
  37.     ThemeServices.DrawElement(paintbox.Canvas.Handle, te, rcb);
  38.   //end                                  // <-------------- AND THESE
  39.   //else
  40.   //  Caption := 'NO THEMES ENABLED';
  41. end;
« Last Edit: February 12, 2020, 11:03:55 pm by wp »

 

TinyPortal © 2005-2018