Recent

Author Topic: Where Defined Canvas Constants?  (Read 1217 times)

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Where Defined Canvas Constants?
« on: August 04, 2020, 01:22:43 pm »
Found Colors doc page.  But where is Brush Styles and Pen Styles constants documented?
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

TRon

  • Hero Member
  • *****
  • Posts: 2401
Re: Where Defined Canvas Constants?
« Reply #1 on: August 04, 2020, 01:31:30 pm »
You can find a list here https://lazarus-ccr.sourceforge.io/docs/lcl/graphics/index-2.html

The actual documentation is located in/throug fpcanvas but unfortunately I seem unable to locate the correct links.

All links I tried failed, which make me believe that particular part of the documentation is down at the moment.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Where Defined Canvas Constants?
« Reply #2 on: August 04, 2020, 01:42:49 pm »
There is no file for fpcanvas in docs/xml which means documentation for it hasn't started yet.

TRon

  • Hero Member
  • *****
  • Posts: 2401
Re: Where Defined Canvas Constants?
« Reply #3 on: August 04, 2020, 01:44:59 pm »
Then it must have been removed (?) as there where links in the past for fpcanvas that originated from Lazarus ccr.

edit: I had some of them listed in my bookmarks. Just checked and indeed duck duck still has some in its cache it seems, google seems to have cleared them.
« Last Edit: August 04, 2020, 01:55:43 pm by TRon »

jamie

  • Hero Member
  • *****
  • Posts: 6077
Re: Where Defined Canvas Constants?
« Reply #4 on: August 04, 2020, 02:05:17 pm »
Found Colors doc page.  But where is Brush Styles and Pen Styles constants documented?
I reported that way back they are not documented in the help files
Things like the rop2 modes etc.
The only true wisdom is knowing you know nothing

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Where Defined Canvas Constants?
« Reply #5 on: August 04, 2020, 02:07:11 pm »
It might be a problem of the SF importing procedure, not reflecting the state of the docs. Or maybe there was an empty stub that was removed.

But I first checked the chm (where fpcanvas is not clickable -> no docs), and to verify I checked the document sources.

Next week is holiday, then I'll prepare a doc snapshot.

wp

  • Hero Member
  • *****
  • Posts: 11833
Re: Where Defined Canvas Constants?
« Reply #6 on: August 04, 2020, 02:12:29 pm »
Found Colors doc page.  But where is Brush Styles and Pen Styles constants documented?

You should learn how to navigate the source code - this is the best and most up-to-date documentation for such simple questions. Suppose you somewhere have a Canvas.Brush.Style := bsSolid; in your code. Hold the CTRL key down and click on word bsSolid -- then the IDE opens the unit in which bsSolid is declared, in the case unit Graphics:

Code: Pascal  [Select][+][-]
  1.   bsSolid = FPCanvas.bsSolid;
  2.   bsClear = FPCanvas.bsClear;
  3.   bsHorizontal = FPCanvas.bsHorizontal;
  4.   bsVertical = FPCanvas.bsVertical;
  5.   bsFDiagonal = FPCanvas.bsFDiagonal;
  6.   bsBDiagonal = FPCanvas.bsBDiagonal;
  7.   bsCross = FPCanvas.bsCross;
  8.   bsDiagCross = FPCanvas.bsDiagCross;  
  9.  

Now you see all the other declarations, their name is self-explanatory.

Or you could CTRL-click on Style  (of Canvas.Brush.Style) -- the IDE will lead you to unit FPCanvas, line property Style : TFPBrushStyle read FStyle write SetStyle. CTRL-Click on TFPBrushStyle, and the cursor will jump a few line higher to
Code: Pascal  [Select][+][-]
  1.   TFPBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal,
  2.                    bsBDiagonal, bsCross, bsDiagCross, bsImage, bsPattern);  

Repeat this exercise with Canvas.Pen...

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: Where Defined Canvas Constants?
« Reply #7 on: August 04, 2020, 02:33:23 pm »
I usually try ctrl + click feature first. It will bring you to some very useful information about the identifier.

Move the mouse pointer to the identifier and press ctrl, you will see the identifier is becomes underlined and the color changes to blue. See the image below. Click on it will bring you to the declaration of the identifier.

(If it is a procedure or function, and you want to learn more what the code does. Hold down shift and ctrl, then press down arrow.)

If the ctrl + click bring you to a constant. Usually ctrl clicking again will bring you to the list of related constants. For example ctrl clicking on Brush.Style will bring to bsSolid. Ctrl clicking again but on bsSolid, you will get a list of related constants (bsSolid ... bsDiagCross).

Lazarus has many useful tricks. You can learn more here:
https://wiki.freepascal.org/New_IDE_features_since

Note
I'm late, wp already posted the trick.
« Last Edit: August 04, 2020, 02:52:03 pm by Handoko »

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: Where Defined Canvas Constants?
« Reply #8 on: August 04, 2020, 03:23:59 pm »
Thanks for Control Click tip.  That works for me. 
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

 

TinyPortal © 2005-2018