[GH-ISSUE #120] Idea of table cell blink? #92

Closed
opened 2026-03-04 01:01:52 +03:00 by kerem · 2 comments
Owner

Originally created by @stephencheng on GitHub (May 23, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/120

Just wonder if there is decent way of make an animation of blinking cell when the content of the cell is updated to a different value, could this be a feature or I will have to implement it myself?

What I can think of are something like:

  1. use a data model, eg two dimension array
  2. when new data arrives, compare the differences of data and keep the record of location Loc(i,j)
  3. update the only cells with some sort of style, eg, background color or yellow, put a delay of 200 ms, then update the new value and remove the background color(if needed)

Any suggestion?

Thanks

Originally created by @stephencheng on GitHub (May 23, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/120 Just wonder if there is decent way of make an animation of blinking cell when the content of the cell is updated to a different value, could this be a feature or I will have to implement it myself? What I can think of are something like: 1. use a data model, eg two dimension array 2. when new data arrives, compare the differences of data and keep the record of location Loc(i,j) 3. update the only cells with some sort of style, eg, background color or yellow, put a delay of 200 ms, then update the new value and remove the background color(if needed) Any suggestion? Thanks
kerem closed this issue 2026-03-04 01:01:52 +03:00
Author
Owner

@rivo commented on GitHub (May 23, 2018):

This depends heavily on your application and when/how you are putting data into the table. At some point, you are changing the contents of a cell. You could then compare the new content with the old content and, if the contents differ, start a goroutine which changes the background color back after some delay.

Note that while Application.Draw() is thread-safe, the functions of TableCell are not. So you may want to use a sync.Mutex to coordinate your goroutines.

Of course, if you're updating many table cells at once, the logic would have to be slightly different, so as not to call Draw() many times after each other.

<!-- gh-comment-id:391294475 --> @rivo commented on GitHub (May 23, 2018): This depends heavily on your application and when/how you are putting data into the table. At some point, you are changing the contents of a cell. You could then compare the new content with the old content and, if the contents differ, start a goroutine which changes the background color back after some delay. Note that while `Application.Draw()` is thread-safe, the functions of `TableCell` are not. So you may want to use a `sync.Mutex` to coordinate your goroutines. Of course, if you're updating many table cells at once, the logic would have to be slightly different, so as not to call `Draw()` many times after each other.
Author
Owner

@stephencheng commented on GitHub (May 24, 2018):

Thanks for your suggestion. That's what I thought too.

<!-- gh-comment-id:391727466 --> @stephencheng commented on GitHub (May 24, 2018): Thanks for your suggestion. That's what I thought too.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#92
No description provided.