OnTextObjectMouseDown Event

Applies to
TWPPreview

Declaration
TTextObjectMouseEvent = Procedure(Sender: TWPCustomRtfEdit; pobj: PTTextObj; obj: TWPObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer) of object;

Description
This even is triggered when the user presses the mouse button while the mouse pointer is over an image object. It is also triggered by codes, such as mail merge fields - (Alternative OnTextObjectClick). If it is triggered by an image object the X and Y coordinates are relative to the objects upperl left coordinate, for usual text objects the client coordinates in the editor are passed.

Category
Image Events


OnTextObjectMouseDown Example
This code toggles the state of a checkbox object. The checkbox object can be created with InputTextFieldName('FORMCHECKBOX').
procedure TWPEdTest.DataEditTextObjectMouseDown(Sender: TWPCustomRtfEdit;
  pobj: TWPTextObj; obj: TWPObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if pobj.Name = 'FORMCHECKBOX' then
  begin
     WPSetCheckBoxValue(pobj,not WPGetCheckBoxValue(pobj)); // utility function to swap true/false and on/off
     DataEdit.IgnoreMouse;
     DataEdit.Repaint;
  end;
end;


Copyright (C) by WPCUBED GmbH - Munich
http://www.wpcubed.com