Tips and Frequently Asked Questions

 Using custom inplace editors


Using custom inplace editors is possible with the Parameter controls but require some preparing of the inplace editor to be used correct. The custom inplace editor is invoked with the style ‘CUSTOM’, ie:
Parameter control events

When the custom inplace editor is about to be edited, the event OnParamCustomEdit is triggered with parameters:

For TParamLabel:
TParamCustomEditEvent = procedure(Sender: TObject; href, value, props: string; EditRect: TRect) of object;
For TParamListBox and TParamCheckList:
TParamCustomEditEvent = procedure(Sender: TObject; idx: Integer; href, value, props: string; EditRect: TRect) of object;
For TParamTreeView:
TParamCustomEditEvent = procedure(Sender: TObject; Node: TTreeNode; href, value, props: string; EditRect: TRect) of object;
The href parameter is the unique ID of the parameter in the control. The value parameter contains the current value of the parameter, the props parameter the value of the PROPS attribute. Last parameter is the rectangle where the inplace editor should be positioned. For the TParamListBox and TParamCheckList, an additional idx parameter refers to the item in the list where the parameter is located, for the TParamTreeView, the Node parameter refers to the node where the parameter is located.

From this event, following code can be used to show the custom inplace edit control:
mycustomcontrol.Parent := Sender;
mycustomcontrol.left := EditRect.Left;
mycustomcontrol.Top := EditRect.Top;
mycustomcontrol.Text := value;
mycustomcontrol.Param := href;
mycustomcontrol.OnUpdate := (Sender as TParamlabel).ControlUpdate;
mycustomcontrol.Visible := true;
mycustomcontrol.SetFocus;
The ControlUpdate procedure is defined in the parameter component and will set the new parameter value when the editing is done. ControlUpdate is defined as:
procedure ControlUpdate(Sender: TObject; Param,Text:string);
with Param the unique parameter identifier and Text the parameter value to set.

Preparing the inplace edit control

Create a descendent component of the inplace edit control with following properties and events:
TParamUpdateEvent = procedure(Sender: TObject; Param, Text: string) of object;

TMyCustomControl = class(TMyControl)
private
  FParam: string;
  FOnUpdate: TParamUpdateEvent;
  procedure WMActivate(var Message: TWMActivate); message WM_ACTIVATE;
protected
  procedure DoExit; override;
  procedure CreateParams(var Params: TCreateParams); override;
public
  property Param: string read FParam write FParam;
  property OnUpdate: TParamUpdateEvent read FOnUpdate write FOnUpdate;
end;
The implementation for this descendent control is then:
{ TMyCustomControl }

procedure TMyCustomControl.CreateParams(var Params: TCreateParams);
begin
  inherited;
  with Params do
    Style := Style AND NOT WS_CHILD OR WS_POPUP;
end;

procedure TMyCustomControl.DoExit;
begin
  inherited;
  if Assigned(OnUpdate) then
    OnUpdate(Self,Param,Text);
end;

procedure TMyCustomControl.WMActivate(var Message: TWMActivate);
begin
  inherited;
  if Message.Active = 0 then
    Hide;
end;
Using the custom inplace editor can be done by putting a component on the form where the parameter control is used and set its visible property to False. The inplace editor will then be displayed when the OnParamCustomEdit event is triggered.


TMS VCL UI Pack

check_circle
TParamCheckList
is part of
TMS VCL UI Pack
info
Windows UI Essentials

Pricing

Single Developer License Small Team License Site License
 

TMS VCL UI Pack


€ 375

150 yearly renewal
license for 1 developer


Includes
check  Full source code
check  Access to the TMS Support Center
check  Free updates and new releases
MOST POPULAR

TMS VCL Subscription


€ 895

450 yearly renewal
license for 1 developer


Includes
check  Full source code
check  Access to the TMS Support Center
check  Free updates and new releases
check  TMS VCL UI Pack
check  All TMS VCL products
more_horiz  Discover more
BEST VALUE

TMS ALL-ACCESS


€ 1,795

575 yearly renewal
license for 1 developer


Includes
check  Full source code
check  Access to the TMS Support Center
check  Free updates and new releases
check  TMS VCL UI Pack
check  All TMS VCL products
check  All TMS products
more_horiz  Discover more
All prices excl. VAT. Renewal price is subject to change and only valid up to 30 days after license has expired. After renewal period a discount price is offered to renew the license.

TMS ALL-ACCESS

key
Get unlimited access to all TMS products
local_offer
One money and time saving bundle

Free Trial

Start a free TMS VCL UI Pack evaluation today!
RAD Studio


What our customers say

Thank you Mr. Fierens for your time and assistance. Just want to say your VCL Pack is fabulous.

- Mark Mihevc

Thank you for this superb tool collection!

- Henning Swiboda

Thanks for the effort to create the VCL grid goodies ! These chunks of outcome-oriented teaching-material are very useful. It's unbelievable how powerful the grid is when one knows how to unveil it's countless options...

- Feichtenschlager Thomas

I don''t know how I could have created and managed so many projects without the AdvStringGrid! And although there is already so much functionality in it I''m using my own derived version with automatic column widths, enhanced export to Excel (including text colors, backround colors, comments, merged cells and more), the possibility to fill in static data at design time and more. This often allows me to build a new tool in hours instead of days! Support is also great! Thanks.

- Raß Jacqueline

Keep up the great work...Every new release of TMS Component Pack is like Xmas. Top quality components! :-)

- Aidan Thomson via email

TMS WEB Core

language
Create modern web apps in Delphi & VSC
build_circle
Use Object Pascal code to build JavaScript apps