oohg / core

Files needed to build and use OOHG's libraries
https://oohg.github.io
GNU General Public License v2.0
8 stars 11 forks source link

ONMOUSEMOVE event does not update mouse position #397

Closed nchristophi closed 3 years ago

nchristophi commented 3 years ago

Dear sir,

If I enable onmousemove event on any control when I move over that control even though the event is triggered the mouse position is not updated. The mouse position is only updated when moving over the window. Further more if inside the onmousemove function I update the text of label which has the autosize flag enabled the onmousemove is continuesly triggered.

I am using the sources I downloaded on 23/05/2021 from github. Last change is 2021-05-19 15:25 UTC-0300 Fernando Yurisich fyurisich@oohg.org

Thanks Nikos Christophi

fyurisich commented 3 years ago

Hi, Nikos:

Can you please post a small .prg file that shows the problem so I can replicate the issue.

Thanks Fernando

nchristophi commented 3 years ago

include "oohg.ch"

PROCEDURE MAIN()

DEFINE WINDOW Form_1 ; AT 0,0 ; WIDTH 800 ; HEIGHT 600 ; TITLE 'OnMouseMove' ; MAIN ; ICON "APPICON"; on mousemove form1_mousemove()

@ 100,100 label label1 obj label1 parent form_1 value "TEST" TRANSPARENT on mousemove form1_mousemove() @ 0,0 LABEL label2 obj label2 parent form_1 value "asasasasasasasa" autosize

END WINDOW

CENTER WINDOW Form_1 ACTIVATE WINDOW Form_1

RETURN

function form1_mousemove() static i:=1 label2:Value := "Form - Row " + hb_ntos(_OOHG_MouseRow) +; " Col " + hb_ntos(_OOHG_MouseCol) + " Count " + hb_ntos(i) i++
RETURN

This code replcates both issues. when you move over label1 you will see that the mouse position is not updated. and when you hover the mouse anywhre on the window you will see that the count is increased.

nchristophi commented 3 years ago

I have modified h_controlmisc.prg at line 2098 added
_OOHG_SetMouseCoords( pSelf, LOWORD( lParam ), HIWORD( lParam ) ); to fix the mouse position update.

For the other bug I commented the line 221 in h_label.prg which call the setwindowpos function. I cound not figure out why that call is needed.

fyurisich commented 3 years ago

Thanks for the information. I confirmed the issues and the suggested solutions. Fixes were uploaded. See 3f9d66a9436085b7bb168a7d7836b954047fffa7 and 851899d5eab4cc6e648ebab6010a2610ace63320

nchristophi commented 3 years ago

Thanks for the quick response.

I think i have another bug with onmousemove events. this one is about frames. If add a frame then then onmousemove events are triggered by the parent window onmousemove function. But if I add a tooltip to the frame then the onmousemove is not triggered. Further more I discovered with the use of Spy++ that when no tooltip then WM_MOUSEMOVE is processed by the parent window. But if you have a tooltip then the WM_MOUSEMOVE message is sent to the frame windows handle. I could not find a solution for this.

Thanks Nikos

include "oohg.ch"

PROCEDURE MAIN()

DEFINE WINDOW Form_1 ; obj form_1; AT 0,0 ; WIDTH 800 ; HEIGHT 600 ; TITLE 'MouseMove Events' ; MAIN ; on mousemove form1_mousemove()

@ 0,0 LABEL label2 obj label2 parent form_1 value "asasasasasasasa" autosize

@ 30, 30 FRAME frame1 obj frame1 width 150 height 150 caption "With Tooltip" tooltip "With Tooltip" @ 30, 200 FRAME frame2 obj frame2 width 150 height 150 caption "Without Tooltip"

END WINDOW

CENTER WINDOW Form_1 ACTIVATE WINDOW Form_1

RETURN

function form1_mousemove() local x,y LOCAL obj:=_OOHG_ThisObject x=_OOHG_MouseRow y=_OOHG_MouseCol if !obj:lform x += obj:nRow y += obj:nCol endif label2:Value := obj:name+" : " + "Form - Row " + hb_ntos(x) + " Col " + hb_ntos(y) RETURN