Xref: utzoo comp.sys.mac:23660 comp.sys.mac.programmer:3410 Path: utzoo!utgpu!watmath!clyde!att!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac,comp.sys.mac.programmer Subject: Re: List Items Handling... Message-ID: <6000@hoptoad.uucp> Date: 6 Dec 88 05:35:26 GMT References: <7743@orstcs.CS.ORST.EDU> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 41 In article <7743@orstcs.CS.ORST.EDU> jagan@mist.UUCP (Jagannath N Raghu) writes: >I have a problem in dimming the list items once they are selected >by the user. Is there a way to make the text "gray" or dimmed >and disable it inside the List? I am sure it's pretty standard as >most of SFGetfile and SFPutfile dialogs "know" how to do it as they >display filenames in gray or inverted. But the List Manager was apparently split off from Standard File shortly before the HFS Standard File introduced dimming, so there's no built-in way to do this. Basically, what you do is write your own LDEF and handle the disabling when you draw cells. The actual code isn't too hard, but there are some tricky issues concerning the selection of disabled cells. In your LDEF, when you find you're drawing a disabled cell, do this: GetIndPattern(pattern, 0, 4); PenMode(patBic); PenPat(pattern); PaintRect(r); /* where r is a pointer to the cell rect */ Do it after you draw the cell data. Be sure to frame it in GetPenState and SetPenState calls. Obviously, there are a number of ways to say the same thing on the Mac; I have a prejudice against QuickDraw globals so I always use GetIndPattern. There are a few different ways to deal with the selection issue. The best way is probably never to allow a disabled cell to be selected. In the LDEF, don't draw a disabled cell as selected (inverted) even if the select parameter is TRUE or you get message 2. After LClick, or any other way of selecting you may allow (such as arrow keys) check to see if a selected cell is disabled, and immediately unselect it if it is. (For arrow keys, you might want to unselect it and select the next or previous enabled cell instead.) I leave it up to you how to decide if a cell is or is not enabled.... -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "There are no Famous People on the net. Only some of us with bigger mouths than others." -- Dan'l Danehy-Oakes, The Roach