ImageEn, unit imageenview

TIEUserInteractionNotify


Declaration

TIEUserInteractionNotify = procedure(Sender: TObject; Event: TIEUserInteractionEvent; Info: Integer) of object;


Description

Event specifies the type of user interaction that has occured:
Value Description Info Value
ieiCropCreating User is selecting a rect for TIECropToolInteraction N/A
ieiCropSizing User is adjusting the rect of TIECropToolInteraction Grip (ordinal of TIEGrip)
ieiCropMoving User is moving the rect of TIECropToolInteraction N/A
ieiCropRotating User is rotating the rect of TIECropToolInteraction New rotation value
ieiCropEnacted TIECropToolInteraction was enacted (i.e. image was cropped) N/A
ieiCropCanceled TIECropToolInteraction was canceled N/A
ieiPaintStart User has started painting using TIEBrushToolInteraction (mouse down) N/A
ieiPainting User is painting using TIEBrushToolInteraction (mouse move) N/A
ieiPaintEnd User has completed painting using TIEBrushToolInteraction (mouse up) N/A
ieiPaintCanceled TIEBrushToolInteraction was canceled N/A
ieiCloneStart User has started cloning using TIECloneToolInteraction (mouse down) N/A
ieiCloning User is cloning using TIECloneToolInteraction (mouse move) N/A
ieiCloneEnd User has completed cloning using TIECloneToolInteraction (mouse up) N/A
ieiCloneCanceled TIECloneToolInteraction was canceled N/A
ieiRetouchStart User has started retouching using TIERetouchToolInteraction (mouse down)
ieiRetouching User is retouching using TIERetouchToolInteraction (mouse move)
ieiRetouchEnd User has completed retouching using TIERetouchToolInteraction (mouse up)
ieiRetouchCanceled TIERetouchToolInteraction was canceled
ieiRotateStart User has started rotating using TIERotateToolInteraction (mouse down) N/A
ieiRotating User is rotating using TIERotateToolInteraction (mouse move) New rotation value
ieiRotateEnd User has completed rotating using TIERotateToolInteraction (mouse up) N/A
ieiFlipped User has flipped using TIERotateToolInteraction N/A
ieiRotateCanceled TIERotateToolInteraction was canceled N/A
ieiLayerCreateStart User has started creating a layer using a mlCreate*Layers Interaction (mouse down) N/A
ieiLayerCreating User is creating a layer using a mlCreate*Layers Interaction (mouse move) New layer index
ieiLayerCreateEnacted User has completed creating a layer using a mlCreate*Layers Interaction (mouse up) New layer index
ieiLayerCreateCanceled Layer creation using a mlCreate*Layers Interaction was canceled N/A
ieiLayerPointsCreated User has started creating a layer using a mlClickCreate*Layers Interaction N/A
ieiLayerPointAdded User has added a point to a layer using a mlClickCreate*Layers or mlEditLayerPoints Interaction Index of new point
ieiLayerPointMoving User has moved a point of a layer using the mlEditLayerPoints Interaction (mouse move) Point being moved
ieiLayerPointRemoved User has removed a point from a layer using the mlEditLayerPoints Interaction Index of removed point
ieiLayerPointsCreated User has completed creating a layer using a mlClickCreate*Layers Interaction N/A
ieiLayerPointsEdited User has completed editing points of a layer using the mlEditLayerPoints Interaction N/A
ieiLayerPointsCanceled User has canceled editing points of a layer using the mlClickCreate*Layers or mlEditLayerPoints Interaction N/A
ieiMeasuringLength User is measuring a length using the miMeasureLength Interaction (mouse move) N/A
ieiMeasuringArea User is measuring an area using a miMeasure* Interaction (mouse move) N/A
ieiColorFill User has enabled the miColorFill Interaction and clicked the image to perform a flood fill Color of Fill
ieiAlphaFill User has enabled the miAlphaFill Interaction and clicked the image to perform an alpha flood fill Alpha of fill
ieiColorPickerHover User has enabled the miColorPicker Interaction and is hovering over a color TColor under the cursor
ieiColorPickerClick User has enabled the miColorPicker Interaction and clicked a color TColor of clicked pixel
ieiPdfAction User has interacted with the PDF Viewer
ieiPdfDocChanged Pages have been added or deleted pages in the current PDF Viewer
ieiPdfPageChanged Objects have been added, removed or changed on the current page of the PDF Viewer
ieiPdfFormChanged User has edited form fields in the current PDF Viewer. Note: ieiPdfFormChanged is triggered only when the form first changed and does not occur until field editing completes (e.g. moving to another field)
ieiPdfFieldChanged User has typed into a form field of the current PDF Viewer
ieiPdfDocLoaded A document has been loaded into the PDF Viewer
ieiPdfPageLoaded A page has been loaded into the PDF Viewer (e.g. by the user navigating the document)
ieiPdfError An error was encountered within the PDF Viewer. Typically this is due to corrupt PDF files. This event can occur unexpectedly, so avoid immediately showing an error message. Use an alternative method to show the error, e.g. setting a boolean field and showing an error in TApplication.OnIdle (Info returns the index of the erroneous page)
ieiPdfViewChanged The page view has changed in the PDF Viewer (e.g. by navigating or rotating the page)
ieiPdfSelChanged The selection of text has changed in the PDF Viewer. Note: ieiPdfSelChanged not triggered by selection in form fields
ieiPdfClickedLink User has clicked a link in the PDF Viewer (only called if OnClickLink is assigned)
ieiPdfClickedPageLink User has clicked an internal page link in the PDF Viewer and moved to another page
ieiPdfFieldEnter Focus has moved to a form field in the PDF Viewer (also see: FormFieldFocused)
ieiPdfFieldLeave Focus has left a form field in the PDF Viewer (also see: FormFieldFocused)
ieiPdfHoverText Mouse movement over text in the PDF Viewer
ieiPdfHoverLink Mouse movement over a link in the PDF Viewer
ieiPdfHoverPageLink Mouse movement over an internal page link in the PDF Viewer
ieiPdfHoverField Mouse movement over form field in the PDF Viewer
ieiPdfHoverOther Mouse movement other than text, field or link in a PDF Viewer
ieiPdfPrintPage A page of the PDF document is being printed. Info returns the index of the current page being printed (zero-based). If using this to show progress, then ieiPdfPrintEnd will occur once printing completes
ieiPdfPrintEnd Printing of a PDF document has completed
ieiPDFObjectSelected An object was selected by the user in the PDF Viewer
ieiPDFObjectMoved An object was moved by the user in the PDF Viewer (using miPdfSelectObject)
ieiPDFObjectSized An object was resized by the user in the PDF Viewer (using miPdfSelectObject)
ieiPDFObjectAdded An object was added by the user in the PDF Viewer (by pasting from the clipboard)
ieiPDFObjectRemoved An object was deleted by the user in the PDF Viewer (using the Delete key)
ieiPDFAnnotationSelected An annotation was selected by the user in the PDF Viewer (using miPdfSelectAnnotation)
ieiPDFAnnotationMoved An annotation was moved by the user in the PDF Viewer (using miPdfSelectAnnotation)
ieiPDFAnnotationSized An annotation was resized by the user in the PDF Viewer (using miPdfSelectAnnotation)
ieiPDFAnnotationRemoved An annotation was deleted by the user in the PDF Viewer (using the Delete key)
ieiTransformCreating User is selecting a region for TIETransformToolInteraction
ieiTransforming User is adjusting grips of the TIETransformToolInteraction
ieiTransformEnacted TIETransformToolInteraction was enacted (i.e. image was transformed)
ieiTransformCanceled TIETransformToolInteraction was canceled

