I'd like to be able to (on a touchscreen) scroll a checklistbox in the same way you would on Android. I imagine it is possible but do not know where to start to capture the 'mouse' movements.
Can anybody point me in the right direction?
Scroll checklistbox by dragging?
Re: Scroll checklistbox by dragging?
Have you looked into wxGestureEvent (/wxPanGestureEvent)?philjynx wrote:I imagine it is possible but do not know where to start to capture the 'mouse' movements.
I have no experience with it myself. It has been added quite recently and may not have been extensively tested, as there is not that many touch-enabled devices running wxWidgets.
But perhaps it may be worth checking out...
Re: Scroll checklistbox by dragging?
Sounds promising, I'll have a looksee. Thank you.PB wrote:Have you looked into wxGestureEvent (/wxPanGestureEvent)?philjynx wrote:I imagine it is possible but do not know where to start to capture the 'mouse' movements.
I have no experience with it myself. It has been added quite recently and may not have been extensively tested, as there is not that many touch-enabled devices running wxWidgets.
But perhaps it may be worth checking out...
Nowt coming up in my documentation, so I suspect I don't have it.
Re: Scroll checklistbox by dragging?
It has been added in 3.1.1 (last December), its use is demonstrated in the Event sample.philjynx wrote:Nowt coming up in my documentation, so I suspect I don't have it. :(
Re: Scroll checklistbox by dragging?
what I have done in the past is use the wxEVT_MOTION event, with the caveat that my system's touchscreen registers as a mouse. You may find that you need to bind the OnMotion function recursively starting with your parent container, otherwise if the drag starts on a text item, rather than the container itself, the motion may not register.
my OnMotion function looks something like
where m_pnl_item_list is a wxScrolledWindow containing the list control
my OnMotion function looks something like
Code: Select all
int32_t dy = 0;
if (event.Dragging() || event.LeftIsDown())
{
auto pos = wxGetMousePosition();
dy = (m_lastMousePos.y) - (pos.y);
if (abs(dy) > 5)
{
int cx;
int cy;
m_pnl_item_list->CalcUnscrolledPosition(0, dy, &cx, &cy);
m_pnl_item_list->Scroll(-1, cy);
m_lastMousePos = pos;
}
event.StopPropagation();
}
Re: Scroll checklistbox by dragging?
Hi,
What platform and wxWidgets version?
In our application we have a hardware which supports touch screen using the drivers (we don't have touchpads - more like a laptops).
We do run RHEL6 and there is no extra processing requires to do touch screen or scrolling.
Thank you.
What platform and wxWidgets version?
In our application we have a hardware which supports touch screen using the drivers (we don't have touchpads - more like a laptops).
We do run RHEL6 and there is no extra processing requires to do touch screen or scrolling.
Thank you.