Solved

Access a Timer that is declared in a component

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 80
Multiple image collision 13 105
Create a path if not exists 7 123
Twebbrowser in Fire monkey android scrolling to bottom 1 81
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

737 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