Recent

Author Topic: Where does one find what - missing documentation  (Read 5952 times)

Birger52

  • Sr. Member
  • ****
  • Posts: 309
Where does one find what - missing documentation
« on: January 25, 2020, 05:02:08 pm »
Missing documentation
Example
TMyControl = class(TPanel)
gives an error - TPanel is unknown.
So where do I look up which unit contains TPanel, so I can add it to the uses clause?
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Where does one find what - missing documentation
« Reply #1 on: January 25, 2020, 05:07:57 pm »
TPanel is in ExtCtrls unit.

Using Lazarus IDE, I add a TPanel component on the form then I ctrl+click the TPanel (text) on the source code editor. The ExtCtrl.pas will be opened automatically. That means it is in ExtCtrl unit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Where does one find what - missing documentation
« Reply #2 on: January 25, 2020, 05:16:10 pm »
If I press "F1" on  "TPanel" anywhere in the editor I get the help screen for it
see screenshot.

Installing the help is fairly simple,

  • download the chms and put them in lazarus\chm
  • install the chmhelp package if needed in the "packages" menu

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9868
  • Debugger - SynEdit - and more
    • wiki
Re: Where does one find what - missing documentation
« Reply #3 on: January 25, 2020, 05:16:17 pm »
It is on the online docs https://lazarus-ccr.sourceforge.io/docs/lcl/extctrls/tpanel.html

Should be in the offline docs too, but F1 may only recognize it, once you added the unit to the uses clause. After all there could be other TPanel in other units, so without the "uses" it can not be known for what TPanel you want help.

Install the package "Cody" (Menu packages > Install packages)

Then use the "Identifier Dictionary" from the menu Source > Show Unit/Identifier Dictionary

It will show you all possible TPanel, and even lets you "use" one of them, which will automatically add the required unit to the uses (and even include the required package if needed).

If you assign it to a key, and open it while the cursor is at the identifier you need, it will search for it right away.

devEric69

  • Hero Member
  • *****
  • Posts: 648
Re: Where does one find what - missing documentation
« Reply #4 on: January 25, 2020, 05:18:39 pm »
The LCL index can be found at https://lazarus-ccr.sourceforge.io/docs/lcl/index-8.html.
The indexes of FCL and FCL classes are there https://www.freepascal.org/docsearch/docsearch.var.
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Where does one find what - missing documentation
« Reply #5 on: January 25, 2020, 05:32:42 pm »
Already answered, but just in case ...

For most controls/classes you can just open the standard documentation (in this case lcl.chm) and search for the control/class you want, as can be seen in the attached image.

HTH
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Where does one find what - missing documentation
« Reply #6 on: January 25, 2020, 05:39:43 pm »
And in windows you can just open the CHM and use the built in windows CHM index and full text search.

Note that it might be needed to "unblock" them first. Simply go to Windows Explorer, right click on the chm, choose "properties" and then "unblock"

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Where does one find what - missing documentation
« Reply #7 on: January 25, 2020, 05:41:09 pm »
There's more than one way to bake a cake.

Not many (Lazarus) beginners know about the ctrl+click trick. I think it should be 'promoted'. It is very useful because we can see the source code, see the available methods and properties and learn how the professionals write codes. Without open a browser and type the text. It just works out of the box. We can ctrl click any related identifier (on the screen) to finds out more.
« Last Edit: January 25, 2020, 05:45:31 pm by Handoko »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Where does one find what - missing documentation
« Reply #8 on: January 25, 2020, 05:44:14 pm »
Should be in the offline docs too, but F1 may only recognize it, once you added the unit to the uses clause. After all there could be other TPanel in other units, so without the "uses" it can not be known for what TPanel you want help.

Install the package "Cody" (Menu packages > Install packages)

Then use the "Identifier Dictionary" from the menu Source > Show Unit/Identifier Dictionary

Not necessary with offline help installed.  Just go to "Help" -> "Help" and then select the search tab and type "tpanel" as keyword. As in attached screenshot.

This should search the whole of the help, FPC and LCL.
« Last Edit: January 25, 2020, 07:29:48 pm by marcov »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Where does one find what - missing documentation
« Reply #9 on: January 25, 2020, 05:45:21 pm »
There's more than one way to bake a cake.

Not many (Lazarus) beginners know about the ctrl+click trick. I think it should be 'promoted'. It is very useful because we can see the source code, see the available methods and properties and learn how the professionals write codes. Without open a browser and type the text. It just works out of the box. We can ctrl click any related identifier to finds out more.

(won't professionals use alt-arrow up and never take the hands of the keyboard?)  :D

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Where does one find what - missing documentation
« Reply #10 on: January 25, 2020, 05:48:04 pm »
 :'( I am not a professional.

Thanks for the new trick.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9868
  • Debugger - SynEdit - and more
    • wiki
Re: Where does one find what - missing documentation
« Reply #11 on: January 25, 2020, 05:54:46 pm »
Afaik ctrl-click (or alt-up) only works, if the "uses" clause is correct. Otherwise TPanel is an unknown identifier.

The OP, was trying to find the unit he needs to put into uses.



As for some more "neat tricks": https://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools
Also https://wiki.lazarus.freepascal.org/New_IDE_features_since
« Last Edit: January 25, 2020, 05:57:16 pm by Martin_fr »

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Where does one find what - missing documentation
« Reply #12 on: January 25, 2020, 06:02:33 pm »
Oh, I didn't see the OP post was about Free Pascal. I saw TPanel and I thought Lazarus.

In Lazarus, even the uses clause isn't 'correct' as long as the component is available in the component tab, dropping one to the form will automatically add the related unit in the uses clause. ... Well, sometimes (but rarely) ... the dbf component always forgets to add db and db_fields in the uses clause.
« Last Edit: January 25, 2020, 06:04:42 pm by Handoko »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Where does one find what - missing documentation
« Reply #13 on: January 25, 2020, 06:15:33 pm »
Afaik ctrl-click (or alt-up) only works, if the "uses" clause is correct. Otherwise TPanel is an unknown identifier.

The OP, was trying to find the unit he needs to put into uses.

Yeah, I know. See the 2nd post from me with screenshot. That uses the onlne help search which is powered by chmcmd/fpdoc index, and lhelp that searches it.

Note that the alt-arrow up is a standard Delphi kbd combo.  Some other IDEs use ctrl-b (or F12.

Birger52

  • Sr. Member
  • ****
  • Posts: 309
Re: Where does one find what - missing documentation
« Reply #14 on: January 25, 2020, 06:27:54 pm »
Thank you all for all the responses.

It was not TPanel as such - more a way to find what unit should be added to uses.

Ctrl+click or [F1], doesn't function, if uses does not list the unit.
It is useful that ctrl+click it opens the defining source (I didn't know this "trick") - but it is no use, to locating a unit.

Manually going to help, never occurred to me....  :o (Probably should spend some time there)
But found it, once I figured how to look in the lcl.hcm - it's not default, and not obvious that there are several helpfiles.

Saved the link https://lazarus-ccr.sourceforge.io/docs/lcl/index-8.html.
with FF search, it is fairly simple to find what one is looking for.

And placing components manually, of course also places the required unit in uses.
But I have the problem when creating my own controls, or programmatically adding components.
And that sometimes requires, manually looking up where things are defined...
And now I have the tools to do that, rather than using "trial and error" method.

Thank you!
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

 

TinyPortal © 2005-2018