Any plans to add the two widgets in the near future? Is anyone working on it? I expect that a file opener can be built on top of a table widget. A use-case is to provide a GUI for some existing CLI utilities.
I don't know of anyone working on table widgets nor file openers.
For file opener you can use https://github.com/ncruces/zenity . It works for me under Windows.
I have made a prototype implementation of material datatables, for simple tables I would just use a list and flex elements as the amount of code for a single row isn't much.
I need to fix some positioning values to properly match the spec and need help with API design, currently a "cell" is defined as an interface:
type Cell interface { Layout(C) D Base() *BasicCell AlignTo(text.Alignment) }
This allows user defined rendering, which I think it needed for a lot of use cases, the middle column for example is a composite type with a icon widget (would make more sense in a stock ticker perhaps).
Select all or select manually works and a method Selected() []Row exists for querying, Row type has a discrete ID value but I'm unsure how useful that is, the user might want a particular cell's value instead.
Pagination works and can be configured with any row per page value, however it is not dynamically based on view port size, the rows are rendered into a list so if the number of rows exceed screen real estate you can scroll down with the pagination pinned to the bottom of the view port.
Sorting is a bit of a mess, BasicCell is a struct of a label widget and value interface{}. Used directly it will attempt to render whatever %v returns. The sorting is done by asserting value against a set of built in types, you could, in a custom cell that isn't a type but rather a pointer or struct, populate value with it's sorting weight and provide a custom layout implementation.
Headers are their own type that additionally have a width and alignment property which feed down as the list is rendered.
Row highlight based on mouse over is working with a hack, as gio does not have a hover event from what I could find, this would need to be conditionally enabled on desktop platforms.
I am happy to provide source for this if anyone is still interested, but it is very low quality code :^) (especially with row highlights and horizontal rules, I ran into positioning issues with insets and had to hard code some offsets which does not seem right to me)
~thetooth I would be happy to collaborate on this for use in the
materials
library! It's one of the components that I haven't been able to get to yet, and I probably wouldn't get to them anytime soon without some help. If you'd like to start by sending the current implementation and demo code to my public mailing list, we could chat about options to iterate on it!Incidentally, Gio does have hover events. You can use the
pointer.Enter
andpointer.Leave
mouse event types to detect when a cursor enters/exits an input area. There are also these patches from ~jackmordaunt that are working to add hover detection to theClickable
type. Not merged yet, but perhaps soon.Anyway, thanks so much for exploring this! Data tables are very important for a huge range of applications, and it would be fantastic to have a solid Gio implementation.
I was unable to get anything through to your mailing list intact so I have just parked the source here: https://gist.github.com/thetooth/c04ea3d572ed554fb87d98e830e11921
~thetooth Okay, cool. I'll take a look soon. Thanks!
I have sketched a file opener for an app I am working on. It is opiniated and needs work but will revisit it soon and share it.