[comp.sys.mac.programmer] Aarrrgggghhhhh...

leipold@eplrx7.uucp (Walt Leipold) (01/24/91)

An application I'm developing needs a window with two vertically-scrolling
4-column lists of values.  The user can alter values in either array of data,
use a couple of check boxes to set some options, and then hit a button to
process the data in the arrays. It sounds simple, but...

1) I can use the List Manager to display the arrays of text.  Heck, anybody
can use the List Manager to display arrays of text.  But I can't find an
easy way to make that text editable.  I assign a TERec to the most recently
selected cell's rectangle (with due attention to the cell's indent), put the
cell's data in the TERec, turn off list updates, update the cell entry on
every TEKey, and try to handle tabs, filter out returns, do TEIdle at the
right time, handle TEActivate, TEDeactivate, TEUpdate, LUpdate, LActivate,
etc -- and it's clear that I'm missing something, because it still doesn't
behave properly. There has to be an easier way, but I haven't found it.  Any
ideas?

2) The List Manager doesn't let me have columns with differing widths. This
is no problem, because I can define several one-column lists and send them
LScroll messages from a common scrollbar, right?  Wrong! Each individual
list feels free to scroll itself during LClick() whenever the user moves the
mouse out of the list's rView, and I can't find any way to turn this behavior
off.  My latest try at an lClikLoop was...

    static pascal Boolean myClick(void)
    {
        Point p;
    
        GetMouse(&p);
        if (PtInRect(p,&(**curList).rView))
            return true;
        return false;
    }

but it didn't stop the autoscrolling.  I figure I can get around this by
installing an lClikLoop in each list that explicitly scrolls every other
list that belongs to the scrollbar, but this seems kinda clumsy, y'know?

3) I checked out ModalList.c, a Dialog/List Manager sample application from
MacDTS.  It turns out that they finesse the whole question, by moving the
selected cell's text to a separate field for editing.  (Maybe I'm not the
only one who thinks this is hard :-).

Does anybody have any simple and/or elegant way to get TextEdit and the List
Manager working together?  Please?

(Oh, BTW, I'm using plain vanilla Think C.  I can't use TCL or MacApp because
this app must also run on Unix boxes under ROMlib, and the Unix boxes have
neither MacApp, TCL, nor Think's peculiar brand of C++.)

-----------------------------------------------------------------------------
"If you want to read about love and marriage,                    Walt Leipold
you've got to buy two separate books."             (leipolw%esvax@dupont.com)
-----------------------------------------------------------------------------
--
The UUCP Mailer

scott@wam.umd.edu (John Lynwood Scott) (01/24/91)

In article <1991Jan23.182229.5145@eplrx7.uucp> leipold@eplrx7.uucp (Walt Leipold) writes:
>
>1) I can use the List Manager to display the arrays of text.  Heck, anybody
>can use the List Manager to display arrays of text.  But I can't find an
>easy way to make that text editable.  I assign a TERec to the most recently
>selected cell's rectangle (with due attention to the cell's indent), put the
>cell's data in the TERec, turn off list updates, update the cell entry on
>every TEKey, and try to handle tabs, filter out returns, do TEIdle at the
>right time, handle TEActivate, TEDeactivate, TEUpdate, LUpdate, LActivate,
>etc -- and it's clear that I'm missing something, because it still doesn't
>behave properly. There has to be an easier way, but I haven't found it.  Any
>ideas?
>
>3) I checked out ModalList.c, a Dialog/List Manager sample application from
>MacDTS.  It turns out that they finesse the whole question, by moving the
>selected cell's text to a separate field for editing.  (Maybe I'm not the
>only one who thinks this is hard :-).
>
>Does anybody have any simple and/or elegant way to get TextEdit and the List
>Manager working together?  Please?
>
>(Oh, BTW, I'm using plain vanilla Think C.  I can't use TCL or MacApp because
>this app must also run on Unix boxes under ROMlib, and the Unix boxes have
>neither MacApp, TCL, nor Think's peculiar brand of C++.)
>

I am sorry to post this to the net, but I cannot seem to get mail through
to Walt.

Walt,

	Much as I hate to be the bearer of bad news...  Well, I refer you
to Tech Note 203, "Don't Abuse The Managers".  The tech note goes to great
length to tell us that the List Manager is not meant to be used as a
spreadsheet.  Sounds like you would be in for a lot less frustration if
you did not use the List Manager.  On the other hand, if you've got working
using the TextEdit methods you describe, hey, go with it.

	I wonder if I could ask you a favor (which I hate to do--it isn't
much fun to see a reply to a posting only to find not an answer to your
problem but a request for something else--sorry).  I assume that ROMlib is
a UNIX library that allows one to write Macintosh applications that are
portable to UNIX.  That would be fantastic if it is true!  Can you tell me
if this is the case and, if it is, where I can get the ROMlib?   A million
thanks.

	Since this is posted to the net, anybody out there who can help me?
Thanks in advance for any info.

		John Scott
		Macintosh Programmer
		Dahlgren Library
		Medical Center
		Georgetown University
		scottj@gumedlib.georgetown.edu