Listbox widget

201 views
Skip to first unread message

Andi

unread,
Sep 27, 2012, 3:28:58 PM9/27/12
to go-...@googlegroups.com
Hi,

I wrote a listbox widget and like to get some feedback before starting a pull-reqeust.
- is the widget useful
- is the communication done right
- is the code idiomatic (I don't have that much experience)

The code is on github: https://github.com/exul/go.uik (branch listbox). There is an example unter examples/uiklistbox.

Thanks, Andi

Daniel Skinner

unread,
Sep 27, 2012, 3:39:22 PM9/27/12
to go-...@googlegroups.com
Not a developer on the project, but my thoughts on where to go from here.

Instead of `Options` being of `[]string`, they should be of `Block`. I'm not familiar with the uik internals so if it doesn't facilitate this than it probably should. In this fashion, a programmer could define how each item in the list should be represented. If they only want to display a string, then they could use `widget/label`


--
You received this message because you are subscribed to the Google Groups "go-uik" group.
To view this discussion on the web visit https://groups.google.com/d/msg/go-uik/-/rDc-R9gJsoQJ.
To post to this group, send email to go-...@googlegroups.com.
To unsubscribe from this group, send email to go-uik+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/go-uik?hl=en.

Andi

unread,
Sep 27, 2012, 3:51:49 PM9/27/12
to go-...@googlegroups.com
Yeah, I think that would be an advantage. I'll try if it fits into the existing code.

By the way, a short description what you can do with the widget:
- You can select one button by clicking it
- You can select multiple buttons by clicking one, press shift and select the second one.
- You can "pick" multiple buttons, by clicking one, press ctrl and select/deselect other buttons

Daniel Skinner

unread,
Sep 27, 2012, 4:00:28 PM9/27/12
to go-...@googlegroups.com
That sounds nice. Continuing with what I previously said, you could probably carry over a lot of that code and provide a set of default styles that affect how the widget functions. So applying a multi-select style would default to a label+checkbox. Single select could be just label or optional single select could be label+radio.

To view this discussion on the web visit https://groups.google.com/d/msg/go-uik/-/2EyR71eYttIJ.

John Asmuth

unread,
Sep 27, 2012, 6:24:45 PM9/27/12
to go-...@googlegroups.com
Awesome, I'm thrilled to have people experiment.

The programming interface is not satisfactory yet. Do you have any comments about what might have been sticky, for you? Anything that seemed weird or unintuitive?

Andi

unread,
Sep 28, 2012, 4:20:39 AM9/28/12
to go-...@googlegroups.com
Hi,

Do you mean anything specific with "The programming interface is not satisfactory yet.". Because for me everything was quite streight forward. The hardest part was to get the big picture on how everything works together.
To use channels to communicate is a great thing, but I don't know if I really understood how events are travelling between components. So this is something that sould be explained somewhere.
Oh yes, one thing, in the radio button tutorial you create a private and a public channel to get and set things. Is this needed? Especially the "getOptions" channel isn't used anywhere in the code.
My code is heavily commented, if a comment doesn't explain what the code does, I didn't understand that part ;-).

John Asmuth

unread,
Sep 30, 2012, 10:46:46 AM9/30/12
to go-...@googlegroups.com
the public and private channels were to make it so that the exposed one was unidirectional - I didn't want anyone outside the block's muxer to be able to read from that channel. But I'm thinking that exposing the channels at all is not a good idea, since godoc doesn't pick them up. Instead, I'll make a method that puts things on the channel, and that method can be documented.

Andi

unread,
Oct 2, 2012, 1:52:25 PM10/2/12
to go-...@googlegroups.com
Hi John

Thanks for the explanation, that makes sense. I like the idea, to use functions to expose things to anyone outside. I'll change that in the listbox widget.
Reply all
Reply to author
Forward
0 new messages