Page 1 of 3

Listbox

PostPosted: Thu Jan 07, 2016 4:27 pm
by tulamide
There probably already are millions of solutions, and this is my take on it. A Ruby-driven Listbox, that works a lot like the index selector prim, but can be used on a GUI as well, for user interaction.

It has one input, which expects a comma seperated list of items, and two outputs, which are the current selected index, and the name of the selected index item.

Important: I provide it as is. Last time I reacted to proposals for improvements, but although it was quite some work, only 2 people were interested in it. That's just not worth it. But if you want to improve it, you're welcome. Just post the improved fsm here.

Have fun :D

Re: Listbox

PostPosted: Thu Jan 07, 2016 5:38 pm
by adamszabo
very nice i love it!

Re: Listbox

PostPosted: Thu Jan 07, 2016 7:17 pm
by kortezzzz
That's great tulamide! you continue showering us up with clever little goodies :D

This is the first time I see that kind of list-box here since trog's one, which I found extremely useful for touch-screen optimized GUI designs (well, there were lot's of radio button versions, but not list-boxes. sorry if I missed your previous post). wish I could code and improve it, but I just can't yet. All I can do is to comment some optimization suggestions, since I've already implemented such menus in my designs and I know which parameters are needed to be adjustable to make it workable tool for any FS developer. Here is the list:

1) Additional Initial input - to allow selecting an index by using an external source like a preset or other menu.
2) Color inputs for background, fore, selected text, non-selected texts
3) Margin - it should be completely adjustable: color, width, roundness.
4) An ability to easily determine the space width between the indexes.
5) An ability to increase\decrease the total size of the whole list box.

Really love the up\down concept. Very useful when using touch-screens :)
If you could just add an option to increase\decrease the up\down button's size, it would be great as well. Overall, Its fantastic tool. Sorry I can't offer a practical help, but on the other hand, I learn a lot from those examples, so maybe one day... :)

I have no idea how much pain should be absorbed to implement those features, so sorry if I sound exigent. If it requires some extra- efforts, just forget about it. Its great as is as well. Thanks!!

Re: Listbox

PostPosted: Thu Jan 07, 2016 11:24 pm
by tulamide
@adam
It may please you to read that I did this one because I use it in the next version of the sprite font engine. Yes, I'm awfully slow, but I get progessively forward. And Apex is worth it :mrgreen:

@kortezzzz
I got it right! I got it right! four "z"! :lol:
Thanks for your proposals. They all make sense and they all would add tremendously to the usage of the listbox. Luckily most of them are basically already in the code, like 2 and 5, or just need minor enhancements to it, like 1 and 4. But I won't make the mistake to invest time again, before having wait for more interest in this control. Maybe someone else is already working on these improvements? Or will be after reading that it isn't all too hard?

Re: Listbox

PostPosted: Fri Jan 08, 2016 9:25 am
by kortezzzz
Luckily most of them are basically already in the code, like 2 and 5, or just need minor enhancements to it, like 1 and 4. But I won't make the mistake to invest time again, before having wait for more interest in this control. Maybe someone else is already working on these improvements? Or will be after reading that it isn't all too hard?


I'm pretty sure that some of the heavy FS-Ruby gangsters here won't find any problem to figure it out and add the the improvements, but unfortunately, I'm not one of them. yet...
I also believe that more people would find it much interesting after we add it into a some more significant schematics (like a small demo synth or an effect) that would actually demonstrate it's power. I would surely pick up the gauntlet in that case ;)

Re: Listbox

PostPosted: Fri Jan 08, 2016 9:30 am
by Spogg
Just had a play with this and I love it!

The best bit, by far, is that Spogg is first on the list :lol:

Seriously, this is a great control. I really like that the arrows are position-aware too.

Tell me tulamide, how long did this take you to make from initial idea to upload? At some point I've promised myself to start learning Ruby but I wondered how much time would be needed for an expert like yourself to invest to get a result like this...

Regarding Kortezzzzzzzzzz's comments: The most important one for me is preset support. The other customisation stuff can be done by editing the Ruby code, as far as I can see. I've done this many times for other Ruby stuff to get the look I want and, as a side benfit, it's given me a bit of insight into Ruby itself.

Finally, and I know this comes up often, please don't be discouraged by lack of feedback. Just look at the viewing figures!

Cheers

Spogg

Re: Listbox

PostPosted: Sat Jan 09, 2016 8:34 am
by tulamide
Hey guys,

of course 'Spogg' is first on the list, it is sorted by 'most extraterrestrial'!

I don't care much for the views or the downloads. I know myself: I often just download something, because it might someday be of use although it doesn't interest me much at the time of download. I think that's what many people do. So, the only ones that are really interested are those that actually post in the thread. Why should I invest even just minutes if there is not much interest?

However, I discovered a smaller issue, where you get a non-existent index if you click in an empty area. I fixed this and quickly added an input to set the index external. This should help you, Kortezzzz, and it is also what you need, Spogg, to build a preset management.

I might make additional improvements following Kortezzzz's list, but currently I will concentrate on other work.

The time question:
This one took me around 6 hours of intense work, over two days. I work unusual, because most people will start with notes about the project, making a diagram of some sort, etc. But I have a more figurative mind, probably more like an artist's mind. I see the result as a clear image in my mind, how the control looks, how it works, how I use it, etc. I then program, until it is as I imagined it to be. Probably less effective programming style, but very fullfilling.
My answer is so detailed, because I know your motivation. I have the very same question, everytime I see something that Martin created. I just don't have the courage to just ask him.

Spogg, my biggest work so far in Ruby is my Spline class. You can find it here. It took me 4 weeks to create (in the same way as described above). I recommend that you download it. It comes bundled with an illustrated pdf manual, that assists you from the very beginnings (how to set up a RubyEdit and a view to work with the Spline class) to actual drawing of splines. And that's something that would help you, because all of the hard work is done by the class in the background, while you can learn a bit about Ruby and how to enter commands. You get instant feedback from the view, using simple instructions, which is so much more helpful then just staring at code, trying to figure out what it does. I'm sure you will love it!

Re: Listbox

PostPosted: Sun Jan 10, 2016 11:12 am
by Spogg
Hi tulamide

First off, thanks for the link to the Spline Class. I shall need to read the pdf to understand any of it, but I will at some point.

Now to the listbox:

I've successfully added preset management to the lisbox. As I said, this is very important for me.
However, in testing it I am able to successfully save and retrieve any preset and the values of the string and index all re-load correctly but, if the loaded list element is not in the view, it doesn't display. I've tried a few things but it seems the display itself doesn't respond to the loaded value. Take a look at my modified version and please, go easy on an old Vulcan trying his best who has probably just got something simple very wrong...

Cheers

Spogg

Re: Listbox

PostPosted: Sun Jan 10, 2016 2:27 pm
by tulamide
Hey Spogg,

I didn't update the view, because there are so many situations, that you can't make sure, where the selected index appears in the view. For you I use an algorithm that only takes care that the end of the list will always be at the bottom, even if you select the last items. I hope this works for you?

Re: Listbox

PostPosted: Sun Jan 10, 2016 3:14 pm
by Spogg
tulamide wrote:I didn't update the view, because there are so many situations, that you can't make sure, where the selected index appears in the view. For you I use an algorithm that only takes care that the end of the list will always be at the bottom, even if you select the last items. I hope this works for you?


Perfection! This does exactly as I wanted now. I can edit the code for appearance so I'm a very happy Vulcan (a rare thing) :D :D

Thank you so much for this tulamide.

Cheers

Spogg