Simon
Simon

Reputation: 9425

Delphi - How do i find out what a component is doing 'behind the scenes'

Im attempting to write a new component descendant from a common component (TDateTimePicker). My ultimate goal is to sub-class the TDateTimePicker so that when the user enters the component, the 'SelText' is set to a particular part of the DateTime.

At the moment, the behaviour of the TDateTimePicker is to focus the last selected text when it receives focus again. What i would like to acheive first, is to find out (look at) the code that actually is executed when the user focuses the TDateTimePicker.

I can see TDateTimePicker is a decendant of TCommonCalender which in turn is a decendant of TWinControl. But ive tried placing a breakpoint on procedures in TWinControl and they cannot be reached (which i guess is correct behaviour since a lot of components inherit from TWinControl).

So how do i find out what is happening when the user enters a TDateTimePicker? What code is run? Is it all hidden? I would hope this may shed some light on what i need to do to override the default bahaviour to accomplish my goal.

Upvotes: 0

Views: 224

Answers (2)

Toto
Toto

Reputation: 1440

In Project|Options|Compiler check the 'Use debug DCUs' and the rebuild the application. Depending on the Delphi version this checkbox can be found in different places, this is for Delphi 2007.

Upvotes: 3

Cosmin Prund
Cosmin Prund

Reputation: 25678

TDateTimePicker is a wrapper around a Windows Standard Control. The Delphi wrapper simply sends messages to the Windows control, so there's not much Delphi code to read.

You'll have to treat the TDateTimePicker as a "black box". Whatever happens in there, it's an implementation detail you're not supposed to care about. In fact the implementation details for the Date Time Picker have changed, for example, with Windows 7!

Upvotes: 4

Related Questions