1. Fw: Strange behavior with listivews and popups
- Posted by Derek Parnell <ddparnell at bigpond.com> Apr 05, 2003
- 343 views
Thisis a resend 'cos I don't think the first one got thru. ---------------- cheers, Derek Parnell ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: <EUforum at topica.com> Subject: Re: Strange behavior with listivews and popups > Jonas, > I have a fix for this effect. First the reason behind it... > > The popup takes focus and thus receives the Right-Mouse-Up event instead of > the ListView underneath. Now the listview knows that the mouse button was > pressed, and when it gets focus again, it notices that the mouse has moved > position while (it thinks) that the button was still down, so it draws the > dotted box. > > Anyhow, to get rid of this effect we need to tell the ListView to ignore the > initial right mouse down event. You need to do two things... > > First, in the win32lib file, find the routine fDoMouse and locate this > line... > > VOID = invokeHandler(id, w32HMouse, {iMsg, mouseX, mouseY, > getKeyMasks(wParam)}) > > add these three lines immediately after it... > > if sequence(VOID) then > lRC = {kReturnNow} > end if > > Next, in your program, add this line after the popup() has been invoked... > > returnValue(0) > > That should do it for you. > > ---------------- > cheers, > Derek Parnell > ----- Original Message ----- > From: "Jonas Temple" <jtemple at yhti.net> > To: "EUforum" <EUforum at topica.com> > Sent: Saturday, April 05, 2003 1:17 AM > Subject: Strange behavior with listivews and popups > > > > > > I've noticed that when I use popup() from a listview a dotted rectangle > > (similar to what you would see in a drag/copy operation in a word > > processor) is showing up if an item is clicked in the popup. Has anyone > > seen this or know how to fix this? > > > > I've attached a small example: > > > > -- code generated by Win32Lib IDE v0.16.0 > > > > > > include Win32Lib.ew > > without warning > > > > -------------------------------------------------------------------------- > ------ > > > > -- Window Window1 > > global constant Window1 = createEx( Window, "Window1", 0, Default, > > Default, 537, 401, 0, 0 ) > > global constant TestPM = createEx( Popup, "Test Popup", Window1, 0, 1, > > 0, 0, 0, 0 ) > > global constant TestPI = createEx( MenuItem, "Test Item", TestPM, 0, 2, > > 0, 0, 0, 0 ) > > global constant TestLV = createEx( ListView, {"Test"}, Window1, 16, 16, > > 460, 284, or_all({LVS_REPORT,LVS_SHOWSELALWAYS}), 0 ) > > atom lvMask > > integer lvOk > > lvMask = or_all({LVS_EX_FULLROWSELECT}) > > lvOk = sendMessage(TestLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) > > global constant OkayPB = createEx( PushButton, "Okay", Window1, 40, 316, > > 88, 28, 0, 0 ) > > --------------------------------------------------------- > > -------------------------------------------------------------------------- > ------ > > > > procedure TestLV_onMouse (integer self, integer event, sequence > > params)--params is ( int event, int x, int y, int shift ) > > sequence pos > > -- Right mouse button down, show the popup > > if params[1] = WM_RBUTTONDOWN then > > pos = getPointerRelPos(Window1) > > popup(TestPM, pos[1], pos[2]) > > end if > > end procedure > > setHandler( TestLV, w32HMouse, routine_id("TestLV_onMouse")) > > -------------------------------------------------------------------------- > ------ > > > > procedure OkayPB_onClick (integer self, integer event, sequence > > params)--params is () > > closeWindow(Window1) > > end procedure > > setHandler( OkayPB, w32HClick, routine_id("OkayPB_onClick")) > > > > > > WinMain( Window1,Normal ) > > > > > > > > TOPICA - Start your own email discussion group. FREE! > > >
2. Re: Fw: Strange behavior with listivews and popups
- Posted by Derek Parnell <ddparnell at bigpond.com> Apr 06, 2003
- 352 views
I agree Jonas, here is a way to do it nicely... Replace the mouse handler you had set up with this instead.... ---------------------------------------------------- function DoNM_RCLICK(integer id, atom hWnd, atom wParam, atom lParam) ---------------------------------------------------- sequence pos id = getId( fetch( lParam, NMHDR_hwndFrom ) ) if id = TestLV then pos = getPointerRelPos(Window1) popup(TestPM, pos[1], pos[2]) end if return {kReturnNow} end function VOID = setNotifyHandler( NM_RCLICK, routine_id("DoNM_RCLICK")) ---------------- cheers, Derek Parnell ----- Original Message ----- From: "Jonas Temple" <jtemple at yhti.net> To: "EUforum" <EUforum at topica.com> Sent: Sunday, April 06, 2003 3:18 PM Subject: RE: Fw: Strange behavior with listivews and popups > > Derek, > > If you're thinking about applying this to Win32Lib then hold off. I > think the problem is not in Win32Lib but rather how I used a popup with > a list view. > > I tried this in Windows explorer and what I found out was that if you > right click in a list view within Explorer the popup only appears when > the right button is release, not when pressed. In my program I was > showing the popup when the right mouse button is pressed. Actually, I > never knew that you could right click in a list view and drag to > highlight multiple items. > > Jonas > > Derek Parnell wrote: > > Thisis a resend 'cos I don't think the first one got thru. > > > > ---------------- > > cheers, > > Derek Parnell > > ----- Original Message ----- > > From: "Derek Parnell" <ddparnell at bigpond.com> > > To: <EUforum at topica.com> > > Sent: Saturday, April 05, 2003 10:10 AM > > Subject: Re: Strange behavior with listivews and popups > > > > > > > Jonas, > > > I have a fix for this effect. First the reason behind it... > > > > > > The popup takes focus and thus receives the Right-Mouse-Up event instead > > of > > > the ListView underneath. Now the listview knows that the mouse button > > > was > > > pressed, and when it gets focus again, it notices that the mouse has > > > moved > > > position while (it thinks) that the button was still down, so it draws > > > the > > > dotted box. > > > > > > Anyhow, to get rid of this effect we need to tell the ListView to ignore > > the > > > initial right mouse down event. You need to do two things... > > > > > > First, in the win32lib file, find the routine fDoMouse and locate this > > > line... > > > > > > VOID = invokeHandler(id, w32HMouse, {iMsg, mouseX, mouseY, > > > getKeyMasks(wParam)}) > > > > > > add these three lines immediately after it... > > > > > > if sequence(VOID) then > > > lRC = {kReturnNow} > > > end if > > > > > > Next, in your program, add this line after the popup() has been > > > invoked... > > > > > > returnValue(0) > > > > > > That should do it for you. > > > > > > ---------------- > > > cheers, > > > Derek Parnell > > > ----- Original Message ----- > > > From: "Jonas Temple" <jtemple at yhti.net> > > > To: "EUforum" <EUforum at topica.com> > > > Sent: Saturday, April 05, 2003 1:17 AM > > > Subject: Strange behavior with listivews and popups > > > > > > > > > > I've noticed that when I use popup() from a listview a dotted rectangle > > > > (similar to what you would see in a drag/copy operation in a word > > > > processor) is showing up if an item is clicked in the popup. Has anyone > > > > seen this or know how to fix this? > > > > > > > > I've attached a small example: > > > > > > > > -- code generated by Win32Lib IDE v0.16.0 > > > > > > > > > > > > include Win32Lib.ew > > > > without warning > > > > > > > > -------------------------------------------------------------------------- > > > > > > ------ > > > > > > > > -- Window Window1 > > > > global constant Window1 = createEx( Window, "Window1", 0, Default, > > > > Default, 537, 401, 0, 0 ) > > > > global constant TestPM = createEx( Popup, "Test Popup", Window1, 0, 1, > > > > 0, 0, 0, 0 ) > > > > global constant TestPI = createEx( MenuItem, "Test Item", TestPM, 0, 2, > > > > 0, 0, 0, 0 ) > > > > global constant TestLV = createEx( ListView, {"Test"}, Window1, 16, 16, > > > > 460, 284, or_all({LVS_REPORT,LVS_SHOWSELALWAYS}), 0 ) > > > > atom lvMask > > > > integer lvOk > > > > lvMask = or_all({LVS_EX_FULLROWSELECT}) > > > > lvOk = sendMessage(TestLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) > > > > global constant OkayPB = createEx( PushButton, "Okay", Window1, 40, 316, > > > > 88, 28, 0, 0 ) > > > > --------------------------------------------------------- > > > > > > -------------------------------------------------------------------------- > > > > > > ------ > > > > > > > > procedure TestLV_onMouse (integer self, integer event, sequence > > > > params)--params is ( int event, int x, int y, int shift ) > <snip> > > > > TOPICA - Start your own email discussion group. FREE! >