Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Touchscreen
Message
From
02/02/2014 13:40:21
 
 
To
02/02/2014 13:22:24
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 8
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01592151
Message ID:
01592947
Views:
57
>>>>>>My challenge today was to let the user move to a part of a very wide chart. The chart is simply too wide to display entirely. So, I first created a form with a pageframe with one page. In that page I put a container. In that container I put the chart. Beneath the container, but inside the page I put a slider. With the slider the user can horizontally manipulate the chart. Actually, it sets the Left-property to a minus value. The slider is big enough for fingers.
>>>>>
>>>>>I did something similar for touch, but I use only the MouseMove event, with a property on MouseDown (so the method realizes you want to move the control with the mouse) and then change the left property depending on the offset of the mouse position. That works very good with touch.
>>>>
>>>>Actually, you probably don't need to set a property in the Mousedown() event, because the first parameter of MouseMove() tells you what mouse button is currently pressed.
>>>>
>>>>The chart I have to 'move' consists of very many objects, e.g. a vertical shape for each day. The problem with using the mousemove of the shape is that, although it basically works, the finger crosses the boundaries between the shapes very easilly. That implies that the mousemove is taken over by the mousemove of the next day's shape. However, the result is a far from smooth operation. It hampers far too much. That's why I decided to use a slider beneath the chart.
>>>>
>>>>I also occasionally use SetViewport(), but in this case it's useless because it's only a part of the form that I want to manipulate. Yesterday I first tried to use a form within a formset, but the attempt failed.
>>>
>>>What I do is to have the code only in the MouseMove event of the moving container object:
>>>
>>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>>*
>>>IF nButton = 1 AND nShift!=1 && Left button
>>>	*
>>>	*-- Check the relation to its previous position.
>>>	DO CASE
>>>		CASE THIS.nXCoord = 0
>>>		CASE THIS.nXCoord < nXCoord
>>>			*-- Previous position of mouse was higher so we are moving down.
>>>			THIS.DoMove(6,nXCoord)
>>>		CASE THIS.nXCoord > nXCoord
>>>			*-- Previous position of mouse was lower.
>>>			THIS.DoMove(-6,nXCoord)
>>>	ENDCASE
>>>	*
>>>	THIS.nXCoord = nXCoord
>>>	*
>>>ENDIF
>>>
>>>The other objects that are dropped on the container forward the call to their parent:
>>>
>>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>>THIS.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
>>>
>>
>>To be complete, what's in your UDF DoMove()?
>My original DoMove() code is more complex than what I can show because I have some additional functionality built in to control the speed and position and a timer control.
>
>But basically the DoMove() method just changes the LEFT property of the container that should be moved.
>
>The nice thing of my mover is that when you move too far by swiping with the finger in a fast movement, the container moves back into the proper position smoothly like it does on the smart phone when you scroll through an address list. But the classes have some dependencies so I cannot just copy them as they are. But if you like I can try to extract the necessary code and build a library and give you some sample code.
>
>Besides that I also have a scrollbar that can be placed on the form.
>
>
>LPARAMETERS tnMove, tnPosition
>*
>THIS.Left = THIS.Left + tnMove
>*
>RETURN .T.
>
Christian, thanks for the offer. No current need though and I basically understand what it should do.

Perhaps 'touch' should become a VFPX project. :)
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Reply
Map
View

Click here to load this message in the networking platform