tim@hoptoad.uucp (Tim Maroney) (12/06/88)
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
gnu@hoptoad.uucp (John Gilmore) (12/06/88)
tim@hoptoad.uucp (Tim Maroney) wrote (talking about dimmed menu items): > 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. I find this one of the worst aspects of the Mac user interface. I can see that you might want to keep things in the list, even though they can't be done right now, so that the size and position of the following items will not change all the time. But this way of handling selection makes it hard or impossible for the user to do things that are easy in a traditional command-based user interface. In most cases when I want to deal with a dimmed item, I want to select it to get something done (e.g. read in a new file) but there is something I have to do first before it will let me do it (e.g. write out the one I already have). In a command based interface I would command it to read in the new file and would get an error message, e.g. "Can't read a new file until you save or dispose of the old one". In a dimmed-menu interface where you can't select the dimmed items, there is no way to find out what it wants me to do before it will "let me" command it to take the action I want done. The solution is simple; you let dimmed items be selected, and if one is selected, you print an error message (display an alert, whatever the Mac calls it) that says what the problem is. Write these messages from the point of view that you are a human who desperately wants to make the computer do the thing that they selected, e.g. they picked this menu item for a reason! Tell them what they need to know about how to do it; don't tell them "you selected a dimmed menu item idiot", tell them "you can't load a file because first you need to quit out of the one you are in -- use the Quit or Save or Save As menu item". -- John Gilmore {sun,pacbell,uunet,pyramid,amdahl}!hoptoad!gnu gnu@toad.com "The network *is* the confuser."