• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

Access a Timer that is declared in a component

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
peterkiers
Asked:
peterkiers
  • 3
  • 2
1 Solution
 
Eddie ShipmanAll-around developerCommented:
If the Timer is public or published in your component, you can access it just like any other
property:

MyDrawingPanel.CursorFlashTimer.Enabled := True;
0
 
peterkiersAuthor Commented:
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
 
peterkiersAuthor Commented:
how and where do i have to declare it, to access it.

P.
0
 
Eddie ShipmanAll-around developerCommented:
move it to the public section to be able to access it like I stated.
0
 
peterkiersAuthor Commented:
Oke

Peter
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now