RE: OwnerDrawn Controls with Win32lib?
- Posted by Derek Parnell <Derek.Parnell at SYD.RABOBANK.COM> Jun 02, 2002
- 389 views
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C20AAB.0AF1A850 charset=iso-8859-1 Isn't it the control's parent that receives that message and not the control itself? Here is code (that does not use subclassing) to test the effect you are after. --------------------- without warning include win32lib.ew -- Window Test global constant Test = create( Window, "List Sync", 0, Default, Default,333, 230, 0 ) , SB = createEx(StatusBar, "", Test, 0, 0, 0, 0, 0, 0), List1 = create( List, "List1", Test, 8, 12, 192, 172, or_all({WS_CHILD,WS_TABSTOP,LBS_OWNERDRAWFIXED,LBS_HASSTRINGS,LBS_NOTIFY}) ) constant WM_DRAWITEM = 43 procedure Test_WndProc( atom self, integer event, sequence parms ) sequence msg if parms[1] = WM_DRAWITEM then if self = List1 then msg = "The list got it." else msg = "The main window got it." end if setText(SB, sprintf("%s: wParam:%d lParam:%d ", {msg, parms[2], parms[3]})) end if end procedure setHandler({List1,Test}, w32HEvent, routine_id("Test_WndProc")) -- Display window WinMain( Test, Normal ) --------------------- > -----Original Message----- > From: euman at bellsouth.net [mailto:euman at bellsouth.net] > Sent: Monday, 3 June 2002 12:11 > To: EUforum > Subject: OwnerDrawn Controls with Win32lib? > > > > Hello all, > > I was wondering why Ownerdrawing controls doesnt work with Win32lib. > I never get a WM_DRAWITEM for my subclassed listbox. > (works great when I use only API) > > here's the code! Euman > > without warning > with trace > > integer oldwndproc, void > > -- Window Test > global constant > Test = create( Window, "List Sync", 0, Default, Default,333, 230, 0 ) > ,List1 = create( List, "List1", Test, 8, 12, 192, 172, > or_all({WS_CHILD,WS_TABSTOP,LBS_OWNERDRAWFIXED,LBS_HASSTRINGS, > LBS_NOTIFY}) ) > > constant WM_DRAWITEM = 43 > > function Test_WndProc( atom hWnd, atom iMsg, atom wParam, > atom lParam ) > integer pos, ret > if iMsg = WM_DRAWITEM then > trace(1) > end if > -- return value from default list box procedure > return w32Func( xCallWindowProc, { oldwndproc, hWnd, iMsg, > wParam, lParam } ) > end function > > -- Subclass the list boxes > oldwndproc = w32Func( xSetWindowLong, > {getHandle(List1),GWL_WndProc,call_back(routine_id("Test_WndProc"))} ) > > -- Display window > WinMain( Test, Normal ) > > > > > ================================================================== ================================================================== ------_=_NextPart_000_01C20AAB.0AF1A850 Content-Type: application/ms-tnef