Recent

Author Topic: How can I debug the LCL? TPopUpMenu not working well  (Read 1119 times)

linuxfan

  • Jr. Member
  • **
  • Posts: 57
How can I debug the LCL? TPopUpMenu not working well
« on: August 21, 2019, 08:43:08 am »
Hi,

I have an application that shows some problem with Popup menus. If a menu opens, clicking outside the opened menu of course closes it. But then... the next click, anywhere in the form, is ignored.

I tried to do the same with the main menu, and the problem does not arise.

To investigate the problem, I tried to inspect ActivePopupMenu variable declared in Menus.pas of the LCL, but the debugger does not see it. Then I recompiled the file, recompiled the LCL, but still I can trace/debug anything. Should I rebuild Lazarus? If my program "uses" menus, and I edit menus, then recompile my program, do the compiler options applied to my program, also apply to the modified Menus.pas? it seems not...

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
Re: How can I debug the LCL? TPopUpMenu not working well
« Reply #1 on: August 21, 2019, 08:49:39 am »
Hi,

which OS / Version of OS / bitness and which Lazarus/FPC version do you use?

Can you make an simple example, that shows the problem?
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

linuxfan

  • Jr. Member
  • **
  • Posts: 57
Re: How can I debug the LCL? TPopUpMenu not working well
« Reply #2 on: August 21, 2019, 09:03:00 am »
Thank you for the interest.

I've been vague (also because I simply asked how to debug LCL...). I suspect that the problem is difficult to reproduce, and it is a long story.

Anyway, my system is Debian Stretch 64 bits, with Lazarus 2.0.2, fpc 3.0.4, LCL 2.0.2.

I did not check yet if other programs show the same behavior, that could also help, but just now I am concentrated on this program which is quite complicated.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: How can I debug the LCL? TPopUpMenu not working well
« Reply #3 on: August 21, 2019, 10:53:00 am »
If you need to debug the LCL quite often it is probably best to recompile the IDE with debug information: Go to "Tools" > "Configure 'Build Lazarus'...". Select "IDE with debug information" from the "Profile to build" combobox. Then click "Build". When the IDE restarts after a while you are ready to go.

Having the LCL debug information available all the time is sometimes irritating because whenever you select "Step into" in the debugger there is a chance that you may enter code that you did not write and get lost. For occasional debugging of the LCL it is better to use a custom option under "Additions and overrides" which you find in the "Project options": Select this page in the "Project options", click "Stored in session of project" (or "Stored in project" - whatever you prefer), then "Add" > "Custom option". In the newly created "Targets" line type (without quotes) "-gw2" - this activates Dwarf2 debug information throughout the project and all required libraries. (You can also assign this setting to a special build mode). When you now compile your project all required packages are compiled with Dwarf2 information, so that you easily can "Step into" any code not written by yourself. Disadvantage is that the first compilation of the project takes longer as usual.

 

TinyPortal © 2005-2018