The Info parameter may carry further detail of the event, as detailed in the table above.


Examples

procedure TfrmMain.IEView1UserInteraction(Sender: TObject; Event: TIEUserInteractionEvent; Info: Integer);
begin
  // Beep on crop cancellation
  if Event = ieiCropCanceled then
    MessageBeep( MB_ICONEXCLAMATION );
end;


// Use miColorPicker to set transparent parts of image

procedure TMainForm.btnSelColorClick(Sender: TObject);
begin
  // Enable color picker. Revert to previous tool after color is selected
  ImageEnView1.MouseInteractGeneral := [ miColorPicker ];
  ImageEnView1.FillTool.ResetAfterColorSelect := True;
end;

procedure TMainForm.ImageEnView1UserInteraction(Sender: TObject; Event:
    TIEUserInteractionEvent; Info: Integer);
var
  c: TColor;
begin
  if Event = ieiColorPickerHover then
  begin
    // Hovering over image - show color in our panel
    pnlCurrentColor.Color := TColor( Info );
  end
  else
  if Event = ieiColorPickerClick then
  begin
    // Clicked image - set this color as transparent in our image
    c := TColor( Info );
    ImageEnView1.Proc.SetTransparentColors( c, c, 0);
  end;
end;

procedure TMainForm.ImageEnView1UserInteraction(Sender: TObject; Event:
    TIEUserInteractionEvent; Info: Integer);
begin
  // Enable the "Clear" button when a form field in a PDF document is selected
  if Event in [ieiPdfFieldEnter, ieiPdfFieldLeave] then
    btnClear.Enabled := ImageEnView1.PdfViewer.FormFieldFocused;
end;

procedure TMainForm.ImageEnView1UserInteraction(Sender: TObject; Event:
    TIEUserInteractionEvent; Info: Integer);
begin
  // Show error message after an error is encountered
  if Event = ieiPdfError then
  begin
    MessageBeep( MB_ICONERROR );
    fPDFErrorPending := True;     // In Application.OnIdle an error message will show
  end;
end;

// Show PDF Printing Progress
// Note: You can also use TImageEnView.OnProgress
procedure TMainForm.ImageEnView1UserInteraction(Sender: TObject; Event:
    TIEUserInteractionEvent; Info: Integer);
begin
  if Event = ieiPdfPrintPage then
  begin
    ProgressBar1.Position := MulDiv( Info, 100, ImageEnView1.PdfViewer.PageCount );
    ProgressBar1.Visible := true;
  end
  else
  if Event = ieiPdfPrintEnd then
    ProgressBar1.Visible := False;
end;


See Also

TIEUserInteraction