Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS FMX UI Pack
TTMSFMXPlanner: How to insert a new Item with dblclick on Windows and Long-Tap on Mobile

For touch screens:

1) Drop an instance of GestureManager on the form and assign it to the Touch.GestureManager property of the TTMSFMXPlanner and check LongTap and DoubleTap under options under the InteractiveGestures property.


2) Add the following code:

procedure TForm1.TMSFMXPlanner1Gesture(Sender: TObject;
  const [Ref] EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
  if {$IFDEF MSWINDOWS}(EventInfo.GestureID = igiDoubleTap) or {$ENDIF} (EventInfo.GestureID = igiLongTap)
    and (TInteractiveGestureFlag.gfEnd in EventInfo.Flags) then
  begin
    if not Assigned(TMSFMXPlanner1.ActiveItem) then
      TMSFMXPlanner1.AddItemAtSelection;
  end
end;


For non-touch screens:

Simply implement the OnDblClick event and use the following code:

procedure TForm1.TMSFMXPlanner1DblClick(Sender: TObject);
begin
  if not Assigned(TMSFMXPlanner1.ActiveItem) then
    TMSFMXPlanner1.AddItemAtSelection;
end;