Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
How i insert text in a TShape?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
OpenDocument('Filename') ...
by
J-G
[
Today
at 10:40:41 am]
Freepascal
by
LeP
[
Today
at 09:40:33 am]
TTL Record Count, i.e. a ...
by
Zvoni
[
Today
at 09:10:08 am]
weird error message
by
Thaddy
[
Today
at 07:53:17 am]
Printing on HP Smart Tank
by
Thaddy
[
Today
at 07:10:37 am]
P.I.S.S. a PlugIn-framewo...
by
cdbc
[
Today
at 06:38:27 am]
MVP made easier.
by
cdbc
[
Today
at 06:18:24 am]
I have made some progress...
by
onionmixer
[
Today
at 02:57:55 am]
WASM import error
by
Fibonacci
[July 12, 2026, 09:30:47 pm]
Lazarus 4.6 may erase you...
by
Martin_fr
[July 12, 2026, 06:35:29 pm]
Best name for procedure
by
LemonParty
[July 12, 2026, 05:23:02 pm]
Fixed an RV32ec compiler ...
by
MattBradford
[July 12, 2026, 05:11:16 pm]
Many recent books on Laza...
by
Tomu
[July 12, 2026, 05:02:44 pm]
Lazarus Bugfix Release 4....
by
geraldholdsworth
[July 12, 2026, 04:35:14 pm]
International Pascal Cong...
by
zeljko
[July 12, 2026, 04:08:53 pm]
equivalent to C/C++ "offs...
by
jamie
[July 12, 2026, 02:43:16 pm]
val return code
by
ALLIGATOR
[July 12, 2026, 01:40:21 pm]
Help needed on how to do ...
by
cdbc
[July 12, 2026, 12:15:15 pm]
PascalRAL the fastest, mo...
by
Mobius1
[July 12, 2026, 11:24:00 am]
TDateTimePicker - Make th...
by
AlexanderT
[July 12, 2026, 09:57:05 am]
TCollection wiki entry
by
Thaddy
[July 12, 2026, 05:44:53 am]
UI app to work with SQLit...
by
LeP
[July 12, 2026, 12:50:04 am]
Elite Arcade
by
Guva
[July 11, 2026, 11:25:29 pm]
Why is my program freezin...
by
paweld
[July 11, 2026, 07:19:46 pm]
is there PDS reader/expor...
by
jamie
[July 11, 2026, 07:01:12 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How i insert text in a TShape? (Read 7608 times)
celso.lom
Newbie
Posts: 5
How i insert text in a TShape?
«
on:
February 02, 2012, 05:14:01 pm »
I created a TShape in runtime and i need to insert text in. How i do this?
Logged
felipemdc
Administrator
Hero Member
Posts: 3538
Re: How i insert text in a TShape?
«
Reply #1 on:
February 02, 2012, 05:32:37 pm »
Create a TCustomControl descendent and in its Paint method you can draw your shape using TCanvas routines and also draw the text:
http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Create_a_custom_control_which_draws_itself
See also:
http://lazarus-ccr.sourceforge.net/docs/lcl/graphics/tcanvas.html
Logged
typo
Hero Member
Posts: 3051
Re: How i insert text in a TShape?
«
Reply #2 on:
February 02, 2012, 05:42:23 pm »
Code:
[Select]
YourShape.Canvas.TextOut(0,0,'abc');
Logged
LazarusBrasil.Org
felipemdc
Administrator
Hero Member
Posts: 3538
Re: How i insert text in a TShape?
«
Reply #3 on:
February 02, 2012, 06:35:40 pm »
Quote from: typo on February 02, 2012, 05:42:23 pm
Code:
[Select]
YourShape.Canvas.TextOut(0,0,'abc');
Indeed that might work, but should only be used inside the OnPaint event of the shape.
Logged
celso.lom
Newbie
Posts: 5
Re: How i insert text in a TShape?
«
Reply #4 on:
February 02, 2012, 06:36:38 pm »
I tested the "TShape.Canvas.TextOut." By moving the TShape the text disappears. I create the TShape at runtime, and I would definitely put the text inside. Is there another way?
Translated from portuguese on Google Translator.
Logged
typo
Hero Member
Posts: 3051
Re: How i insert text in a TShape?
«
Reply #5 on:
February 02, 2012, 06:52:33 pm »
Test what Felipe said.
Logged
LazarusBrasil.Org
celso.lom
Newbie
Posts: 5
Re: How i insert text in a TShape?
«
Reply #6 on:
February 02, 2012, 07:08:00 pm »
I tested what Felipe said and it worked. As I am creating buttons dynamically, the procedures have to be dynamic. Added value to TShape.Caption and recovered within the procedure. Thanks!
Translated from portuguese on Google Translator.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
How i insert text in a TShape?
TinyPortal
© 2005-2018