Recent

Author Topic: has no component named Tag  (Read 21734 times)

lgrfbs

  • Jr. Member
  • **
  • Posts: 68
    • My CV page (On Swedish only)
has no component named Tag
« on: February 08, 2017, 12:55:40 pm »
- Eng -
In Delphi you can use .tag on all the components to put a numerical value, when I try the same thing in Lazarus, I get the error:< Error: Type TLABEL component has no named Tag. >Have a feeling that I have asked this before, but I did not back to the answer and it has at least been some time since.
Hope i posted in the correct forum.


- Swe -
I Delphi kan man använda .tag på alla komponenterna för att stoppa undan ett numrerisktvärde, när jag provar samma sak i Lazarus så får jag felet:
<Error: Type TLABEL has no component named Tag.>

Har en känsla av att jag har frågat detta förr, men jag hittade inte tillbaka till det svaret och det har ju i alla fall gått en tid sedan dess.
OS : Win 10 64bit Home * Win 7 64bit Professional
Lazarus 1.8.4 r57972 FPC 3.0.4 i386-win32-win32/win64
Delphi 7.0 (Build 4.453)

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: has no component named Tag
« Reply #1 on: February 08, 2017, 01:03:46 pm »
I've just tested on my Lazarus 1.6.2 FPC 3.0.0. TLabel.tag works here on my Linux PC.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   Label1.Tag := 1;
  4. end;

Can you provide your code?
« Last Edit: February 08, 2017, 01:07:28 pm by Handoko »

lgrfbs

  • Jr. Member
  • **
  • Posts: 68
    • My CV page (On Swedish only)
Re: has no component named Tag
« Reply #2 on: February 08, 2017, 01:27:24 pm »
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Button1: TButton;
  16.     Label1: TLabel;
  17.     procedure Button1Click(Sender: TObject);
  18.   private
  19.     { private declarations }
  20.   public
  21.     { public declarations }
  22.   end;
  23.  
  24. var
  25.   Form1: TForm1;
  26.  
  27. implementation
  28.  
  29. {$R *.lfm}
  30.  
  31. { TForm1 }
  32.  
  33. procedure TForm1.Button1Click(Sender: TObject);
  34. begin
  35.   Form1.Label1.Tag:=Form1.Label1.Tag+1;
  36.   Form1.Label1.Caption:=IntToStr(Form1.Label1.Tag)
  37. end;
  38.  
  39. end.
  40.  
  41.  
* Add "Form1.Label1.Tag" to Watch List.
* Then I set a brak on line 36
And now I get "<Error: Type TLABEL has no component named TAG.>" in the Watch List as a Value insteed of 2,3,4,5,6 and so on.

Windows 7 and lazarus 1.6
OS : Win 10 64bit Home * Win 7 64bit Professional
Lazarus 1.8.4 r57972 FPC 3.0.4 i386-win32-win32/win64
Delphi 7.0 (Build 4.453)

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: has no component named Tag
« Reply #3 on: February 08, 2017, 01:30:37 pm »
In Delphi you can use .tag on all the components

That is VB syntax. That doesn't work in Delphi either. (And it implies "with.. ")

If I run your code I see no problem. There may be a debugger issue, though, depending on platform and GDB version.
« Last Edit: February 08, 2017, 01:40:29 pm by Thaddy »
Specialize a type, not a var.

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: has no component named Tag
« Reply #4 on: February 08, 2017, 01:37:03 pm »
I don't fully understand you problem. But it works on my computer.

balazsszekely

  • Guest
