Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

alternative to text DAT for message log

Still a little green? Ask your beginner's questions here

alternative to text DAT for message log

Postby CorbinWhite » Mon Jun 24, 2019 9:50 pm

I'm writing to a text DAT to log instant messages. Problem is that once the log becomes longer than the viewport, writing new messages scrolls the text DAT all the way to the top. I want it to continue scrolling down like the table DAT or traditional instant messengers. There doesn't seem to be any way to change this function, but I can't find any other simple operators to use.

The text TOP and field COMP have proven to be a real pain when working with long strings. I'm considering the List COMP as a possibility, but there is so much to learn just to get it up and running, and I wanted to do something just quick and dirty to be able to implement this within the next week.

Any ideas for elegant solutions?
CorbinWhite
 
Posts: 118
Joined: Sun Aug 16, 2015 2:49 pm

Re: alternative to text DAT for message log

Postby selina » Tue Jun 25, 2019 9:58 pm

If you don't need all the messages, can you use a Fifo DAT to only keep the last n lines? Or use a Select DAT to show only the last n lines?

It does look like the scroll position gets reset on the Text DAT when text is added but not the Table DAT (once you've scrolled to the bottom, adding will keep the scrollbar positions), which is something that can be fixed. So using the Table DAT instead is also a possibility.
User avatar
selina
Staff
 
Posts: 847
Joined: Tue Nov 13, 2007 1:15 am

Re: alternative to text DAT for message log

Postby CorbinWhite » Tue Jun 25, 2019 10:42 pm

The table DAT isn't ideal, because I want to support long multi-line messages. I suppose I could have a method that looks at the length of the message and then breaks it up into multiple rows in a table, but a text DAT is certainly cleaner and simpler to read.

I've tried treating the lines in the text DAT the way I would rows in a table, but it seems there's no way to utilize them in Python or with other DATs. It would be great if I could do things like op('text1')[0], op('text1').readLine(1), or even include a line number as an optional argument in the write() method. But I'm not sure how useful these would be outside using the text DAT as a UI element. Hopefully there will be something just right when the advanced widgets come out!
CorbinWhite
 
Posts: 118
Joined: Sun Aug 16, 2015 2:49 pm


Return to Beginners

Who is online

Users browsing this forum: Majestic-12 [Bot] and 26 guests