0

I'm facing really unfamiliar situation with unknown cause for delay in application run, since it's the first time I use Gestures and GestureManager. (VCL type application)

It seems that, when I apply TGestureManager to the Touch.GestureManager property of a form, when that form is called to show for the first time, the application freeze / delay of approx 5 seconds is made. Even if there are no gestures enabled (checked) at all. As soon as I remove the Touch.GestureManager property off of the form, the form is displayed immediatelly with Form.Show event. Application creates all of the forms at startup, so the form is already created by the time I call Form.Show event.

The form itself is quite heavy (FullHD resolution size, with quite a lot components placed on it...), but doesn't show any speed issues without GestureManager in use...

I could only find one topic on the web regarding this so far, but the answer wasn't really helping ( suggesting to turn on "Tablet PC" option on a PC. This is already done...)

Cheers

Edit: On "less-heavy" form, (less components on it), the delay is slightly lower, still around 2-3 seconds though...

Edit2-code

Example that creates delay:

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
var
  Form1: TForm1;
implementation
{$R *.dfm}
uses Unit2;
procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2.show;
end;
end.

Calls form2, which is clean form with 20 TAdvGlassButton objects on it (part of TMS Component pack), and GestureManager, which is assigned to Form2.Touch.GestureManager property. This one creates around 2 second delay when Button1 is pressed (and Form2 should be shown);

That Marc
  • 1,134
  • 3
  • 19
  • 42
  • Is this a VCL or FMX application? – SilverWarior Jan 23 '15 at 12:57
  • Just did some testing and I can't reproduce this in FMX even with more than 100 components placed on the form while each component has GestureManager assigned. – SilverWarior Jan 23 '15 at 13:21
  • I just tried with 2000 programatically generated panels, and there seems to be no difference wheter gesture manager is assigned to form or to any other controls. The delay before showing the form for the first time seems to be the same in all scenarios. – SilverWarior Jan 23 '15 at 13:45
  • sorry, forgot to mention. its a Vcl type application (added to the original question now). – That Marc Jan 23 '15 at 13:53
  • I only assign it to the form, not components, as I mostly have buttons which dont keep focus so the gestures of a form works all over the canvas... ps: "delay seems to be the same" - so there is a delay? and how much? – That Marc Jan 23 '15 at 13:57
  • Can you provide a small, complete sample application that demonstrates the delay? – Ken White Jan 23 '15 at 14:02
  • never mind! just putted 20 buttons of a type TAdvGlassButton (part of TMS component pack, have the source code of just the button, but dont think I can legitely provide it here??) on an empty form, have 2 seconds delay. form1 with button1, button onclick event calls form2.show. – That Marc Jan 23 '15 at 14:21
  • Figured this out: If I don't assign GestureManager1 to form in IDE, but rather do that on that form's button, the form is displayed immediatelly, but when I press the button that calls Console1.Touch.GestureManager:=GestureManager1; the whole app freezes for same amount as there was the delay before (2 to 5 secs..)... What could be causing that? – That Marc Jan 23 '15 at 15:38
  • 1
    For future reference, the "sample" you posted does nothing to reproduce the problem, because we don't have the `form2` which is a *clean form with 20 TAdvGlassButton objects on it and GestureManager*. An example should be something we can copy/paste, compile and run to reproduce the problem. See [How to Create a Minimal, Complete and Verifiable Example](http://stackoverflow.com/help/mcve). – Ken White Jan 23 '15 at 16:20
  • Noted. Though, as said, I'm not sure if I am allowed to copy the unit of the component that is shareware... ? – That Marc Jan 23 '15 at 16:28

1 Answers1

0

Guess I just figured my own answer to the question of "Why" the delay appears.

Now, "How to solve it", this question remains opened if anyone figures...

As far as 'Why' is considered...:

Looks like TMS Components (I can confirm for them) automatically take the Touch property of the parent form! Therefore, to me at first sight it looked like gestures are working all over the form and controls simply because buttons don't really take focus at any time, but that wasn't the case! The gestures should not work on them unless assined. Since they were, I figured every element got assigned the touch property.

So, this resulted in having large amount of elements on a form, all taking Touch property when the form is firstly shown, which obviously caused the delay I experienced.

Creating a panel over the form and behind all of the controls actually didn't look like anything changed, but it did -> the form is visible right away, gestures are working only on the area where the panel (background) is visible (shame, having them worked all over the buttons would be nice, but not in account of that much delay!), and somehow that fits my needs.

Now, why TMS components are automatically taking the form's property is a really good question, as well as how to disable that function...

That Marc
  • 1,134
  • 3
  • 19
  • 42
  • It is posible that the glass buttons are designed in this way so that they don't block gestures from their parent component. Now why this causes so much delay I'm not sure. I tried assigning gesture manager to each of those proceduraly generated buttons to see if that might be the cause of delay but it wasn't in my case. Perhaps that was becouse I was assigning gesture manager from a local variable but TMS components are probably reading forms property storing information about gesture manager that can be a bit slower. – SilverWarior Jan 24 '15 at 15:05
  • I just did a comparison test about asigning touch manager to 2000 panels by directly reading it from forms touch property and by asigning it from local variable and there is no noticable difference. In both cases it took 1 ms to complete. So I would gues that TMS Advanced Glass Button does some aditional processing after its GestureManager property is modified. You can test this out by quickly changing the GestureManager property from a single TMS button in a lop to see if it takes more time than doing the same for some standard VCL controls like Panel for instance. – SilverWarior Jan 24 '15 at 15:44
  • Good advice/suggestion. I'll go make an example for compare the times between the two as soon as I can, and get back with the results. – That Marc Jan 24 '15 at 15:57