Recent

Author Topic: "Swipe" Effect for TPageControl (and other similar controls maybe)  (Read 761 times)

ArminLinder

  • Sr. Member
  • ****
  • Posts: 316
  • Keep it simple.
Hi all,

I recently tested one of my pieces of software on a (Windows) PC having a touchscreen. It worked to my satisfaction without changing anyting. Great. The GUI is mainly built around several forms and a TPageControl to switch between them.

I wondered, whether it was possible to get the "swipe" effect like on a mobile phone, so I could navigate from one page to the next or previous one with a swipe of my finger. I thought there could be a way by activating Drag_n_Drop and having a 1 px wide "drop" area on each edge of the screen, which catches the swipe once it is touched. Didn't work, however.

Has anyone ever tried such a thing wthin the LCL (so there is a chance the software works on Linux as well), and who can help me with some piece of code?

Thnx, Armin.
« Last Edit: April 17, 2023, 04:41:03 pm by Nimral »
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

AlexTP

  • Hero Member
  • *****
  • Posts: 2541
    • UVviewsoft
Re: "Swipe" Effect for TPageControl (and other similar controls maybe)
« Reply #1 on: April 17, 2023, 07:25:09 pm »
If you want to add 'swipe' or any other effect to LCL components - don't do it. I tried to add some animations to my ATTabs - bad result. too slow repainting so animation becomes too jumpy and ugly.

Sublime Text has such tabs animations. but it uses not LCL - it uses OpenGL or stuff like that.

Soner

  • Sr. Member
  • ****
  • Posts: 318
Re: "Swipe" Effect for TPageControl (and other similar controls maybe)
« Reply #2 on: April 17, 2023, 07:38:05 pm »
Maybe this is good starting point:
http://www.tecepe.com.br/d7gestures/

Google for "win32 gesture"

ArminLinder

  • Sr. Member
  • ****
  • Posts: 316
  • Keep it simple.
Re: "Swipe" Effect for TPageControl (and other similar controls maybe)
« Reply #3 on: April 21, 2023, 08:47:56 am »
Hi SOner,

thanks for your reply, and it was indeed helpful to read about the Multi-Touch support built into Windows, but I need something slightly different, and the solution presented there seems to be Windows only.

Maybe I was not clear enough, I am not after the full "swipe" effect (the contents of the page travels along my finger) but merely after a way to touch and move my finger sideways, whereafter an inc(TPageControl.ActivePage) (finger moved right) or dec(TPageControl.ActivePage) (finger moved left) should be performed. Right now I inserted an arrow button in every form at the left and right edge, which works, but I noticed users, especially the youger ones which are more smartphone-affine, trying to switch the page by swiping over the touchscreen.

Armin
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

 

TinyPortal © 2005-2018