Recent

Author Topic: Size of window  (Read 2080 times)

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Size of window
« on: November 23, 2020, 12:48:03 am »
I'm puzzled why the end result is incorrect.  I imported this Delphi project into Lazarus.  I had to screw around a bit to get the LED indicator components changed.  Then during import it was still using the delphi .frm so a bit of editing to make it use the .lfm file with the new indicator led component.

So now it runs but the size of the window is way bigger than the design time window. 

The ELS-1.00b.jpg is the Delphi version.  The ScreenSize.jpg is the Lazarus version.   In the Screen size image you can see the development form on the RHS just behind the running program. 

Why is it so large?  I can't find anything the in the Project options (and I tried a few things) that makes it the right size?  Clearly it didn't import from Delphi in the exact way that I wanted.  But why is it so big?

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Size of window
« Reply #1 on: November 23, 2020, 01:03:52 am »
your desktop is configured for more than 96 DPI maybe ?

The scaling in the themes could be taking over..
The only true wisdom is knowing you know nothing

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Size of window
« Reply #2 on: November 23, 2020, 01:33:51 am »
Ah.  Hadn't thought of that.  I figured that if the scaling on the display for editing fit then why shouldn't the running application.  It's true though.  I'm working on an HP Laptop with 1080 17" screen and for my eyes the text is just to small so I have the window scaled up 125%.

Running it on the workstation with the 27" LCD 1080 display the window does indeed fit properly.

Other than getting rid of the TdsLED component which I haven't installed on the BeagleBone Black the code compiled and ran correctly on the beagle.  Screen shot attached.  And that at 987x731 image does fit in the laptop screen I guess because the laptop scales that too?

Why is the Lazarus output not scaled to fit like it is for the RAD Studio version compiled on the same laptop?

Compiling the original program with Delphi 10.3.3 creates a screen that fits.


jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Size of window
« Reply #3 on: November 23, 2020, 02:01:05 am »
you need to check your app settings in the PROJECT menu..

if you set it to not scale then It may work for you, can't be sure of that.
The only true wisdom is knowing you know nothing

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Size of window
« Reply #4 on: November 23, 2020, 02:48:41 am »
OK A bit more information. 
1. Compile on workstation with non-scaled screen changing form to say Workstation Version.
  a) Comes out the same size as the design size.
  b) run the exe on the laptop without recompiling and it comes out the correct size.
2. Compile it on the laptop without changing the form title
 a)  and it comes out the right size with respect to the design size.
3. Compile it on the laptop with a change to the form title .
 a) Now comes out scaled by about 125% and too large for the display.
 b) run that version on the non-scaled workstation and it is larger than before.  ie. Scaled again by about 125%.
4. Now compile that version without changing the form title text
 a) comes out larger again.
 b) change the form title and it's back to the correct size.

So here's the problem and maybe it is a Lazarus configuration parameter that I can't find. 

Lazarus doesn't have the right (or shouldn't) to automatically configure the size of a form arbitrarily.  The height and width are set by either dragging the corners of the form or changing them in the parameters window.  Now if the form parameters aren't edited then the .lfm file is left alone.  But touch a single parameter and the .lfm file is rewritten with the arbitrarily sized form values.  Those values appear to be set based on the development system screen size.

Contrast that with Delphi 10.3 running on either system.  Doesn't matter what you do to the form, the height and width remain the same.  Regardless of which system 10.3 is run on opening and working with that project in the same shared drive folder.  In both cases the form size height and width are the same on both IDEs.  The compiled code is the same on both systems.

In the case of the laptop with the scaled screen the form doesn't fit so Delphi adds scroll bars.  But it doesn't make the form smaller or larger.

The ability to fix this or even know where to go to fix this is currently above my pay grade.   I don't believe the .lfm file height and width values read from the .lfm file should be changed unless I explicitly change them.

Make sense?



jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Size of window
« Reply #5 on: November 23, 2020, 03:08:30 am »
sounds broken..

Go into the Project options at and turn off the "Use LCL scaling (HI DPI)"

also the TFORM has a scale property, play with that one too.

