Question

I have a MFC application form as the figure:

Part Orientation

And I was wondering why the mousewheel was working on the "Base angle:" field (for controlling the spin control), but not on the "Angle" and "Range" fields. Clicking directly on the spin buttons was working perfectly.

The same was happening for the "Base angle" and "±" fields of the Nesting form:

Nesting

My hypothesis: it is happening because the fields are inside a groupbox

What I did to test it: I changed the groupbox dimensions in the teo froms, in a way that the non-working fields are not overlaping it:

Part Orientation Modified

Nesting Modified

The results: The mouse wheel began to work on the controls of the Part Orientation dialog. But in the Nesting dialog it continued to refuse to work.

Notes: The textboxes are CEdits. They DDX with CString variables. Part Orientation is a Modal Dialog. Nesting is a form inside a CMFCTabControl, inside CDialogBar, inside a CDockablePane, inside the CMainFrame(this one is derived from CFrameWndEx)

Now, my suspects: For the form Part Orientation Dialog, I suspect the groupbox is eating the mouse wheel event. For the Nesting Dialog, I suspect the DockablePane is eating the mousewheel event. Or maybe an implicit CTabbed Pane, created by the Layout of panes I've designed; or even the MainFrame.

My question is: How can I make the mousewheel work on spin button controlled textboxes that are inside groupboxes? I have many more cases of this in my App Dialogs.

Is there a way that I can make the mouse wheel movement being processed by who should do it? The same question applies to the Nesting Form controls which groupbox area has been removed and mouse wheel continued to not make the spinbutton move!

Thanks in advance, Sérgio

Was it helpful?

Solution

The first step this was to disable a little software I have here called WizMouse. The mouse wheel became to work immediatly in the spinner controlled textboxes of the Part Orientation Dialog.

To Make the others work I had to change the spinner RC definition from

UDS_ARROWKEYS

to

UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK

This made the mouse wheel move, but in undesired manner: it was stepping by one unit, moving up was decrementing, and it had an upper limit of 100!

Why? Because, I have a function for handling UDN_DELTAPOS to manipulate the offset of the spinner. It defines to step the value as a double with a delta of 5.0. And this was happening also when clicking direcly on the two spinner buttons!

In that function, all I had to do is to set *pResult to 1 instead of 0.

Now everything works fine :)

Thanks, one more time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top