* * *

Author Topic: Newbie Question - how to compile demo code from wiki?  (Read 1007 times)

oog

  • Newbie
  • Posts: 2
Newbie Question - how to compile demo code from wiki?
« on: January 03, 2018, 03:16:23 pm »
I have installed lazarus v1.8.0 on Windows 10, 64 Bit.
I successfully compiled the tutorial demo (Change Button Text "Click" to "Click again") so I think the compiler is working.
Now I want to proceed with the examples from the Wiki.
(3.4 Graphics -> Lazarus TCanvas -> Drawing a text limited on the width)

The examples do not compile.

Code: Pascal  [Select]
  1. // First calculate the text size then draw it
  2. TextBox := Rect(0, currentPos.Y, Width, High(Integer));
  3. DrawText(ACanvas.Handle, PChar(Text), Length(Text),
  4.   TextBox, DT_WORDBREAK or DT_INTERNAL or DT_CALCRECT);
  5.  
  6. DrawText(ACanvas.Handle, PChar(Text), Length(Text),
  7.   TextBox, DT_WORDBREAK or DT_INTERNAL);
  8.  


I get some error messages

Code: [Select]
Projekt kompilieren, Ziel: tutbmp01.exe: Exit code 1, Fehler: 13
tutbmp01u.pas(36,1) Error: Identifier not found "TextBox"
tutbmp01u.pas(36,20) Error: Identifier not found "currentPos"
tutbmp01u.pas(37,1) Error: Identifier not found "DrawText"
tutbmp01u.pas(37,10) Error: Identifier not found "ACanvas"
tutbmp01u.pas(38,3) Error: Identifier not found "TextBox"
tutbmp01u.pas(38,12) Error: Identifier not found "DT_WORDBREAK"
tutbmp01u.pas(38,28) Error: Identifier not found "DT_INTERNAL"
tutbmp01u.pas(38,43) Error: Identifier not found "DT_CALCRECT"
tutbmp01u.pas(40,1) Error: Identifier not found "DrawText"
tutbmp01u.pas(40,10) Error: Identifier not found "ACanvas"
tutbmp01u.pas(41,3) Error: Identifier not found "TextBox"
tutbmp01u.pas(41,12) Error: Identifier not found "DT_WORDBREAK"
tutbmp01u.pas(41,28) Error: Identifier not found "DT_INTERNAL"

What do I need to compile the examples?

Is there another tutorial that helps?

Blaazen

  • Hero Member
  • *****
  • Posts: 2571
  • POKE 54296,15
    • Eye-Candy Controls
Re: Newbie Question - how to compile demo code from wiki?
« Reply #1 on: January 03, 2018, 03:32:56 pm »
There is only a code snippet on the wiki, they probably assume some experience. You need to declare TextBox: TRect and add LCLType to uses and maybe more.
But there are examples that comes with Lazarus in directory lazarus/examples. Try them.
Lazarus 1.9.0 r58554 FPC 3.1.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.2
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.11

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

oog

  • Newbie
  • Posts: 2
Re: Newbie Question - how to compile demo code from wiki?
« Reply #2 on: January 03, 2018, 03:45:14 pm »
Thank you for your quick reply. Now I've found the examples. I will try them.

wp

  • Hero Member
  • *****
  • Posts: 4743
Re: Newbie Question - how to compile demo code from wiki?
« Reply #3 on: January 03, 2018, 03:46:26 pm »
Yes. I agree that many wiki articles are written very carelessly. To be able to fix it you should post the link to the article.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Kays

  • Full Member
  • ***
  • Posts: 112
  • Whasup!?
    • KaiBurghardt.de
Re: Newbie Question - how to compile demo code from wiki?
« Reply #4 on: January 08, 2018, 12:19:14 am »
[…] To be able to fix it you should post the link to the article.
Huh? Just copy and past some adequately long quote to the wiki's search, and you'd know it's the Developing with Graphics article before you can say Jack Robinson.
Yours Sincerely
Kai Burghardt

 

Recent

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