The only true wisdom is knowing you know nothing

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Size of window
« Reply #6 on: November 23, 2020, 05:13:02 am »
Already tried the LCL scaling.  No difference.  I'll check the TFORM.
OK.  The Scaled parameter was set TRUE.  On all three platforms.  Didn't make any difference on the Beaglebone Black (Linux).  Didn't make any difference on the Workstation (WIN-7) with the multiple monitors fancy graphics card.  Only the screen scaled laptop (WIN-10).

Also Delphi 10.3 also had it scaled on the form (since that's where the program came from).   No difference on laptop or workstation whether it's checked or not 

Setting it false on the workstation Lazarus and then saving it.  Next loading it on the laptop now shows the correct width/height values.  ie. no longer being changed.

That suggests that there is some sort of difference between Delphi and how they treat scaled and Lazarus.

Thanks for your help.
John

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Size of window
« Reply #7 on: November 23, 2020, 11:18:15 pm »
I'm going to continue with this thread because this is where I was headed when I ran into the size issue.

If you look at the attached PC-Clock.jpg you can see the design form on the right and the running application (Lazarus) on the left.  The TOD is also in the text line below but the important part from a size perspective is the frame around the digits.  It's set to be 320x240 the exact size of some SPI based LCD displays from Adafruit.  The plan is to set up the infrastructure so that I can use the canvas paint to image the canvas onto the hardware SPI display.  And be able to make use of all the Lazarus based tools and components so one doesn't need a separate TK or other graphics library.  Kind of like one stop shopping at the Lazarus store.

So now look at the second Pi-Clock.  The folder from the PC was put onto the Pi3.  The TdsLEDs component was installed into Lazarus in the same way it was done on the PC.  Then the application loaded and compiled and run.

Clearly we have a compatibility issue between how the component is handled with the PC Lazarus verses the Pi Lazarus.    I'm running Lazarus 2.0.10 on both systems and both screens are 1080.

Any suggestions?  Likely it's another size oriented checkbox.  Notice even the '1' or the '-'  is sitting slightly higher in the single segment where a digit shows up.

Thanks
John

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Size of window
« Reply #8 on: November 23, 2020, 11:43:56 pm »
I assume when you say PI you are talking about the raspberry PI ?

I what OS is on it ? if its Linux then the widget is causing the difference..

Looks like the brush or alpha channels may bot be set for the image.
The only true wisdom is knowing you know nothing

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Size of window
« Reply #9 on: November 24, 2020, 12:20:53 am »
Yes Pi3.  The write once, compile anywhere isn't working well...

I've attached the zip.  Just a bit of background.  I started by rewriting the C version of the Adafruit_GFX library.  Then as I dug into it more I realized that everything except the SPI outputs were really already covered with what Delphi and Lazarus provide.   So I went on line and found a component with a 7 segment LED as a test for seeing how easy it might be.  Don't really use the GFX unit so it's called Adafruit_GFX but nothing there anymore.

The end result is the component for the LEDs that ends up installed into the Graphics Tab with 3 items and exactly the same icon.  Haven't quite figured that one out although I think I named it graphics but I doubt that's my problem.

« Last Edit: November 24, 2020, 12:23:06 am by jcdammeyer »

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Size of window
« Reply #10 on: November 24, 2020, 12:47:27 am »
There is a online package called "IndustrialStuff" that has the 7 segment LED and other controls in it.

Not saying this is your issue but I believe what you are seeing is uninitialized images on the background using the Tbitmap which behaves a littler different over Delphi's

 For one it tends to have a black background initially instead of white.

 so you could be experiencing differences in the widgets I would say ?

 Be it QT or GTK over the Win32 etc

Also with windows Themes intercepts many of the colors for the controls and even if you don't have themes turned on there some controls windows just insist on painting using colors of its choice according to system settings

The only true wisdom is knowing you know nothing

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Size of window
« Reply #11 on: November 24, 2020, 01:19:11 am »
You may benefit from carefully reading this wiki article Autosize/Layout bearing mind that there are some minor differences between different widget sets and operating systems (eg Win32 - Windows/GTK2 - FreeBSD/Cocoa - macOS).

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Size of window
« Reply #12 on: November 24, 2020, 01:47:49 am »
Thanks.  That's quite an extensive document.  I'll look into it. 

 

TinyPortal © 2005-2018