Solved

Access a Timer that is declared in a component

Posted on 2007-04-05
5
184 Views
Last Modified: 2011-09-20
Dear  Experts,

I have made a TCustomPanel-component and in that component i have declared Timer component
When I put my component on a form how can I put the Timer to True with a MainMenu-item?

constructor TMyDrawingPanel.Create(AOwner: TComponent);
begin
  inherited Create (AOwner);
  CursorFlashTimer := TTimer.Create(self);          <----------------------------
  with  CursorFlashTimer do
  begin
    Enabled := False;
    Interval := 200;
    OnTimer := CursorFlashTimer_OnTImer;
  end;
  SCRCOLS := 80;
  SCRROWS := 24;
  SocOpen := False;
  ColorRed := clRed;

I have this, but this is not working:

procedure TConnectHost.miFlashCursorClick(Sender: TObject);
begin
  miFlashCursor.Checked := not miFlashCursor.Checked;
  CursorFlashTimer.Enabled := True;
end;

How can i put the Timer to True?

Peter
0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 500 total points
ID: 18858100
If the Timer is public or published in your component, you can access it just like any other
property:

MyDrawingPanel.CursorFlashTimer.Enabled := True;
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18859027
I have put it in the Private part:

type
  TMyDrawingPanel = class(TCustomPanel)
  private
    { Private declarations }
    CursorFlashTimer: TTImer;              <----------------------
    Bounding: Boolean;
    fcursorVisible: boolean;
    AnchorX, AnchorY,
    CurX, CurY: Integer;
    SCRROWS: integer;
    SCRCOLS: integer;
    FontWidthPix: integer;

Peter
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18859158
how and where do i have to declare it, to access it.

P.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18859201
move it to the public section to be able to access it like I stated.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18859233
Oke

Peter
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question