number stytem for color selector?
Hi everyone.. I'm making an editor where the user can set the color of an object on screen using both the color selector dialogue AND a text edit box.
I'd love for the user to be able to see the colro as prepresented by the hex numeric system that is used in pretty much every graphics program like Photoshop and Promotion.
Is there a way I can translate the number that can be retreived from the color selector dialogue into the hex format that is much more useful and familiar to artists?
thanks
Re: number stytem for color selector?
Right$(Hex$(256+GetRed(getColor( "Color Selector" ))), 2)+Right$(Hex$(256+GetGreen(getColor( "Color Selector" ))), 2)+Right$(Hex$(256+GetBlue(getColor( "Color Selector" ))), 2)
That should work. The reason I'm adding 256 to each value and fetching the two rightmost characters is to be sure to get 0A instead of just A, 04 instead of 4 etc when handling values below 10h. Might be an easier way but heck if I know. :P
Re: number stytem for color selector?
Pretty sure Hex$ normally prefixes the number too, and this handily avoids that.
Re: number stytem for color selector?
Dynasoft, no. The output is formatted as 0xABC, e.g. 0x123, 0xA...
Re: number stytem for color selector?
By "Hex$ prefixes the number" I meant "it adds '0x' to the beginning".
Re: number stytem for color selector?
Ah, sorry. I get your point now.
I kind of misunderstood "and this handily avoids that" as if crusher's solution would totally ignore the fact that MMF already adds a leading zero on its own. :blush:
Re: number stytem for color selector?
I have added an example that may help.
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=176300&#Post176 300
Marv
Re: number stytem for color selector?
Thank you all so much for the help and clarification! :)
One last question. :( How do I set a masked edit object to allow for hex numbers?!?
(Edit) Never mind... i just had a bug breaking my hex stuff. ;)
the solution was simply:
[a-zA-Z0-9]
Re: number stytem for color selector?
Actually I do have one last question!
How can I reconvert the Hex rgb value thats now in the edit box so I can put this new color in the color selector?
In oither words, how can I do the reverse of the first question?