Recent

Author Topic: F1 Help - locating a routine's unit  (Read 2720 times)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1014
  • Former Delphi 1-7, 10.2 User
F1 Help - locating a routine's unit
« on: August 16, 2020, 04:41:31 am »
From "Learn to program using Lazarus" (p40) -- an excellent book well hidden at https://www.blaisepascalmagazine.eu/product/learn-program-using-lazarus-electronic-pdf/ and not listed in the Books menu:

Quote
If you have an idea of the routine's name (but can't remember which unit contains its declaration) one way to discover this information is to type the name of the routine in the Lazarus Editor, and then with the cursor located somewhere in the word press the [F1] key.

Would be great if it was true... at least on macOS the routine cannot be found in the help unless the unit name already appears in the Uses clause.

Given the book was published at the end of 2012, is this a regression in the IDE?
o Lazarus v2.1.0 r63871, FPC v3.3.1 r47164, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (Parallels VM)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6676
  • Debugger - SynEdit - and more
    • wiki
Re: F1 Help - locating a routine's unit
« Reply #1 on: August 16, 2020, 05:11:48 am »
Would be great if it was true... at least on macOS the routine cannot be found in the help unless the unit name already appears in the Uses clause.

Given the book was published at the end of 2012, is this a regression in the IDE?

No idea if it used to work...

But for finding the unit => install package cody.

Cody adds "Menu: Source > Show Unit/Identifier Dictionary".
As you work with codetools, this dictionary will be created, so if it is empty, just continue using the IDE.

Then you can use it to find any identifier. And it will add the unit to the uses when you select it.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1014
  • Former Delphi 1-7, 10.2 User
Re: F1 Help - locating a routine's unit
« Reply #2 on: August 16, 2020, 05:21:16 am »
Thanks, I'll give the cody package a go.

[Update: Perfect!]
« Last Edit: August 16, 2020, 05:49:15 am by trev »
o Lazarus v2.1.0 r63871, FPC v3.3.1 r47164, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (Parallels VM)

Birger52

  • Sr. Member
  • ****
  • Posts: 274
Re: F1 Help - locating a routine's unit
« Reply #3 on: August 16, 2020, 12:04:29 pm »
Someone in here taught me this:
Hold [ctrl] an place mouse over the procedure/function/variable/property - it will be underlined.
Leftclik and declaration will be shown.
Shoul dbe possible from there to determine unit ;)

Also [Ctrl]+[Shift] while leftclicking declaration will take you to implementation (and vice-versa).
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6676
  • Debugger - SynEdit - and more
    • wiki
Re: F1 Help - locating a routine's unit
« Reply #4 on: August 16, 2020, 12:14:54 pm »
Someone in here taught me this:
Hold [ctrl] an place mouse over the procedure/function/variable/property - it will be underlined.
Leftclik and declaration will be shown.
Shoul dbe possible from there to determine unit ;)

Also [Ctrl]+[Shift] while leftclicking declaration will take you to implementation (and vice-versa).
That only works, if the unit is already in the use.

Do a new empty project, and type "var se:TSynEdit". But do not add the unit "SynEdit" to any uses clause. (Do not even add the package to your project).

Ctrl-Click will not know where to go. (Because who knows there could be many packages/units that could declare a class by that name.)

Birger52

  • Sr. Member
  • ****
  • Posts: 274
Re: F1 Help - locating a routine's unit
« Reply #5 on: August 16, 2020, 01:40:51 pm »
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

 

TinyPortal © 2005-2018