Re: Challenge: Build a Color-Coded Log Viewer for Phix/Euphoria (Inspired by chat.exw)
- Posted by petelomax in June
- 1005 views
Sadly, you can't have it yet, but when(/if) I release 1.0.6 that will be ridiculously dirt-simple.
Here's an existing (non-runnable-by-you-lot) demo that shows three lines, middle one in red italic:
-- demo\theGUI\gList.exw include theGUI.e sequence data = {"one",{{"too",TG_RED,TG_ITALIC}},"three"} integer maxlen = largest(apply(data,length),return_index:=true) function get_data(integer idx) if idx=0 then return length(data) end if if idx=-1 then return maxlen end if return data[idx] end function gdx list = gList(get_data,`FONT="Consolas, 12"`), dlg = gDialog(list,"gList",`SIZE=240x80`) gSetAttribute(list,"BGCLR",TG_LIGHT_PARCHMENT) gShow(dlg) gMainLoop()
The ",TG_ITALIC" can just be deleted, and the "TG_RED" replaced with "{TG_RED,TG_BLUE}" (or hex codes) to specify both foreground and background colours.
There is a not-yet-implemented SHOWLINE(/LASTLINE) attribute it would need, unless you'd accept last-first order or most recent messages not being visible.
Otherwise all it would need is to append data with new messages, each with whatever [multi-fragment] colouring it wants, bump maxlen if rqd, and a gRedraw() call.
I've been working on this for quite a while now, and it's getting there, but it's certainly been a good old fashioned slog, and the finishing line is still "maybe this year"...
PS I meant the GUI part would be trivial, I wasn't thinking about the TCP/IP part.

