Recent

Author Topic: Understanding ChartListBox  (Read 1841 times)

AL

  • Sr. Member
  • ****
  • Posts: 261
Understanding ChartListBox
« on: August 10, 2020, 03:57:48 am »
I am using 2 ChartListBox in an application.
The Win version and the MacOS version are behaving similarely.
I just ported my app to Ubuntu 20.04 and I had to redimention the listbox.
I played with height/ itemheight constraints max height, etc in trying to have just one set up for all app versions, but so far I am not successfull.
In win I have my height set to 100 for an item height of 10 in Linux I need to set it to 140 for the same item height.  Although item height does not seems to make a difference in the display.
I understand that the dpi monitor resolution, etc. might be different.  I there a way to compensate for that?  Otherwise I will resort to change the height in the code in the form create event.

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: 11853
Re: Understanding ChartListBox
« Reply #1 on: August 10, 2020, 09:59:16 am »
When you plan to compile the same application for several widgetsets, i.e. Windows and macOS, then you should layout your forms using the anchor editor and work with AutoSize (https://wiki.freepascal.org/Anchor_Sides, https://wiki.freepascal.org/Autosize_/_Layout).

AL

  • Sr. Member
  • ****
  • Posts: 261
Re: Understanding ChartListBox
« Reply #2 on: August 12, 2020, 12:24:09 am »
I could not find an AutoSize property in ChartListBox!
Should it be called from code ?
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: 11853
Re: Understanding ChartListBox
« Reply #3 on: August 12, 2020, 10:00:04 am »
I meant the AutoSize of the container which is needed when you let controls arrange themselves by anchoring. What exactly should the arrangement of chart and chartlistbox look like? Maybe I can show you code what I mean.

AL

  • Sr. Member
  • ****
  • Posts: 261
Re: Understanding ChartListBox
« Reply #4 on: August 12, 2020, 03:28:26 pm »
Oh, I didn't realize Autosize should be on the container!  Buttons do have an autosize property.
My container is my MainForm (I did not use any panel, etc.)
I use anchoring of all items to place them on the form.
I will activate Autosize and see what it gives
Thank you
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: 11853
Re: Understanding ChartListBox
« Reply #5 on: August 12, 2020, 06:22:32 pm »
Please study the listboxdemo in the folder components/tachart/demo of your Lazarus installation. It is designed with anchoring and auto-sizing (I just uploaded a new version with some problems fixed). This way the form look fine in all widgetsets (except in qt5 having those super-large spin buttons which are not considered by the LCL correctly). Note that many details are become visible if you have the AnchorEditor open. Select each control on the left panel and try to understand what the anchor editor shows.

 

TinyPortal © 2005-2018