* * *

Author Topic: Evaluation of an object property - How can I do that?  (Read 503 times)

micheus

  • Jr. Member
  • **
  • Posts: 62
Evaluation of an object property - How can I do that?
« on: August 21, 2017, 04:32:55 pm »
I'm trying do debug my code, but I'm not able to evaluate some items.
I can evaluate local variables without any problem, but if I try to evaluate an object property like PageIndex of the TNotebook object that is what I see in Whatch List window:

Notebook1.PageIndex -> <Error: Type TNOTEBOOK has no component named PAGEINDEX.>

A hint that shows a property doesn't exists also is shown all the time I try to inspect one: https://s25.postimg.org/by5iyxmsf/debug-lazarus.png

Is there any special settings I should to do in Debug session of the project?
Do I need to use the Tools->Configure "Build Lazarus" and set it to Debug IDE?

I found an old post from 2008 in which the answer I read Lazarus cannot watch properly these variables, but I don't believe that is still valid. I'm sure I'm missing something.

Thanks in advanced
Micheus

taazz

  • Hero Member
  • *****
  • Posts: 4492
Re: Evaluation of an object property - How can I do that?
« Reply #1 on: August 21, 2017, 06:06:48 pm »
nothing has changed in that front on lazarus. It still can not show the values of properties. I think it is a GDB limitation but I have no experience with debugger implementation so grain of salt and all that.. The good news is that you can validate private fields with out problems for example in the case of tnotebook try evaluating
Code: Pascal  [Select]
  1. Notebook1.FPageIndex
As a side note, be careful using the TNotebook control it is badly written and will create a number of sigsegv if not handled with care. I would suggest that you write your own notebook or if there is enough interest I'll post the code of mine somewhere.I forgot that it is already public, sorry. https://github.com/taazz/Turbobird/blob/master/trunk/Controls/uevsnotebook.pas.
« Last Edit: August 21, 2017, 06:16:02 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

micheus

  • Jr. Member
  • **
  • Posts: 62
Re: Evaluation of an object property - How can I do that?
« Reply #2 on: August 21, 2017, 06:25:59 pm »
nothing has changed in that front on lazarus. It still can not show the values of properties.
That is a really bad news. It's like we still coding in some of the ancient languages when we had to fill the code with a lot of io:format to display variable contents.  %)

Quote
The good news is that you can validate private fields with out problems for example in the case of tnotebook try evaluating
Code: Pascal  [Select]
  1. Notebook1.FPageIndex
.
Yeah, that is working, but it's only a small solution for me.

I tried this before with a dataset property and it didn't work. In that image you see I'm using the PageIndex to activate a dataset. So, before I tried to evaluate DMAssistidos.DstConjuge.FActive, but that is what I get Type TIBDATASET has no component named FACTIVE..
Hard to debug a database application this way.

Quote
As a side note, be careful using the TNotebook control it is badly written and will create a number of sigsegv if not handled with care.
Thanks for the advise.
I think I should not have any problem with it. I've just showing and hiding the tabs with the form content for every of the ten options I have in a treeview.
This is an eleven years old code that I just converted from Delphi 7 code to Lazarus and I would like to rewrite it just the minimum as I need.

Thanks for answer me
Micheus

taazz

  • Hero Member
  • *****
  • Posts: 4492
Re: Evaluation of an object property - How can I do that?
« Reply #3 on: August 21, 2017, 06:42:50 pm »
I tried this before with a dataset property and it didn't work. In that image you see I'm using the PageIndex to activate a dataset. So, before I tried to evaluate DMAssistidos.DstConjuge.FActive, but that is what I get Type TIBDATASET has no component named FACTIVE..
Hard to debug a database application this way.
code from the Tdatasetcontrol
Code: Pascal  [Select]
  1. function TDataset.GetActive : boolean;
  2. begin
  3.   result := (FState <> dsInactive) and (FState <> dsOpening);
  4. end;
  5.  
You need to follow the code to find out what to evaluate but I get your point it should be implemented, I think that they are writing a debugger for that reason (fpdebugger) but I have no idea what is its current state. good luck.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

micheus

  • Jr. Member
  • **
  • Posts: 62
Re: Evaluation of an object property - How can I do that?
« Reply #4 on: August 21, 2017, 06:53:02 pm »
code from the Tdatasetcontrol
Code: Pascal  [Select]
  1. function TDataset.GetActive : boolean;
  2. begin
  3.   result := (FState <> dsInactive) and (FState <> dsOpening);
  4. end;
You need to follow the code to find out what to evaluate but I get your point it should be implemented, I think that they are writing a debugger for that reason (fpdebugger) but I have no idea what is its current state.
Yeah, "FState" - that worked. Thanks for the tip.

Quote
good luck.
I few like I need that.  :D

Thanks

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus