Recent

Author Topic: Can not control compiling with or without enabeling themes.  (Read 846 times)

han

  • Full Member
  • ***
  • Posts: 102
My application is normally compiled in a version with enabled themes and without enabled themes. Currently I have no control over this behavior. Sometimes it compiles with themes enabled sometimes without.  The setting in the project options is ignored. This happens using Lazarus 3.2 and 2.24. Is seems related to my application. Testing an example program does not show this problem.

Anybody an idea what could cause this? Where to look?

dsiders

  • Hero Member
  • *****
  • Posts: 1142
Re: Can not control compiling with or without enabeling themes.
« Reply #1 on: May 19, 2024, 09:43:49 pm »
My application is normally compiled in a version with enabled themes and without enabled themes. Currently I have no control over this behavior. Sometimes it compiles with themes enabled sometimes without.  The setting in the project options is ignored. This happens using Lazarus 3.2 and 2.24. Is seems related to my application. Testing an example program does not show this problem.

Anybody an idea what could cause this? Where to look?

Look at the Project Options > Use manifest resource (and enable themes) check box. Checked for theme. Unchecked for no theme.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

han

  • Full Member
  • ***
  • Posts: 102
Re: Can not control compiling with or without enabeling themes.
« Reply #2 on: May 26, 2024, 12:52:45 pm »
Quote
  Look at the Project Options > Use manifest resource (and enable themes) check box. Checked for theme. Unchecked for no theme.
Yes I have used that for years but the compiler doesn't follow this check-mark anymore. I'm flabbergasted. I use two *.lpi Lazarus files for two versions of my program. Sometimes I get two programs with themes enabled. Sometimes two programs with themes disabled. I tried to delete *.ppu, *.ppl. *.o and the executable between compiling the second version but it doesn't help.

If I check or uncheck themes in the IDE, project options it doesn't work always. It looks random to me.
« Last Edit: May 26, 2024, 12:56:31 pm by han »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Can not control compiling with or without enabeling themes.
« Reply #3 on: May 26, 2024, 01:27:28 pm »
I am unsure if it helps and if I understood, so here is what I do:
- open project
- change option(s), including your problematic one
- save project
- build project [SHIFT-F9] (not compile)
- test project (run)

I assume you do just run/F9/compile to test, that way the resources are not recompiled all-the-time correct so it uses an old one where the changes arent updated yet.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

han

  • Full Member
  • ***
  • Posts: 102
Re: Can not control compiling with or without enabeling themes.
« Reply #4 on: May 26, 2024, 05:21:51 pm »
In tried almost everything including clean up and build. Still it stubborn sometimes enable themes always sometimes not.

For example i have prepared two application.lpi files. So

application.lpi
and
application_themes.lpi

If I compile them as

d:\lazarus\lazbuild -B application.lpi

d:\lazarus\lazbuild -B application_themes.lpi

Sometimes both commands produce an application with themes enabled sometimes not. Deleting the executable between the compiling test doesn't help. The application with themes enabled is about 2 kbyte larger.  But I'm not ware if there is any log lines showing the enabling themes is successful/done.

Above problem is repeatable in the IDE. But toggeling the option seems to help.

If themes is disabled this is missing in the *.lpi:

<UseXPManifest Value="True"/>

Since toggling helps, I have the impression that the themes enabling is stored at an other location then the *.lpi or *.lpr file. Deleting the application.res doesn't help.







han

  • Full Member
  • ***
  • Posts: 102
Re: Can not control compiling with or without enabeling themes.
« Reply #5 on: May 26, 2024, 05:54:41 pm »
The problem becomes clearer.  Using the same source I have two configuration sets:

application.lpi
application.lpr


application_themes.lpi
application_themes.lpr


They differ in the *.lpi file only by <UseXPManifest Value="True"/> However that doesn't seems to control the compiling with or without themes. It is somewhere else stored. 

So if the themes is disabled and I open application_themes.lpi then themes look enabled but it doesn't work. Only if I do the following toggeling it works:


Disable themes
Build
Enable themes
Build, run



« Last Edit: May 26, 2024, 05:56:22 pm by han »

han

  • Full Member
  • ***
  • Posts: 102
Re: Can not control compiling with or without enabeling themes.
« Reply #6 on: May 26, 2024, 07:32:54 pm »
I have found the solution.

In the .lpi file there is a link to the .lpr file. If I modify in application_themes.lpi the link as follows:

- <Filename Value="application.lpr"/>
+ <Filename Value="application_themes.lpr"/>

Then the problem is gone. The option themes=enabled add to the .lpr file the following line:

{$R *.res} 

This seems to enable themes. If check-mark themes is disabled this {$R *.res}  is removed again. So just ensure in the .lpi the correct .lpr is specified. That's all.

« Last Edit: May 26, 2024, 07:48:15 pm by han »

 

TinyPortal © 2005-2018