FYI, you may also want to have a look at tcell: https://github.com/gdamore/tcell
it was very easy to spin up a few tools with it. -s On Tue, Nov 29, 2016 at 9:42 PM, Egon <egonel...@gmail.com> wrote: > On Tuesday, 29 November 2016 20:37:55 UTC+2, bia...@gmail.com wrote: >> >> If you already knew theres an existing library, why write a new one? >> > > It's a proof-of-concept not a library -- libraries take several magnitudes > more effort. > > I've written, I guess 7+ different versions of UI > libraries/proof-of-concepts. Partly due to work, partly because I want a > proper GUI library for Go; but I'm still trying to find a design I'm > satisfied with. > > Different libraries make different trade-offs... when they don't make > important trade-offs they will be difficult to use or not useful in > practice. > > The approach I showed, makes trade-offs in making UI "less flexibible", > but at the same-time it makes easier to manage different content and > records. > > Now the other libraries tend to make UI more "flexible", but they make > handling the business and binding with business logic harder. > > (Of course, there are also differences in event logic and ease of > understanding...) > > *Also there's no reason you couldn't combine ideas from both approaches.* > > Self-challenge of some sort? :) It's really something though. >> > > For me, it was mainly a relaxing and clarifying exercise. Rewriting code > helps me to see new viewpoints and figure out how to better structure code. > Also, in this case, was useful for someone else. > > + Egon > > >> >> On Wednesday, November 30, 2016 at 1:51:20 AM UTC+8, Egon wrote: >>> >>> On Tuesday, 29 November 2016 19:35:21 UTC+2, bia...@gmail.com wrote: >>>> >>>> Did you write that code just for this thread? >>>> >>> >>> Yeah, had 2hrs of fun with it :) >>> >>> >>>> I really appreciate it. That gives me options. It runs and its possible >>>> for me to setup something based on this. >>>> >>> >>>> On Tuesday, November 29, 2016 at 11:10:44 PM UTC+8, Egon wrote: >>>>> >>>>> On Tuesday, 29 November 2016 14:03:13 UTC+2, Ronny Bangsund wrote: >>>>>> >>>>>> >>>>>> >>>>>> On Tuesday, November 29, 2016 at 7:11:57 AM UTC+1, bia...@gmail.com >>>>>> wrote: >>>>>>> >>>>>>> I've been wondering how I should setup input fields..... should >>>>>>> termbox be responsible for it? or termui as you suggested (this seems >>>>>>> more >>>>>>> for monitoring...) or even gocui? >>>>>>> >>>>>> I've tested termui and GOCUI extensively, and found both to be the >>>>>> best options for exactly that sort of thing. I did have to modify >>>>>> things/make custom widgets to get lists working how *I* like them, but >>>>>> it's >>>>>> very easy to use. >>>>>> >>>>>> I'm leaning slightly towards GOCUI personally, but that doesn't mean >>>>>> you should reach for that without testing termui. Both are fairly easy to >>>>>> set up, but they have different ways of handling input and updating the >>>>>> display. >>>>>> >>>>>> If anyone is kind enough to show some example code of a page with >>>>>>> input fields.... maybe 1-2 input fields it'd greatly help. >>>>>>> >>>>>> There isn't really much to it. There are very few widgets - >>>>>> everything is basically a bit of text, with or without a border, with >>>>>> different colours and/or cursors to indicate its purpose. Examples of >>>>>> what >>>>>> you need would be useful. >>>>>> >>>>>> For more direct help I can recommend the Gopher Slack (I can show >>>>>> more of my code there). >>>>>> >>>>>> >>>>> Depending on how much different behavior you need, it's possible to >>>>> implement your own basic library for handling UI on the terminal. >>>>> >>>>> You can take a look at a proof of concept here: >>>>> https://github.com/egonelbre/exp/blob/master/dos/main.go >>>>> >>>>> Of course, you would need to re-implement it yourself and adjust to >>>>> your own needs. >>>>> >>>>> NB: Dig around in the code-base, if you don't feel comfortable with >>>>> it, then you probably should use an existing library. >>>>> >>>>> + Egon >>>>> >>>>> >>>>> >>>>> >>>> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.