Solved

Access a Timer that is declared in a component

Posted on 2007-04-05
5
176 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now