|
|
I have definately tried those techniques. (i.e. Swallowing the preview and low level mouse hook)
Here is the thing.
Yes,
- I can prevent a click event from occurring in my app by blocking on the preview.
- I can also get the mouse cursor to return to its previewous location on touchup using the low level mouse hook (although I do have to move my mouse to get it to reappear)
But between touchdown and touchup and during touchmove, the cursor turns into a tiny circle under my finger. Which I can try and fight by moving the cursor, but it is a losing battle, I am going against the grain. It almost seems like it is at the OS level rather than my app.
So this link helps but hasn't solved the problem for me. I need to truly decouple touch from not just click events, but the cursor location/pointer shape.
|
|
|
|
|
System.Windows.Input.Mouse.OverrideCursor = Cursors.None;
Set up a mechanism where you "swap cursors" (None and "something") depending on your "trackball mode".
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Just tried that. No luck.
I even have it in a rapid dispatertimer event handler.
Call
System.Windows.Input.Mouse.OverrideCursor = Cursors.Cross;
repeatedly between touchdown and touchup.
No impact.
|
|
|
|
|
I use Cursors.None to "hide" the cursor (and the previous one when swapping back).
What are you using?
(You just keep setting it to a "Cross" ?!)
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Good Question.
------
During this experiment I set
System.Windows.Input.Mouse.OverrideCursor = Cursors.None;
On TouchUp.
------
But here is the thing I don't specifically want to overide the cursor.
I want it to be whatever it is for the screen location.
But touch seems to be changing my screen location.
In other words I want the cursor to be independent of touch for my touchpad.
So for example if the cursor is in the upper left hand corner of the
screen over another app and It is an IBeam or whatever.
ANd my touchpad is in the lower right.
If the user touches my touchpad,
I want the cursor to stay in the upper left, exactly where it is.
But what happens is that the cursor moves to the point of touch.
And, no It doesn't result in a click event (I have taken care of that), but it moves
and the cursor also changes to a tiny circle.
I want it to stay where it was and retain whatever natural pointer it had.
So I really to tease apart
a) Cursor Location
b) Natural Cursor Pointer
From touch, but
they seem inexorably bound together at the OS level.
Your insight is helpful.
Just a tough low level problem it would seem.
BTW > If I multi-touch. The cursor is unaffected.
-----
JES
|
|
|
|
|
Hide the cursor and just put an "icon" (tiny window / control / whatever with an image, for example) where it used to be / should be (serves as a "memory" too).
Smoke and mirrors.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Definately an approach I have tought of.
Technically very doable.
The first problem is making the graphic dynamic to
reflect the desired cursor at that point on thse screen.
Then I think of emulating scenarios like drag, resize etc
without controlling the real cursor location and
I get a bit scared.
----
JES
|
|
|
|
|
What's hard about making an image "dynamic"? You just change the image source.
And you're also now suffering from scope creep: "emulating scenarios" is a far cry from keeping the "mouse in one place".
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
YOu are righ changing the cursor icon is not difficult.
Having said that, knowing what to change it to for a given
screen location mya be easy, I cant find how to do that.
In terms of scope creep, my sense is that these are
pretty fundamental req's
The primary intent of the "Virtual TrackPad"
is to do everything I can do with the "Physical TrackPad"
on my laptop.
YOu may as why I would want to do that...
Good question.
Well I have a table top touch screen console
in a meeting room and I need to interact
with the "the big screen" without having to either
a) go up and touch it or b) use a physical keyoborad and
mouse. Both Monitors are plugged into same PC.
----
JES
|
|
|
|
|
I have two monitors hooked up to my PC. Occasionally, I'll hookup my (old) XVGA projector.
I have no problems interacting with any of the "screens".
I hate track balls; I plug an extra mouse into my laptop.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Thanks for that insight Gary.
|
|
|
|
|
Glad we finally got to the actual requirements
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
|
2 monitors.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
|
Our web server is on UTC. I want to display the server's current time on a web page, but converted to our office's local time, which is Central Time. Since UTC doesn't observe DST but our local time does, I can't just do
DateTime utcNow = DateTime.Now.AddHours(-6); since during DST it should be AddHours(-5).
Setting the server's time forward to May, I've tried using the following code to determine if the date as CTS is in DST:
DateTime utcNow = DateTime.UtcNow;
TimeZoneInfo csttzi = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
DateTime cstTime = TimeZoneInfo.ConvertTime(utcNow, csttzi);
Label1.Text = String.Format("IsDaylightSavingTime: {0}", cstTime.IsDaylightSavingTime().ToString()
But it returns False. Why? How can I determine if a time zone is currently in DST or not?
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
TNCaver wrote: But it returns False. Why?
Um ... because Daylight Savings Time doesn't start until the 12th March this year?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
He did say that he'd moved the server date to May.
This space for rent
|
|
|
|
|
I suspect it moved it back!
Try this:
DateTime then = new DateTime(2017, 6, 14, 8, 31, 45);
DateTime utcTime = then.ToUniversalTime();
TimeZoneInfo csttzi = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
DateTime cstTime = TimeZoneInfo.ConvertTime(utcTime, csttzi);
string text = String.Format("IsDaylightSavingTime: {0}", cstTime.IsDaylightSavingTime().ToString());
string officeTime = TimeZoneInfo.ConvertTime(utcTime, csttzi).ToString();
text is "IsDaylightSavingTime: True"
And officeTime is "14/06/2017 02:31:45"
Which is about right given I'm on GMT.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: I suspect it moved it back! It never did! I was looking at the server's clock the whole time, gov'na. Honest!
OriginalGriff wrote: Try this: Odd. Very odd. Your code gives me this:
IsDaylightSavingTime: False
Office Time: 6/14/2017 3:31:45 AM
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
As Gerry pointed out below, the DateTime.IsDaylightSavingTime method[^] relies on the local time zone. It has no knowledge of the TimeZoneInfo you used to change the offset.
If your server is set to UTC with no DST changes, then this method will never return true .
Use the TimeZoneInfo.IsDaylightSavingTime method[^] instead, and the result will depend on the chosen TimeZoneInfo .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I think your DST test plays off static TimeZoneInfo.Local; which always points to the host computer's time zone.
You can determine a "delta" hour for your "AddHours" though:
TimeZoneInfo.GetAdjustmentRules Method (System)
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
You're probably right. It was showing Kind = Unspecified, so it wasn't obvious that this was the case.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
How about:
Label1.Text = string.Format("IsDaylightSavingTime: {0}", csttzi.IsDaylightSavingTime(cstTime));
That will use the specified time zone, rather than the local system time zone.
You might also want to look at using DateTimeOffset[^], which is slightly better for time zone handling than a raw DateTime .
Or, if you want to be really safe, use Noda Time[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|