Recent

Author Topic: SOLVED: Changing all controls style  (Read 1099 times)

SaraT

  • Full Member
  • ***
  • Posts: 121
  • A little student
SOLVED: Changing all controls style
« on: February 16, 2020, 10:06:30 pm »
Hi guys ;)
Some examples in Lazarus folder have an old style control.

Is there any option to change and use a modern style for the controls?
I don't want to copy/paste every control and the code to apply mannually the style.

Many thanks guys.
« Last Edit: February 17, 2020, 02:56:36 am by SaraT »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Changing all controls style
« Reply #1 on: February 16, 2020, 10:24:30 pm »
Hi!

Remember : Here are no visionaries!

So you want to replace a simple TButton with a TSomeFlatStuffButton (or whatever)???

Lazarus is Rapid Prototyping not Whitchcraft Prototyping!!

There is no legal way to do this.
There might be some hacks but they are dangerous.

Winni

laznewb

  • New Member
  • *
  • Posts: 20
Re: Changing all controls style
« Reply #2 on: February 17, 2020, 12:06:31 am »
Hi  :)

I don't see any folder, just a picture. What old control are you trying to manipulate?

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Changing all controls style
« Reply #3 on: February 17, 2020, 12:26:14 am »
Please explain exactly what it is you are trying to do.

It might be possible to do a search and replace in your lfm files, but you have to be very careful not to corrupt them. I did this successfully when replacing hundreds of TStaticTexts with TLabels.
« Last Edit: February 17, 2020, 12:29:37 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Changing all controls style
« Reply #4 on: February 17, 2020, 01:27:55 am »
Hi guys ;)
Some examples in Lazarus folder have an old style control.

Is there any option to change and use a modern style for the controls?
I don't want to copy/paste every control and the code to apply mannually the style.

Many thanks guys.

Thats because there is no manifest on these, on Windows starting from XP you need a manifest file to apply themes in the application.

Seems that these projects are older than Windows XP or are old enough when the IDE has no option to enable themes, or just is turned off.

Try in project options menu to add manifest to enable themes, but that must be done for each project. And when you install a newer lazarus, these will be changed again.

To solve this, better issue a bug report in the bugtracker, saying that demo projects does not come with themes enabled under Windows.

Also if you run the application on a monitor with High DPI you will notice it will look badly too, since maybe the High DPI setting is turned off too by default in these old projects...

SaraT

  • Full Member
  • ***
  • Posts: 121
  • A little student
Re: Changing all controls style
« Reply #5 on: February 17, 2020, 02:56:12 am »
Hi guys ;)
Some examples in Lazarus folder have an old style control.

Is there any option to change and use a modern style for the controls?
I don't want to copy/paste every control and the code to apply mannually the style.

Many thanks guys.

Thats because there is no manifest on these, on Windows starting from XP you need a manifest file to apply themes in the application.

Seems that these projects are older than Windows XP or are old enough when the IDE has no option to enable themes, or just is turned off.

Try in project options menu to add manifest to enable themes, but that must be done for each project. And when you install a newer lazarus, these will be changed again.

To solve this, better issue a bug report in the bugtracker, saying that demo projects does not come with themes enabled under Windows.

Also if you run the application on a monitor with High DPI you will notice it will look badly too, since maybe the High DPI setting is turned off too by default in these old projects...

Many thanks Lainz, problem solved.

Below image to see what was the problem :)
Happy night.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: SOLVED: Changing all controls style
« Reply #6 on: February 17, 2020, 03:29:51 am »
I think you actually found a bug, since just disabling high dpi does not mean that themes must not be enabled, because there is a checkbox for that.

 

TinyPortal © 2005-2018