1. Strange behavior with listivews and popups
- Posted by Jonas Temple <jtemple at yhti.net> Apr 04, 2003
- 386 views
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 )
2. Re: Strange behavior with listivews and popups
- Posted by Derek Parnell <ddparnell at bigpond.com> Apr 06, 2003
- 383 views
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! >