Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple editboxes automatically respond to mouse wheel scrolling
#1
Hi,

My dialog box contains multiple multiline editboxes. When I use the mouse wheel in an edit box, I need to first click in the editbox , Then the text in the editbox can be scrolled
 
I need to make the editbox become the focus automatically. I found the following C++ code, and I have converted it into the QM function AutoResponseWheelScroll, but it does not work at present, which may require some programming skills

Thanks in advance for any suggestions and help
david

C++ code:
 
Code:
Copy      Help
int WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    MSG msg;
    while (GetMessage (&msg, NULL, 0, 0))
    {
        if (msg.message == WM_MOUSEWHEEL)
        {
            POINT pos;
            GetCursorPos (&pos);
            msg.hwnd = WindowFromPoint (pos);
        }
        TranslateMessage (&msg);
        DispatchMessage (&msg);
    }
}


Function AutoResponseWheelScroll
 
Code:
Copy      Help
function# hDlg

MSG msg
rep
,if(GetMessage(&msg 0 0 0)<1) break
,if(msg.message == WM_MOUSEWHEEL)
,,POINT pos
,,GetCursorPos(&pos)
,,msg.hwnd = WindowFromPoint(pos.x pos.y)
,TranslateMessage &msg
,DispatchMessage &msg

if(msg.message=WM_QUIT) PostQuitMessage(msg.wParam)


Macro Macro9
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54231044 0x200 8 8 96 48 ""
;4 Edit 0x54231044 0x200 120 8 96 48 ""
;5 Edit 0x54231044 0x200 8 64 96 48 ""
;6 Edit 0x54231044 0x200 120 64 96 48 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3 4 5 6"
str e3 e4 e5 e6
e3="1[]2[]3[]4[]5[]6[]7[]8[]9[]0"
e4="1[]2[]3[]4[]5[]6[]7[]8[]9[]0"
e5="1[]2[]3[]4[]5[]6[]7[]8[]9[]0"
e6="1[]2[]3[]4[]5[]6[]7[]8[]9[]0"

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

AutoResponseWheelScroll hDlg

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

The problem is solved. use The QM built-in function  DT_MouseWheelRedirect

QM is too powerful!!!


Code:
Copy      Help
,case WM_INITDIALOG
,DT_MouseWheelRedirect

It would be better if someone could guide me how to modify the AutoResponseWheelScroll function of I defined


Forum Jump:


Users browsing this thread: 1 Guest(s)