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

Ruby In-place Edit Controls

For general discussion related FlowStone

Ruby In-place Edit Controls

Postby DaveyBoy » Wed May 15, 2019 3:15 pm

Quoting the manual:

Edit controls are pretty much essential for gathering precise numerical or text input. You can create an
in place edit control on-the-fly whenever you need to get information by using the createEdit method:
createEdit input, id, area, [startText [,font [,textColour
[,backColour [,multiline]]]]]
The inputs to the method are as follows:
input - reference to the input View connector (name or index)
id - an id that you can use on the callback so you know which edit is reporting
area - four element array [x,y,w,h] to define position and size
startText - the text that will show in the edit to start with [OPTIONAL]
font - the font to use (a font object) [OPTIONAL]
textColour - the colour of the text [OPTIONAL]
backColour - the colour of the background rectangle for the edit control [OPTIONAL]
multiline - whether the control should be a multiline edit (true or false) [OPTIONAL]


This seems to work fine without the array brackets up to and including the Font option.
I can't get the textColour, backColour and multiline options to work though.

The commas are obviously in the wrong place but I still can't get these options to work no matter what I try.

Has anyone got any ideas how to get this to work or am I missing something simple? (wouldn't be the first time :))

Also the position has to be adjusted to be in the same location as the original text but I can live with that.

Thanks in advance for any help
Dave
User avatar
DaveyBoy
 
Posts: 131
Joined: Wed May 11, 2016 9:18 pm
Location: Leeds UK

Re: Ruby In-place Edit Controls

Postby wlangfor@uoguelph.ca » Wed May 15, 2019 3:19 pm

I'll take alook
My youtube channel: DSPplug
My Websites: www.dspplug.com KVRaudio flowstone products
User avatar
wlangfor@uoguelph.ca
 
Posts: 912
Joined: Tue Apr 03, 2018 5:50 pm
Location: North Bay, Ontario, Canada

Re: Ruby In-place Edit Controls

Postby wlangfor@uoguelph.ca » Fri May 17, 2019 2:32 pm

will look today, I've been busy.

As well, promised to make something that makes circular text.

:)
My youtube channel: DSPplug
My Websites: www.dspplug.com KVRaudio flowstone products
User avatar
wlangfor@uoguelph.ca
 
Posts: 912
Joined: Tue Apr 03, 2018 5:50 pm
Location: North Bay, Ontario, Canada

Re: Ruby In-place Edit Controls

Postby DaveyBoy » Fri May 17, 2019 11:51 pm

Appreciate you taking a look . . Cheers
User avatar
DaveyBoy
 
Posts: 131
Joined: Wed May 11, 2016 9:18 pm
Location: Leeds UK

Re: Ruby In-place Edit Controls

Postby DaveyBoy » Sat May 18, 2019 9:33 pm

Finally sorted it.

I was defining the colours with pens and brushes when it should be just RGB Data: (Color.new n,n,n) :mrgreen:

There are no brackets as shown in the manual . . . just comma separated values :)
User avatar
DaveyBoy
 
Posts: 131
Joined: Wed May 11, 2016 9:18 pm
Location: Leeds UK

Re: Ruby In-place Edit Controls

Postby tulamide » Sat May 18, 2019 11:46 pm

DaveyBoy wrote:Finally sorted it.

I was defining the colours with pens and brushes when it should be just RGB Data: (Color.new n,n,n) :mrgreen:

There are no brackets as shown in the manual . . . just comma separated values :)

Oh, yes, when creating the color object right in the code line, you have to be careful!
I suggest to always use brackets to enclose arguments. That way you see issues way earlier.
Code: Select all
Color.new(a, r, g, b)

Color definition can be made by passing various amounts of arguments:
Code: Select all
Color.new(g) # g = grey value
Color.new(a, g) # like above plus alpha channel
Color.new(r, g, b) # red, green, blue
Color.new(a, r, g, b) # like above plus alpha channel


You mean the edgy brackets? []
Those tell you at what point data is optional.
For example, this is valid
Code: Select all
createEdit(myinput, myid, myarea)

Or this
Code: Select all
createEdit(myinput, myid, myarea, "Type here", myfont)

But not this
Code: Select all
createEdit(myinput, myid, myarea,mybackcolor)

If you want to have a back color defined, you also have to pass startText, font and textColour

It'S easiest to read such instructions from right to left: You can leave out "multiline" OR "backColour" and "multiline" OR "textColour" and "backColour" and "multiline", etc.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby In-place Edit Controls

Postby wlangfor@uoguelph.ca » Sun May 19, 2019 12:59 pm

DaveyBoy wrote:Finally sorted it.

I was defining the colours with pens and brushes when it should be just RGB Data: (Color.new n,n,n) :mrgreen:

There are no brackets as shown in the manual . . . just comma separated values :)


Oh? ah yes I find that confusing too. Should be universal. Well, glad You solved it. I've had a cold or something.
My youtube channel: DSPplug
My Websites: www.dspplug.com KVRaudio flowstone products
User avatar
wlangfor@uoguelph.ca
 
Posts: 912
Joined: Tue Apr 03, 2018 5:50 pm
Location: North Bay, Ontario, Canada

Re: Ruby In-place Edit Controls

Postby DaveyBoy » Sun May 19, 2019 1:20 pm

Thanks for the info Tulamide, it's all becoming clear now, it's the brackets in the manual that threw me off the scent . . . but I get it now.

wlangfor, not to worry, we got there in the end.

Thanks again guys :)
User avatar
DaveyBoy
 
Posts: 131
Joined: Wed May 11, 2016 9:18 pm
Location: Leeds UK


Return to General

Who is online

Users browsing this forum: No registered users and 80 guests