* * *

Author Topic: Message Windows Hints showing incorrect information  (Read 533 times)

josh

  • Sr. Member
  • ****
  • Posts: 327
Message Windows Hints showing incorrect information
« 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;

« Last Edit: March 01, 2017, 11:17:31 am by josh »
Lazarus 1.3
FPC 2.7.1
Windows 7/8 32/64, OSX, *nix

zeljko

  • Hero Member
  • *****
  • Posts: 900
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Message Windows Hints showing incorrect information
« Reply #1 on: March 01, 2017, 11:00:55 am »
And where is ok := UpdateControls;  in your example ?

josh

  • Sr. Member
  • ****
  • Posts: 327
Re: Message Windows Hints showing incorrect information
« Reply #2 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.
« Last Edit: March 01, 2017, 11:22:18 am by josh »
Lazarus 1.3
FPC 2.7.1
Windows 7/8 32/64, OSX, *nix

Bart

  • Hero Member
  • *****
  • Posts: 2654
    • Bart en Mariska's Webstek
Re: Message Windows Hints showing incorrect information
« Reply #3 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

josh

  • Sr. Member
  • ****
  • Posts: 327
Re: Message Windows Hints showing incorrect information
« Reply #4 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
Lazarus 1.3
FPC 2.7.1
Windows 7/8 32/64, OSX, *nix

 

Recent

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