Recent

Author Topic: Windows manifest setting  (Read 9747 times)

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Windows manifest setting
« on: December 22, 2014, 08:40:45 pm »
I have converted an old Delphi project to a Lazarus project with version 1.2.6 on Windows XP, pack 3, win32.

It did not create an LPR file but retained the DPR.

It did not activate the Manifest to enable themes.

All operates well, but my design mode is with themes, and its compilation is without.

I selected manifest from the project options... it compiles with the theme, but its buttons will not paint unless I hover over each one with the mouse. Also, none of the buttons are clickable. They are dead.

Trying to undo the setting is difficult. I have to deselect manifest, then change the defaultmonitor for the main form. Then exit the IDE and restart.

I have another Delphi project compiled from a former version and with the same manifest setting. It operates properly.

I reinstalled versaion 1.2.4 and still had the same results.

The unit settings are as follows...

unit CmdCalcFrm;

{$IFDEF FPC}
  {$MODE Delphi}
{$ELSE}
   {$APPTYPE CONSOLE}
{$ENDIF}

interface

uses
{$IFnDEF FPC}
  Windows,
{$ELSE}
  LCLIntf, LCLType, LMessages,
{$ENDIF}
  Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
  ExtCtrls, ClipBrd, Buttons;  // buttons?

I have added "buttons" to the list, but it has not helped.

I can activate manifest, but the defaultmonitor must be set to dmactiveform instead of dmdesktop. It does not, however, use the manifest function. But version 1.2.6 had not reset functionality so easily.

I installed version 1.2.0. It does not have a make.exe file.

I deleted all lazarus folders and reinstalled 1.2.6 with the same results. I cannot get the manifest function to work.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Windows manifest setting
« Reply #1 on: December 23, 2014, 04:47:10 pm »
AFAIK, conversions for Delphi projects are not absolutely perfect; mainly because there are a lot of possible situations, I guess.

Unless I'm wrongly interpreted your post, it seems that your own conversion has give an incorrect result.

A few more questions:

- have you used the internal conversion tool of Lazarus to convert your project ("Convert Delphi project to Lazarus project...") ?
If yes, have you looked at the log file produced ("AutomaticConversion.log") ? Can you see any error, especially at the end of the log file ?

- are you using any "special" Windows APIs in your Delphi project, especially in relation with your buttons ? BTW, have you this problem only for your buttons, or are also for your other controls ? Do you use the standard TButton class, or some other ones like TSpeedButton, TBitBtn ?

- I can see that the "{$APPTYPE CONSOLE}" directive is present into your source code ? Does it mean that your project is doing something "special" (CONSOLE is generally not used for GUI projects) ?

- are you using some particular resources in your project ? Especially if they are stored in your "[YourProjectName].res" file ? BTW, can you see the manifest file in your Lazarus resource file when you compile your Lazarus project with the "Use manifest file to enable themes (Windows only)" option ?

- anything else "special" that your project may use, as far as you can say ?


Notes:

* Buttons in "uses" clause is not necessary if your are only using the standard TButton class: they are coming with StdCtrls. Contrarily to TSpeedButton, TBitBtn.


* Is your project a very big one, with a lot of units and a lot of forms ? Because it's still possible to make the conversion "by hand".

It's not as as complicated as it looks like, at first sight. And you've got the complete control of what is converted and how it's converted in this case.

Of course, a few more work is needed. But for a "reasonable" project, converting by hand the unit one by one and the form one by one too is generally pretty simple. Then, only a few more "final tunes" are necessary to make it run properly.

But it required to be at least a bit familiar with the FPC/Lazarus environment, of course.

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Windows manifest setting
« Reply #2 on: December 23, 2014, 05:44:36 pm »
Thanks for responding.

It is a single unit. It only uses Tbuttons and Tedits. The conversion was done by "Convert Delphi project to Lazarus project...". Its log is as follows.


* Converting file D:\_Files\Database\Lazarus Code\CmdCalc\Laz-Calc\ProjectCalc.dpr *
Added defines -dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL in custom options
Found all unit files
* Fixing used units for file D:\_Files\Database\Lazarus Code\CmdCalc\Laz-Calc\ProjectCalc.dpr *

*** Converting unit files belonging to project/package ***
* Converting file D:\_Files\Database\Lazarus Code\CmdCalc\Laz-Calc\CmdCalcFrm.pas *
Replaced unit "Windows" with "LCLIntf, LCLType, LMessages" in uses section.

*** Fixing used units and Repairing form files ***
* Repairing form file D:\_Files\Database\Lazarus Code\CmdCalc\Laz-Calc\CmdCalcFrm.lfm *
Removed property "BevelOuter".
Removed property "BevelOuter".
Removed property "BevelOuter".
Removed property "BevelOuter".
Removed property "TextHeight".
Removed property "OldCreateOrder".
Removed property "Icon.Data".
* Fixing used units for file D:\_Files\Database\Lazarus Code\CmdCalc\Laz-Calc\CmdCalcFrm.pas *
Conversion took: 00:00:05
Conversion Ready.


The Console code was what I found in the second program. I was trying to implement its functionality since it works. I have now restored the former conversion as follows.


unit CmdCalcFrm;

{$IFDEF FPC}
  {$MODE Delphi}
{$ENDIF}

interface

