Tag Archives: interceptor

Implementing SelectDelay for TComboBox – Postpone Event Handler Execution in Delphi

Delphi’s TComboBox combines an edit box with a scrollable list – with the Style property defining the display style of the combo. When set to csDropDownList there’s no edit box – users can only pick from the predefined items displayed by the list. If you need to react, when the selection changes, you will write code for the OnSelect event.

Now, presume our combo is a kind of a filter selector – when the selection changes you need to update some other UI control. For example, combo lists invoices and selecting one (item from its list) displays the selected invoice items in some grid control.

Depending on the number of invoice items, where they are stored, how you fetch them, and so on – the actual code to (fetch items and) refresh the UI might take longer time – whatever longer means. If you scroll quickly through the combo items – OnSelect will get fired for each visited item in the list and your application might appear irresponsible, lagging and slow.
Continue reading

Delphi Interceptor (/Interposer) Classes -> TButton = class(TButton)

Have you ever needed for a specific Delphi control, like a TButton, to have just one more property or a method that is a “must have” for your current application?

Most Delphi developers, when they need a TMySuperButton, would either look for a third-party VCL solution or would try creating a derived control.

What if you do not want to have this MySuperButton permanently in the Component/Tool Palette – since it solves one problem only for this particular application you are developing?

What’s more … how about having a TButton with more properties and methods, some application specific extra behavior, and not TMySupperButton?

How about extending what TButton has without the need to create a derived class with a different name?
Continue reading