Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 18th, 2024, 4:48 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Colour Question
PostPosted: October 13th, 2018, 7:02 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
What am i doing wrong?

I have made a text input where i need to enter an RGB code to change colours of a Polygon.
The input box variable is called: RGBcode
The polygon is called Polygon
I made a button to perform this action:
Polygon.SetFillColour(RGB(RGBcode))
The only color that shows up is Red, the first of the 3 values. When i change the values only the red changes.

When i set an RGB code instead of the variable in the script, the right color shows up.
What am i doing wrong? Normaly i can set a variable in the code without a problem.

To solve the problem, I used the following code:
Polygon.SetFillColour(RGBcode)
in this case the variable works, but only with HEX codes, but they are not as user-friendly as a RGB code

Here you can find an example of the problem:
http://csnmedia.nl/opus/


Kind Regards,
Ad Mulders

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Colour Question
PostPosted: October 13th, 2018, 5:36 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I think it needs all three values in a list: Try:

Code:
myColoursArray = RGBcode.split(',')
Polygon.SetFillColour(RGB(myColoursArray[0],myColoursArray[1],myColoursArray[2]))


Regards,

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : Ad Mulders


Top
 Profile Visit website  
 
 Post subject: Re: Colour Question
PostPosted: October 13th, 2018, 8:18 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks Mack,
Your script work. Thank you. I am curious, why do not I find this code in the help file and what went wrong?

Kind Regards,
Ad Mulders

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Colour Question
PostPosted: October 14th, 2018, 12:54 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Ad,

If it's any help - it's not just you and it's not just Opus help. I frequently use help manuals and even commercial books where it seems they have forgot to tell you some key piece of information to make it work.

And I didn't actually know the answer as I never use RGB, I always use the hex reference. What made me think the idea would work, was if you view it as a standalone function it would look like this:

Code:
function RGB(x,y,z){
//do something here
}


The function would need you to pass three independent parameters. The value you put into the text box was just one parameter a string such as "125,243,24". This means on the x parameter in the RGB function received all information - it received the whole string.

What you actually needed was three Text Input Boxes - one for each parameter:

Code:
Polygon.SetFillColour(RGB(myTextInputOne, myTextInputTwo,myTextInputThree))


My little bit of code just did this automatically for you by taking the value entered into a single Text Input box and splitting it up so it acted like three parameters where being passed.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Colour Question
PostPosted: October 15th, 2018, 4:26 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks Mack. Clear explanation.

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group