uses
{$IFNDEF FPC}
  Windows,
{$ELSE}
  LCLIntf, LCLType, LMessages,
{$ENDIF}
  Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
  ExtCtrls, ClipBrd;


The above has not helped. I have been checking the DPR file. Manifest inserts {$R *.res} when selected, but it does not remove it when deselecting the option. That is why it has been difficult to restore the buttons to plain functionality.

>> BTW, have you this problem only for your buttons, or are also for your other controls ?

It displays a few buttons with their theme. The others are empty boxes. If I hover over the boxes they repaint with their theme. Not of the buttons will click. They are dead. Keyboard entry is also dead.

I was suspect of the RES file so I manually copy pasted the RES file from the other project and renamed it... since it works with the other project. It did not use it. Instead it just created a new RES. I restored the former RES file in its stead.

I am not sure of how to answer your other questions. I only know PASCAL. Not very much about LAZARUS. I have noticed however that there is a Link.res file. Can that be presenting any issues?










Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Windows manifest setting
« Reply #3 on: December 23, 2014, 05:49:17 pm »
I forgot two important things...

1/ If your .dpr file has not been converted automatically to an .lpr file (eventually if you've not done a "Save all" just after the conversion if you've got some errors/warnings during the conversion), you may miss or have incomplete code in your current .lpr file.

2/ Have you used the "Support Delphi" target option when converting your Delphi project ? I guess so, considering the output source code your are showing. And it may explain why you don't have a new .lpr file but still a .dpr file.

In this case, I suggest you to make another conversion without checking the "Support Delphi" target option.

**Edit ** : Sorry, we have been posting at the same time. Anyway, I suggest you to read first the second paragraph just above (i.e. "2/").
« Last Edit: December 23, 2014, 06:29:50 pm by ChrisF »

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Windows manifest setting
« Reply #4 on: December 23, 2014, 06:22:11 pm »
Considering your second post, it seems that your project have nothing "special" (especially looking at your conversion log file).

Except eventually the "Icon.Data" property. Are you using a systray feature into your Delphi application ? A "standard" one ?

Anyway, as you've probably made a lot of tests, modifications, etc... I suggest you to make a new "clean" conversion:

- copy your original Delphi project files in a new directory (only them),

- make a new conversion using this new directory (don't check the "Support Delphi" target option during the conversion),

- don't copy and/or modify the "internal" project files (especially the .res file), unless you're quite sure to do it on purposes,

- try to make your application run first without the Windows theme presentation (i.e without the windows manifest). Theoretically, it should work without it (it seems the conversion tool is not adding the windows manifest file by default, indeed),

- finally, add the "Use manifest file to enable themes (Windows only)" option to your project.
« Last Edit: December 23, 2014, 07:28:09 pm by ChrisF »

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Windows manifest setting
« Reply #5 on: December 23, 2014, 06:29:02 pm »
...
I have noticed however that there is a Link.res file. Can that be presenting any issues?

Probably because you've asked to "Run->Quick compile" your project during your tests; but it doesn't matter.

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Windows manifest setting
« Reply #6 on: December 23, 2014, 07:34:20 pm »
I have not used the Quick Compile. I will try rebuilding from the original Delphi file as you suggest.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Windows manifest setting
« Reply #7 on: December 23, 2014, 08:10:23 pm »
I have not used the Quick Compile. I will try rebuilding from the original Delphi file as you suggest.

Well, I don't remember it well, but it's probably also possible to have this file in case of an incomplete build step (i.e. if something goes wrong during the compilation/linking). Anyway, you can delete it if you wish.

It could also be interesting to know if you're getting some warning and/or error messages during the conversion, or just after during the first compilation: especially if you've answered 'Ignore ....' to it/them.


**Edit ** How does the converted form look like into the Lazarus IDE, after the conversion ? Does it seem OK to you, with all your controls and all their properties ?
« Last Edit: December 23, 2014, 09:50:34 pm by ChrisF »

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Windows manifest setting
« Reply #8 on: December 24, 2014, 02:11:40 pm »
I tried converting with an older copy of the project. The {$R *.res} was inserting and deleting as it should, but it did not change the hover paint or click-ability issues.

I had problems when I converted my other project, and I had to rebuild the interface from scratch. I think I will have to do that again.

I must say that I don't understand why a translation of buttons should be such a problem. I think that Lazarus is trying too hard. A simple "it's a button so make a button" approach seems more practical. At any rate, that is what I am going to do manually.

Thanks for the input. Have a happy holiday.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Windows manifest setting
« Reply #9 on: December 24, 2014, 02:49:52 pm »
Rebuilding the form(s) from scratch is really the last solution.

And you've not answered to my last question : can you see your converted form in the Lazarus IDE, with all your controls ?

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Windows manifest setting
« Reply #10 on: December 24, 2014, 04:07:46 pm »
Yes, I always saw the form. It just would not finish painting the buttons with manifest active.

By the process of rebuilding I found the problem. I had a Paint event. It was either interrupting or suppressing the the repaint for RES. All that it did was set the focus to a particular Tedit. I switched it to an OnShow event. Suddenly everything worked.

I have to apologize for complaining. The Lazarus teams have been flawless. I don't know why the OnPaint worked in Delphi, or if I had changed it sometime after Delphi, but it was the culprit.

Thanks again for your help.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

 

TinyPortal © 2005-2018