Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

TElTimerPool; Access to Timers

How can I access separate timers?

ElTimerPool1->Items[0]->Enabled = true;

This expression does not work, how to do it correctly?

Comments

  • 4 Comments sorted by Votes Date Added
  • Can you clarify, what you mean saying "does not work"? The following expression in Delphi compiles well:

    ElTimerPool1.Items[0].Enabled := True;

    And I guess your expression is also valid in C++.
  • With expression ElTimerPool1->Items[0]->Enabled = true  I get the following compiler errors:

    [bcc32c Fehler] Unit1.cpp(22): member reference type 'Eltimers::TElTimerPool *' is a pointer; did you mean to use '->'?
    [bcc32c Fehler] Unit1.cpp(22): no member named 'Enabled' in 'Eltimers::TElTimerPoolItems'

    C++Builder 11
    LMD 2021.6

    I thought I had a syntax error.
  • edited December 2021 Posts: 0Vote Up0Vote Down
    Ok, sorry, your right, in C++ there will be a syntax error. Because C++ Builder, as opposed to Delphi, does not recognize so called "default" indexed properties. So, you have to write:

    ElTimerPool1->Items->Items[0]->Enabled = true;

    This is similar to all other VCL collections, for example Lines in TMemo:

    Memo1.Lines[0]           := 'some string'; // Delphi

    Memo1->Lines->Strings[0]  = "some string"; // C++


  • So simple. Thank you.
Sign In or Register to comment.