TXT field dates problem

Shao Sean shaosean at unitz.ca
Fri Aug 30 03:55:01 EDT 2002

> So how ie 2 days old messages can be changed black and todays messages
remain red? Is that possible to do in same text field?

on addMessage pDateItems, pMessageToAdd
  local todaysDateItems
  lock screen
  convert the seconds to dateItems
  put it into todaysDateItems
  put pMessageToAdd & LINEFEED before field "newMessages"
  if ((item 1 of pDateItems = item 1 of todaysDateItems) AND \
      (item 2 of pDateItems = item 2 of todaysDateItems) AND \
      (item 3 of pDateItems = item 3 of todaysDateItems)) then
    -- it's today (item 1 = year, item 2 = month, item 3 = date)
    select char 1 to (the number of chars in pMessageToAdd) of field
    set the foregroundColor of the selectedChunk to "red"
  end if
end addMessage

there ya go.. nicely wrapped into a handler for you ;-).. any questions,
feel free to ask (i'm gonna be up for another 10mins then beddy-bye time)

More information about the use-livecode mailing list