Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
Title/footer click tool
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
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Parameter passing odditie...
by
ASerge
[
Today
at 09:42:03 pm]
fkInternalCalc
by
zraja
[
Today
at 09:31:07 pm]
A fairly simple sound sol...
by
KodeZwerg
[
Today
at 09:23:37 pm]
Demo Scene Picture sinwav...
by
Gigatron
[
Today
at 09:00:25 pm]
add new targets to make
by
marcov
[
Today
at 08:38:42 pm]
how to tweek fpmake to co...
by
marcov
[
Today
at 08:29:16 pm]
Quirky windows
by
ASerge
[
Today
at 07:07:16 pm]
[Request] Demo Scene Sub ...
by
Gigatron
[
Today
at 06:29:39 pm]
Unlocking Files
by
KodeZwerg
[
Today
at 06:03:08 pm]
[SOLVED] trunk bug for mi...
by
Key-Real
[
Today
at 05:56:32 pm]
Demo Scene Bitmap Font Sc...
by
Gigatron
[
Today
at 05:56:27 pm]
Compile/Convert Delphi pr...
by
Martin_fr
[
Today
at 05:43:11 pm]
Generics - correct syntax
by
Thaddy
[
Today
at 05:40:59 pm]
Lazarus for Windows on aa...
by
msintle
[
Today
at 05:32:42 pm]
InstallAware Using Lazaru...
by
msintle
[
Today
at 05:26:36 pm]
Xcode Command Line Tools ...
by
Joseph
[
Today
at 05:16:39 pm]
Offical launch of the 1 B...
by
Hartmut
[
Today
at 04:49:29 pm]
what to do if my target M...
by
nickysn
[
Today
at 04:16:02 pm]
compiler error in unit
by
paule32
[
Today
at 03:49:50 pm]
Can function be used for ...
by
VisualLab
[
Today
at 02:15:30 pm]
Multithreading - synchron...
by
mika
[
Today
at 01:48:51 pm]
May be useful to somebody
by
KodeZwerg
[
Today
at 12:38:22 pm]
match automatic highlight...
by
Чебурашка
[
Today
at 11:35:14 am]
Tchart with dual numbers ...
by
wp
[
Today
at 10:48:18 am]
Debugger crashes with App...
by
Martin_fr
[
Today
at 09:29:46 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Title/footer click tool (Read 1280 times)
Davidous
Full Member
Posts: 107
Title/footer click tool
«
on:
June 24, 2019, 09:57:08 pm »
Hello,
I found a short description about Title/footer click tool, but I don't know how to use it.
Where can I get it from? I would like to make an OnClick event when I click on the chart title.
Logged
wp
Hero Member
Posts: 11923
Re: Title/footer click tool
«
Reply #1 on:
June 24, 2019, 10:48:06 pm »
PLEASE: Add something like "Chart" or "TAChart" to the title of the post, or better: post the question in the TAChart sub-board. Otherwise there's a high risk that the question is left unnoticed.
Add a TChartToolset component to the form (the one with the red wrench icon) and assign it to the "Toolset" property of the chart. Double click on it and add a "Header/footer click" tool. Select a "Shift" item with which the user can activate the tool. Now you have the OnClick event which fires when the header oder footer of the chart is clicked.
Since this is a very recent feature you need Lazarus trunk.
Logged
jamie
Hero Member
Posts: 6130
Re: Title/footer click tool
«
Reply #2 on:
June 25, 2019, 02:12:39 am »
Needs a little refinement but here goes.
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Chart1Click
(
Sender
:
TObject
)
;
Var
P
:
TPoint
;
R
:
TRect
;
begin
R
:
=
Rect
(
0
,
0
,
Chart1
.
Width
,
Chart1
.
Canvas
.
TextExtent
(
Chart1
.
Title
.
Text
.
text
)
.
cy
)
;
P
:
=
Chart1
.
ScreenToClient
(
Mouse
.
CurSorPos
)
;
If
PtInRect
(
R
,
P
)
Then
Beep
;
end
;
Place your pointer on the text in the header and Click!
Logged
The only true wisdom is knowing you know nothing
wp
Hero Member
Posts: 11923
Re: Title/footer click tool
«
Reply #3 on:
June 25, 2019, 10:00:52 am »
This code is too simple, it does not respect the true position of the title which may be left-, center- or right-aligned, and the title may have a font different from that of the chart's Canvas which makes the height calculation wrong.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
Title/footer click tool
TinyPortal
© 2005-2018