Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!evax!hill From: hill@evax.arl.utexas.edu (Col. Ames and Pixel) Newsgroups: comp.os.os2.programmer Subject: Re: HELP!!! OWNERDRAW hItem Message-ID: <1990Sep1.201044.9743@evax.arl.utexas.edu> Date: 1 Sep 90 20:10:44 GMT References: <1990Aug2.135426.23195@arnor.uucp> <953@metapyr.UUCP> <33584.26dfbad5@vaxb.acs.unt.edu> Organization: Computer Science Engineering Univ. of Texas at Arlington Lines: 60 HAHAHAHAHAHA!!! A OS/2 question I can answer. I played for many moons with OWNERDRAW. Currently I am not at my friends OS/2 box so I can look at the code. All of this is from memory. First: You need to send a LM_SETITEMHEIGHT to the LB to set the height of your text (I use lEmHeight in the FONTMETRICS structure) When you send text to a LB the iItem is the way to get at THAT piece of text. Send a LM_QUERYITEMTEXT using the iItem you get out of the OWNERITEM structure to the list box to get the text (That wasn't rendered b'cause of the LS_OWNERDRAW attribute) that the LM_DRAWITEM sends you. Next set up the fonts in the Presentation Space. Clear the PS then use the rclItem.x and .y in a GpiCharStringAt() to place the text. REMEMBER!!!!!! 1) You have to deal with a WM_INITDLG when there is nothing in the box. 2) You have to deal with the fsState and fsStateOld flags. a) One condidtion means DRAWME. b) One means HILITE me. c) One means UNHILITE me e) SET the flag to let the system know you HAVE done the "right thing". If you dont the system will do it for you and the LB will redraw itself a few times. (This is annoying during developement) 3) You will violate the 1/10 of sec rule, if you dont spawn a thread (At LEAST when you get a WM_INITDLG.) A few gotchas: 1) FATTR_HILITE (or what ever it is ) doesn't seem to work. Use GpiSetColor and GpiSetBackColor before you clear the PS. 2) Until you implement ALL fsState/fsStateOld logic, the system will redraw the list box in its own way, thus selecting and unselecting will be ugly. I hope this helps. I used it to do multi-column justified text in a LB. LB's dont have settable fonts and don't KNOW tabs (Hint to the OS/2 developement people at IBM.) I will post source when I get a chance to, but there is NO OS/2 term prg that will work with EMACS (If you know of a free/share one let me know) adam hill ... -- *************************************************************************** adam hill Some Words Of .wisdom: