RE: Using tab controls, program crashes on Win98. Film at 11.
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> Apr 27, 2001
- 532 views
> -----Original Message----- > From: Jonas Temple [mailto:jktemple at yhti.net] > Just got back around to applying this patch and I can't > figure out where > it goes into SubProc in Win32Lib. Could you maybe include the entire > SubProc function with the changes needed? Thanks a bunch! Here's the entirety of SubProc in my copy of Win32Lib (with formatting slightly mangled by email). I've highlighted the new stuff... -- begin code function SubProc( atom hWnd, atom iMsg, atom wParam, atom lParam ) - -- callback routine to handle Window class -- This routine processes messages sent by Windows integer id , lHandledEvent object result -- find the control id = getId( hWnd ) -- not one of mine? if id = 0 then -- default processing return True end if -- user can process events that Win32Lib doesn't have handlers for. if onEvent[ id ] >= 0 or onEvent[Screen] >= 0 or window_eventhandler[id][w32HEvent] >= 0 or window_eventhandler[Screen][w32HEvent] >= 0 then pushSelf( id ) -- save the id for getSelf() invokeHandler(id, w32HEvent, {iMsg, wParam, lParam} ) if sequence(myReturn[length(myReturn)]) then -- user supplied a return code, so return to Windows return popSelf() else VOID = popSelf() end if end if lHandledEvent = find(iMsg, vEventsHandled) if lHandledEvent = 0 then -- default processing return w32Func( xCallWindowProc, { window_func[id], hWnd, iMsg, wParam, lParam } ) end if -- save the id for getSelf() pushSelf( id ) if vHandler[ lHandledEvent ] >= 0 then result = call_func(vHandler[ lHandledEvent ], {id, hWnd, iMsg, wParam, lParam, kWinDefProc}) if result[1] = kWinDefProc then if length(result) = 2 then -- the handler has altered the input parameters hWnd = result[2][1] iMsg = result[2][2] wParam = result[2][3] lParam = result[2][4] end if -- **************************************************************** -- HERE'S THE NEW CODE: if window_type[id] = TabControl and iMsg = WM_NOTIFY then VOID = fetch( lParam, NMHDR_code ) if VOID = LVN_DELETEALLITEMS then return popSelf() end if end if -- THAT'S IT -- **************************************************************** returnValue( w32Func( xCallWindowProc, { window_func[id], hWnd, iMsg, wParam, lParam } )) end if end if return popSelf() end function -- end code Matt Lewis