Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

New to Ruby.

For general discussion related FlowStone

New to Ruby.

Postby primeposition » Tue Sep 08, 2015 3:10 pm

Create_drop_down_list_1.fsm
(830 Bytes) Downloaded 772 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.
primeposition
 
Posts: 7
Joined: Tue Sep 08, 2015 2:53 pm

Re: New to Ruby.

Postby tulamide » Tue Sep 08, 2015 3:44 pm

Here you are. And welcome to the forums :)
Attachments
Create_drop_down_list_1[tula].fsm
(830 Bytes) Downloaded 769 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: New to Ruby.

Postby primeposition » Tue Sep 08, 2015 4:49 pm

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
primeposition
 
Posts: 7
Joined: Tue Sep 08, 2015 2:53 pm

Re: New to Ruby.

Postby tulamide » Tue Sep 08, 2015 4:57 pm

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 797 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: New to Ruby.

Postby primeposition » Tue Sep 08, 2015 5:19 pm

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
primeposition
 
Posts: 7
Joined: Tue Sep 08, 2015 2:53 pm

Re: New to Ruby.

Postby tulamide » Tue Sep 08, 2015 6:22 pm

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)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: No registered users and 46 guests