[SOLVED] How to detect touchscreen? lazarus / 31-LCL ---------------------------------------------------------------------- dsiders · 2019-01-10 12:36 I am wondering how to detect if a touch-enabled device is attached during form creation/display. It is needed to adjust font and control sizes and alignment for UI controls that are just too small for touch usage. Any ideas? Neither Google nor Forum Search were very helpful on this topic. Thanks in advance. ---------------------------------------------------------------------- tr_escape · 2019-01-10 13:25 Maybe this can be help for windows: https://stackoverflow.com/questions/20923853/why-i-cant-detect-touch- screen and related: https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf- winuser-getsystemmetrics Note : I never used yet ---------------------------------------------------------------------- Josh · 2019-01-10 13:27 Hi Windows getsystemmetrics maybe the route to go. I have not tested; but should be ok. Code: [Select]VAR Touch_Screen_Enabled:Boolean=True; begin   Touch_Screen_Enabled:=GetSystemMetrics(SM_MAXIMUMTOUCHES)>0;                                note need to add windows to uses ---------------------------------------------------------------------- dsiders · 2019-01-10 13:49 Quote from: josh on January 10, 2019, 02:27:17 pmWindows getsystemmetrics maybe the route to go. I have not tested; but should be ok. Code: [Select]VAR Touch_Screen_Enabled:Boolean=True; begin   Touch_Screen_Enabled:=GetSystemMetrics(SM_MAXIMUMTOUCHES)>0;                                note need to add windows to uses Thanks Josh. This does in fact work for Windows. Looks like lcltype.pp needs a refresh though... it doesn't have some the SM_* values from the MSDN docs. Now I need to poke around and see how Linux handles this. Thanks again. ---------------------------------------------------------------------- dsiders · 2019-01-10 14:47 Quote from: dsiders on January 10, 2019, 02:49:17 pmNow I need to poke around and see how Linux handles this. So far, all I have found that seems remotely distro-independent is capturing output from udevadm info. The search continues...