New to Ruby.

For general discussion related FlowStone
Post Reply
primeposition
Posts: 7
Joined: Tue Sep 08, 2015 2:53 pm

New to Ruby.

Post by primeposition »

Create_drop_down_list_1.fsm
(830 Bytes) Downloaded 823 times


Hi All,

Can someone help me, im simply trying to get the index from the selected string to show up on the front panel, How do I get the string to be drawn? May sound silly but I'm struggling to find the answer. I found some information nut I am new.

Thanks.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: New to Ruby.

Post by tulamide »

Here you are. And welcome to the forums :)
Attachments
Create_drop_down_list_1[tula].fsm
(830 Bytes) Downloaded 811 times
"There lies the dog buried" (German saying translated literally)
primeposition
Posts: 7
Joined: Tue Sep 08, 2015 2:53 pm

Re: New to Ruby.

Post by primeposition »

Hi thanks,

How do you make it display the name in string thats coming in on the input?

Thats more what I was getting at? If thats ok?

cheers
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: New to Ruby.

Post by tulamide »

Here you are. From your description, it wasn't clear: "im simply trying to get the index from the selected string to show up on the front panel, How do I get the string to be drawn?"

Hope it helps!
Attachments
Create_drop_down_list_1[tula, revised].fsm
(837 Bytes) Downloaded 836 times
"There lies the dog buried" (German saying translated literally)
primeposition
Posts: 7
Joined: Tue Sep 08, 2015 2:53 pm

Re: New to Ruby.

Post by primeposition »

Wow, thats amazing, thank you so much. So I couldent be really cheeky and Get a small explanation so I can get my head round how that's been done? Seen that you used .split and created what looks like a global varible from @index.
But its the event handling im unsure of.

Just so I can learn really.

cheers
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: New to Ruby.

Post by tulamide »

The "global" variable is a class instance variable (the RubyEdit is just a class as everything in Ruby, see my Ruby Stripped Series on Flowstone GURU)

The event handling is pretty straight forward. You need to tell Flowstone, when to draw the front panel. We know that the selection may have changed after the menu is closed, so this is the spot were we need to draw. When closing the menu, the finished-method is executed, so our code should go there. There's a special Flowstone-specific method called "redraw", that triggers a draw of the front panel, using the code from the draw method. That's it.
"There lies the dog buried" (German saying translated literally)
Post Reply