CLIM mail archive

[Prev][Next][Index][Thread]

Changing the ink used for text locally and cleanly



    Date: Tue, 12 Oct 1993 15:14 EDT
    From: Kenneth Forbus <forbus@aristotle.ils.nwu.edu>

    I've been scratching my head with the manual for some time now, and I
    just haven't been able to figure out any good way to do this.  Let me
    be clear about what I'm trying to do.

    CONTEXT: The interface in question has several screens, one of which
    is in essence a large table.  Some entries in this table were
    specified via user input.  Other entries were computed on the basis of
    user input.  Some entries are flat contradictory.  Which entries are
    in which category changes dynamically, as a consequence of user
    actions.

    PROBLEM: I would like to use colors to make it easy for users to distingish
    which entries are which.  (Say green for things they can change, blue for
    consequences, red for contradictions.)  Right now the only way they can tell
    is to either remember or to click on an entry, to see if they are offered
    the option of changing it, which of course is unsatisfactory.

    SIMPLIFICATION: I'm not using incremental redisplay at all, just
    recomputing the table after each interaction.  Fine on workstations,
    painful on Macs, but good enough for right now.

No problem, incremental redisplay shouldn't make any difference.

    COMPLICATION: The table is generated using a text-generation system
    that is cleverly designed to produce either textual reports (e.g., for
    students preparing homework answers) or hypertext (e.g., students
    trying to figure out what went wrong).  Using a single text generator
    for both purposes means I can't just rewrite everything to
    CLIM:DRAW-TEXT, because I end up using FORMAT everywhere.

    What I'd really like to do is something like this:

    (with-ink (if (contradictory? fact) *danger-ink*
                  (if (derived? fact) *derived-ink*
                                      *user-ink*))
      (textify <some complicated expression>))

    so that any text output via FORMAT in the body of the WITH-INK has the
    appropriate color, irregardless of the settings of the pane it is
    being written to.  (The text generator is clever about whether material
    is being output as text or hypertext already, in the latter case producing
    presentations, for instance.)

    If methods for how to do this are in the docs, I'd love to hear about
    it because it's such an obvious capability and I can't find it.
    Otherwise, has anyone written something like WITH-INK, or knows why
    this is something that clim 1.1 can't be made to do easily?  Ideally,
    I'd like to get this running before a demo next Monday (sigh!).

Where <s> is the output stream, do this:

  (with-drawing-options
      (:stream <s> :ink (if (contradictory? fact) *danger-ink*
			    (if (derived? fact) *derived-ink*
				*user-ink*)))
    (textify <some complicated expression> <s>))

I'm curious as to how you failed to find this in the CLIM documentation.
Did you just miss it, or is there something seriously missing from the
documentation?  I can perfectly well believe that the organization of
the documentation simply hid this from you.

References:

Main Index | Thread Index