Viewer color

Moderators: TomKerekes, dynomotion

Tarasevih
Posts: 101
Joined: Fri Jul 09, 2021 11:26 am

Re: Viewer color

Post by Tarasevih » Wed Jun 22, 2022 4:22 pm

Hi Tom.
With a mouse, everything is clear, thank you. I thought the view rotation button should work but it doesn't.
Touch input needs such a button.
Attachments
Button.png

Tarasevih
Posts: 101
Joined: Fri Jul 09, 2021 11:26 am

Re: Viewer color

Post by Tarasevih » Wed Jun 22, 2022 4:44 pm

Sorry, I figured out how this button works.
Everything works for mouse input. But you need to add an input mode button for the touch monitor
How can I add this button ?

Regards,
Taras.

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Viewer color

Post by TomKerekes » Wed Jun 22, 2022 5:52 pm

I suppose you could alter the behavior so that whenever the xy Rotation button is down then the Left mouse does normal rotation (instead of translation) and the right mouse does xy rotation (instead of zoom). See the function

void COpenglCtl::OnMouseMove(UINT nFlags, CPoint point)

and related flags:

m_LeftButtonDown
m_RightButtonDown
m_xyRotation (Tool bar button state)

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

Tarasevih
Posts: 101
Joined: Fri Jul 09, 2021 11:26 am

Re: Viewer color

Post by Tarasevih » Thu Jun 23, 2022 7:19 am

Thank you Tom!
I redid it the way I need it.
// Both : rotation
if(m_LeftButtonDown && m_xyRotation) //&& m_RightButtonDown)m_LeftButtonDown
{
//if(!m_xyRotation)
//{
m_yRotation -= (float)(m_LeftDownPos.x - point.x) * m_SpeedRotation * TimeFactor;
m_xRotation -= (float)(m_LeftDownPos.y - point.y) * m_SpeedRotation * TimeFactor;
//}
//else
//{
//m_zRotation -= (float)(m_LeftDownPos.x - point.x) * m_SpeedRotation * TimeFactor;
//}
m_LeftDownPos = point;
m_RightDownPos = point;
InvalidateRect(NULL,FALSE);
}
Now if the button is not pressed, then we move; if it is pressed, we rotate.
This will be more convenient for touch input.
I have one more question. The jog buttons work fine for me only when I double-click. Where can I look in the code to fix this ?

Regards,
Taras.

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Viewer color

Post by TomKerekes » Thu Jun 23, 2022 7:10 pm

Hi Taras,

I'm not sure. Did you mean double touch?

The Jog buttons are handled in the CMotionButton class. The Windows message ON_WM_LBUTTONDOWN calls

Code: Select all

void CMotionButton::OnLButtonDown(UINT nFlags, CPoint point)
{
	ForceDisableFocus=false;
	if (HandleButtonDown()) return;
	CButton::OnLButtonDown(nFlags, point);
}

to do the motion. Apparently on your touch screen a single touch doesn't generate this message. Maybe it is treated as a click (or Activate) rather than a left mouse down.

You might try adding one of the Microsoft Windows messages described here. Maybe: ON_WM_MOUSEACTIVATE() ?
Regards,

Tom Kerekes
Dynomotion, Inc.

Tarasevih
Posts: 101
Joined: Fri Jul 09, 2021 11:26 am

Re: Viewer color

Post by Tarasevih » Fri Jun 24, 2022 7:36 pm

Thank you Tom!
Tried to listen ON_WM_MOUSEHOVER().
It worked, but I wasn't happy with the result.

MotionButton.h
afx_msg void OnMouseHover(UINT nFlags, CPoint point);

MotionButton.cpp
BEGIN_MESSAGE_MAP(CMotionButton, CImageButton)
ON_WM_TIMER()
ON_WM_MOUSEMOVE()
ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)
//ON_MESSAGE(WM_MOUSEHOVER, OnMouseHover)
ON_WM_MOUSEHOVER()
ON_WM_KILLFOCUS()
ON_WM_CAPTURECHANGED()
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()

void CMotionButton::OnMouseHover(UINT nFlags, CPoint point)
{
ForceDisableFocus = false;
if (HandleButtonDown()) return;
CButton::OnMouseHover(nFlags, point);
}
Maybe there are messages from touches for their processing?
The touch input response is weird.
At the first touch, the movement value changes slightly and immediately stops, and only after a double touch does the axis begin to move without stopping.
Where can I see touch input messages like this? - https://docs.microsoft.com/en-us/cpp/mf ... w=msvc-170
I can post a video of the behavior of the pane.

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Viewer color

Post by TomKerekes » Fri Jun 24, 2022 10:05 pm

Where can I see touch input messages like this? - https://docs.microsoft.com/en-us/cpp/mf ... w=msvc-170
I don't know you might Google for it.

There is a Visual Studio Tool Under Tools Called Spy++ that "spies" on Window messages. You can Select Spy | Log messages

Then drag the finder tool to one of the motion buttons. All Windows messages related to that button should then be logged. Then "touch" the button and see what messages are sent and consider if any might be useful.
Regards,

Tom Kerekes
Dynomotion, Inc.

Tarasevih
Posts: 101
Joined: Fri Jul 09, 2021 11:26 am

Re: Viewer color

Post by Tarasevih » Sun Jun 26, 2022 9:09 am

Hi Tom.
(Spy++) I think it will help me figure out the problem.
I figured out how to work with it on my work computer. Is it possible to install it on my touchpad without the visual studio package?
If not, then you will have to install the studio to check messages from touch input.
Thank you Tom! You are my guide to the world of C++.

Regards,
Taras.

Tarasevih
Posts: 101
Joined: Fri Jul 09, 2021 11:26 am

Re: Viewer color

Post by Tarasevih » Sun Jun 26, 2022 9:18 am

I also have a suggestion to rename the post to a touch screen KMotionCNC .

Regards,
Taras.

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Viewer color

Post by TomKerekes » Mon Jun 27, 2022 4:06 pm

I don't think there is an easy way to change the name of a Thread. You might start a new Thread and include a link to this Thread.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply