is it possible to scroll on a tableview in the simulator with the trackpad without clicking it actually? It gets very annoying at some time
You can open the three finger drag by follow, but it may case some delay.
From the Apple menu, choose System Preferences.
Click the Accessibility icon.
Choose Mouse & Trackpad from the options on the left.
Click Trackpad Options.
Place a checkmark next to "Enable dragging."
From the related pop-up menu, choose “three finger drag” so there's a checkmark next to it.
Click OK.
From: https://support.apple.com/en-us/HT204609
I've created a TCustomControl derived class for a VCL application running on a Windows 8.1 tablet.
I'm using the OnMouseDown / OnMouseUp events even though this is obviously touch based.
What I'd like to do is detect a long press - i.e. touch down and hold for 1 second. So in the OnMouseDown event I record the down timestamp, set a flag to indicate the mouse is down and create an anonymous thread which sleeps for 1 second, and then checks the flag.
In OnMouseUp I set the flag to false.
This works as long as you wiggle your finger on the control. Otherwise if you just touch and hold the mouse down event is not called until you release your finger.
I've look at gestures, but that just looks completely overkill and from what I understand doesn't support long press anyway.
Thanks for any suggestions.
Richard
What you're facing is "normal" yet ridiculously stupid behaviour of Windows with touch input devices. We're facing the same issue for a while now, and are trying to solve it actively for the last couple weeks.
The trick is, that windows handles touch input device as "mouse, that can be fully controlled with single finger". Therefore, it has several states, more than events:
Events are: Touch begin (down), move, up, right click, and if you really want to register for a callback you'll get stationary (not moved since last report but still down).
Meanwhile, there are more states. First, when you press your finger down, it internally detects "Touch down!" event. It than waits a certain amount of time (which might or might not be available to hack-change, depends on drivers etc...), to determine whether what you wanted was a right click (after x time, upon release !before Y time! it will fire right click event) or whether it was a left click down (triggering event TouchBegin - after y time, which is LONGER than x-time, and after the y expires, it will fire left down event (not click!)).
Meanwhile, if the first touch down is interrupted by either move or - !! while waiting for x time to expire!! release of the finger BEFORE x time is ran out, it will automatically trigger left down (on move) or left click (on release). Same goes for any time after the Y time expires as well, or MOVE is triggered.
To put it more simply and understandable, I'll try to give an example:
Let's say that you have touch device, and the timings are as follows:
Point B is beginning, positioned at 0 seconds of our timeline.
Point X is first trigger breakpoint, positioned at 5 seconds of our timeline.
Point Y is second trigger breakpoint, positioned a 10 seconds of our timeline.
You put your finger on touch, and that starts the timeline.
Possible scenarios:
- You release it anytime before point X -> Left click is triggered (Touch down and up events, in order immediately one after another)
- You release it after point X but before point Y -> Right click is triggered (Touch down and up events, with right click flag)
- You reach point Y - Left down is triggered!
- You release it after point Y anytime, no matter if move triggers between release or not (but move is NOT triggered before reaching this point in timeline) -> Left up is triggered.
You trigger (do) move event before reaching point X -> Left down is triggered, followed by as many move events as it detects it, until you release it -> then left up is triggered
You trigger (do) move event after X but before Y -> same as above!
You reach point Y and move it afterwards -> check point no4 above.
Hope this is making any sense to you.
Now to jump to the possible solutions: Custom driver would be one option, but we're not there yet, so we're still trying other options. The most promising for now seems to be use of RAW_INPUT and Touch hooks, looks like we'll have to combine them to get what we want tho.
The bright side is, that windows itself DOES detect when finger touches the device, regardless of the timings and events that it wants to detect, determine and then forward to apps, but they for some reason made it hard to use in such nature. As a proof you could simply check the transparent dot that appears underneath your finger the very first moment you touch the screen.
Meanwhile, Android handles these things way better...
Hope it helps, and I'm happy to come around with the complete solution once we come through and get something good enough for usage.
M.*
If the MouseDown event is not triggered and you want to make your delay counter dependent on it then you are basically screwed. That said, I assume you are open to slight changes of concept. :)
I think it can still be done if you change your button into something like a flip-switch. The user has to "grab" (touch) it, "pull it up" (drag, should trigger StartDrag event) and hold it there for the desired amount of time. Upon release of the switch (MouseDown event), it snaps back down.
To design such a button, you could use a tiny TPanel for the knob and a slightly larger one for allowing limited vertical movement on it. Set BevelInner property to bvLowered and BevelOuter to bvRaised to make it look like a frame and the knob panel its child. Or use a TImage to display the knob in it's up/down positions. In any case, set the knob element's DragKind property to dkDrag or the StartDrag event won't occur. If still no event is fired, please try to detect touch input capabilities and report your findings..
Not sure this qualifies for an answer but maybe it's worth a swing.
I'm trying to make a VCL app more touch friendly and have been trying to get a DBGrid to scroll like an Android or iOS grid/list. By default it works if you do a double flick - with inertia and everything, but would like it to scroll with a single flick or finger drag.
I figure it will be something in the touch properties, but I haven't managed to work out the magic combination.
Has anyone done this?
I am trying to detect gestures on a specific part of my screen close to the right hand most side.
When I try tapping using this approach (iOS simulator: how to do a 2 finger single tap on a mac laptop?), the two "fingers" appear at opposite ends of the screen. How do I get the simulator to tap so that the "fingers" are next to each other.
Use Option key to show two fingers icons on simulator screen. Place them as close as you want them to be. Then press Shift to move them to wherever on the screen you want.
When in the simulator, hold the option key down and click - this will simulate a two-finger tap!
It kind of annoys me how small the iPad simulator is... Some apps I have in mind I have difficulty testing because of the small size of the iPad simulator. Is there anyway to make it larger than it currently is?
Menu Bar: Window->scale as shown in comments by chpwn.
You can always zoom the screen in. Usually something like control-scroll but check your mouse or trackpad system preferences. command-option-backslash toggles antialiasing if you need to see magnified pixels when zoomed in.
in iPhone Simulater menu bar go to
window > scale > 100%
To add to this, you can create a keyboard shortcut to make it easier:
goto System Preferences -> Keyboard -> Keyboard shortcuts
click small "+" at bottom of list
drop down Application list and scroll to bottom, choose Other
browse to /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications (at least on my machine)
choose iOS Simulator
for Menu Title enter "100%" without the quotes
for Keyboard Shortcut, press your shortcut key e.g. Cmd-F ('F'ull screen)
click Add and you're done
close and restart the simulator and press Cmd-F
HTH - DF
press command 1, Command 2, or, Command 3. it will change the screen size. Easy fix!