Lazarus

Using the Lazarus IDE => Editor => Topic started by: Josh on March 01, 2017, 10:42:42 am

Title: Message Windows Hints showing incorrect information
Post by: Josh on March 01, 2017, 10:42:42 am
Just downloaded latest SVN 54316, and just noticed some odd messages in appearing in message window.

It is reporting various variables are defined but not used in various functions and procedures; even thought they are being defined and used.

Example

In a function I have defined ok:boolean;

then within  $ifdef

ie
{$ifdef darwin}
ok:=UpdateMacControls(-1);
{$else}
ok:=UpdateControls(-1);
{$endif}

In IDE the 'enabled text' is for the ok:=UpdateControls in the else clause;

Title: Re: Message Windows Hints showing incorrect information
Post by: zeljko on March 01, 2017, 11:00:55 am
And where is ok := UpdateControls;  in your example ?
Title: Re: Message Windows Hints showing incorrect information
Post by: Josh on March 01, 2017, 11:15:53 am
Code: [Select]

Procedure xxxxxxx;
var ok:boolean=falase;

begin
  .....

  ......
  {$ifdef darwin}                     // Note this is not nested anywhere or within any other begin end block
  ok:=UpdateMacControls(-1);
  {$else}
  ok:=UpdateControls(-1);
  {$endif}
End;


I also noticed a warning
Symbol "RT_RCDATA" is deprecated: "Use Windows.RT_RCDATA instead".

As I cant use windows unit on mac; do I now need to add in ifdef around all rt_rcdata one for darwin one for windows etc.
Title: Re: Message Windows Hints showing incorrect information
Post by: Bart on March 01, 2017, 06:09:26 pm
You seem to assigne a value to OK and the immediately exit the function, so the assigned value is never used (I guess that is what the message is telling you).

Bart
Title: Re: Message Windows Hints showing incorrect information
Post by: Josh on March 01, 2017, 08:52:18 pm
Hi

My error, I should have added some more of the code

Later on
in procedure I Have
Code: [Select]
If Not Ok then
Begin
  // Show message in Message Bar; regarding No Control found matching Control Information;
  // Application can Still continue; probably data file error; so report message only
  My_Message_Bar(My_Message,ClWhite,CLRed,1500); // display message WHite Font, Red Background, for 1.5 seconds);
End;

I should have put more of the proc code in; but it has so many of own functions etc; tthat do not relate to the error or the ok variable
TinyPortal © 2005-2018