Solved

Access a Timer that is declared in a component

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

912 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

21 Experts available now in Live!

Get 1:1 Help Now