Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

[11.07+D2010] TppViewer + Gestures

edited January 2010 in General
I'd like my users to use gestures to rapidly perform actions on my custom
preview form (which uses an almost-full screen TppViewer), but it seems that
TppViewer does not visually inherit "Touch" properties, and setting manually
those properties by code, with:

with ppViewer1 do begin
Touch.GestureManager:=GestureManager1;
OnGesture:=FormGesture;
end;

doesn't work at all when the gesture is done with the mouse over the
ppViewer component.

Any solution or suggestion?

Thanks in advance.

Comments

  • edited January 2010

    According the Delphi documentation all TControl descendants have gesture
    support. The Viewer is a descendant of TPanel and it has a Scrollbox and
    PaintBox on it, there are properties to access these controls
    (TppViewer.PaintBox and TppViewer.Scrollbox). I recommend checking out the
    source code to TppViewer in ppViewr.pas. We have not yet worked with
    gestures, perhaps you would like to create an example that we can post to
    rbWiki?

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2010
    > source code to TppViewer in ppViewr.pas. We have not yet worked with

    Thanks for your kind suggestions, Nard, they worked ^_^

    the step are actually simple:

    1) create a custom reportpreview form with a TppViewer component on it

    2) drop a TGestureManager component on the custom report preview form

    3) in the form > touch > gestures, check: left, right, up, down gestures

    4) create a OnGesture procedure, associated to the form itself, like this:

    procedure TReportPreviewForm.FormGesture(Sender: TObject;
    const EventInfo: TGestureEventInfo; var Handled: Boolean);
    begin
    if EventInfo.GestureID=sgiLeft then
    if EventInfo.GestureID=sgiRight then
    if EventInfo.GestureID=sgiUp then
    if EventInfo.GestureID=sgiDown then
    end;

    3) in the formshow, add:

    with ppViewer1.ScrollBox do begin
    Touch.GestureManager:=GestureManager1;
    OnGesture:=FormGesture;
    end;

    and that's all. :) Feel free to publish this example in the wiki, if you
    wish.

    Max
This discussion has been closed.