Re: has no component named Tag
« Reply #5 on: February 08, 2017, 01:40:18 pm »
@lgrfbs
That is a limitation of the debugger(or perhaps it's not configured correctly). In fact the label tag was increased by one.
Quote
@Thaddy
That is VB syntax. That doesn't work in Delphi either. (And it implies "with.. ")
Yes it does. You should go into grumpy mode, induced by your own comment :D

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: has no component named Tag
« Reply #6 on: February 08, 2017, 01:41:53 pm »
< >:D> Yes the code works in Delphi but with do .tag doesn't.< >:D> with do tag does.
Specialize a type, not a var.

lgrfbs

  • Jr. Member
  • **
  • Posts: 68
    • My CV page (On Swedish only)
Re: has no component named Tag
« Reply #7 on: February 08, 2017, 02:07:59 pm »
Okay, I see that it works nicely with you.Hmmmmmmm, then it is just for me to update to the latest Lazarus installation.Thanks for all the help.
OS : Win 10 64bit Home * Win 7 64bit Professional
Lazarus 1.8.4 r57972 FPC 3.0.4 i386-win32-win32/win64
Delphi 7.0 (Build 4.453)

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: has no component named Tag
« Reply #8 on: February 08, 2017, 02:33:32 pm »
I'm using UbuntuMate. Perhaps you can consider to use Linux.  :D

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: has no component named Tag
« Reply #9 on: February 08, 2017, 03:40:39 pm »
Okay, I see that it works nicely with you.Hmmmmmmm, then it is just for me to update to the latest Lazarus installation.Thanks for all the help.
If I understand your signature correctly you are using Laz 1.2.6? I still have a Laz 1.2 installed for some backward compatibility tests, and already there TLabel has a property Tag, and I am almost sure that it has been there all the time. So, from this point of view, the Lazarus version is not your problem. Are you sure that Lazarus is installed correctly? Maybe installing the current version 1.6.2 is faster than fixing a faulty old installation...

lgrfbs

  • Jr. Member
  • **
  • Posts: 68
    • My CV page (On Swedish only)
Re: has no component named Tag
« Reply #10 on: February 08, 2017, 04:01:39 pm »
Yepp, I have Lazarus 1.2.6 and 1.6 installed on this Windows 7 box and I have always had this error on both installs (different folders). The thing is I are in the middle of a project I started for 4 years ago in 1.2.6 and hope to get to the end of the project.
OS : Win 10 64bit Home * Win 7 64bit Professional
Lazarus 1.8.4 r57972 FPC 3.0.4 i386-win32-win32/win64
Delphi 7.0 (Build 4.453)

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: has no component named Tag
« Reply #11 on: February 08, 2017, 04:38:07 pm »
If I understand your signature correctly you are using Laz 1.2.6? I still have a Laz 1.2 installed for some backward compatibility tests, and already there TLabel has a property Tag, and I am almost sure that it has been there all the time.

I believe Tag (and Name) have been declared as published TComponent properties from the time of the first Delphi 1 VCL.

lgrfbs

  • Jr. Member
  • **
  • Posts: 68
    • My CV page (On Swedish only)
Re: has no component named Tag
« Reply #12 on: February 08, 2017, 05:11:13 pm »
I think you howardpc have right there. I know it has worked ever since Delphi 3 to Delphi 7. But why it is not working in my Lasaruz.
Could it be that Lazarus does not quite work as a Delphi at this point? (or my install of Lazarus)
OS : Win 10 64bit Home * Win 7 64bit Professional
Lazarus 1.8.4 r57972 FPC 3.0.4 i386-win32-win32/win64
Delphi 7.0 (Build 4.453)

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: has no component named Tag
« Reply #13 on: February 08, 2017, 10:29:14 pm »
Lazarus uses GDB (http://www.gnu.org/software/gdb/) as its debugger back end.

The GDB shipped with FPC 2.6.4 probably can't show values from class properties or doesn't have support for it.

Oh, I see you have Lazaraus 1.6 too. The GDB doesn't have support for showing values from complex class properties like a property getters...
« Last Edit: February 08, 2017, 10:37:05 pm by Cyrax »

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: has no component named Tag
« Reply #14 on: February 08, 2017, 10:43:19 pm »
GDB on Windows in combination with Lazarus is very very very, and I mean very bad.

I also always have trouble with Ctrl+F7 to see the value of a property. Even hovering over a property when debugging doesn't work. Hovering over the object itself does work but gives you the complete object-source (which is too much sometimes).

No, GDB is really poor on Windows
(or this is a implementation/connection of Lazarus with GDB on Windows that doesn't work).

 

TinyPortal © 2005-2018