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

too long string to show in one line ?

For general discussion related FlowStone

too long string to show in one line ?

Postby Nubeat7 » Fri Nov 23, 2012 10:01 am

hallo, iwant to do a label, for the presetmanager, which dont write 2 lines when the string is too long, i would prefer that it shortens the string and keep it in one line i.e.

"dark arp syn..."
and not
"dark arp
synthecizer"

is there a way to do this?
and a maximum lenght of the string would be fancy too...

Thanks
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: too long string to show in one line ?

Postby trogluddite » Fri Nov 23, 2012 12:57 pm

Yes, both the Ruby and primitive texts let you do this; you need to turn off word wrapping.

For priimitives, you use the format option "nowrap". For example, on the Text primitive, connect a string to the 'SF' input, and write "nowrap, left, centre" for one line text, left aligned, in the middle of the height.

For Ruby - you need to use the setFlags method for the formatString object - there's a list of the codes in the user guide (4096 is the right one for "nowrap" IIRC), e.g.
Code: Select all
@my_format = formatString.new
@my_format = setAlighment("left")
@my_format = setLineAlignment("top")
@my_format = setFlags(4096)


In Ruby there's load of extra flags that the Text prim' doesn't have - don't quite understand them all yet, but a quick experiment setting the number from an input value should soon find the most useful ones. Then you just add together the numbers of the ones you want to use.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: too long string to show in one line ?

Postby Nubeat7 » Sat Nov 24, 2012 12:18 am

thanks trog, great it stays in one line now with the flag (4096) also when the label is higher... to shorten the string with "..." for the last characters i used this lines inside the code:
Code: Select all
s = @label[0...90]
   l = @length   
   if l <= 3 then l = 3 end
   if s.length >= l then s = @label[0,l-3] + "..." end


it shortens the link now like this when its longer the 14 character

"dark arp syn..."

i also found out that the max length for preset names are limited to 24 characters by the presetmanager anyway..

get this little gimmick for toolbox here: viewtopic.php?f=3&t=953
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: too long string to show in one line ?

Postby RJHollins » Mon May 06, 2013 1:04 am

Thanks NuBeat !

Very handy. Thanks Guys for a bit of the RUBY lesson :)
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm


Return to General

Who is online

Users browsing this forum: No registered users and 51 guests