Re: wxEuphoria - color_selector()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jerry Story wrote:
> 
> }}}
<eucode>
> atom red,green,blue,skin
>   red = 255
>   green = 200
>   blue = 100
>   skin = create(wxColour,{red,green,blue})
> </eucode>
{{{

> 
> Later I change skin with color_selector().
> That works but there seems to be no way to save the color to a file.
> 
> Saving skin to file does not produce a consistent result.
> That is, set_back_color(Win, skin) works,
> but when skin is saved to a file, and then the program is stopped and
> restarted
> and it reads skin,
> set_back_color(Win, skin) doesn't work.
> Unless there is a bug in the way I'm doing it.
> 
> Also there seems to be no way to derive red,green,blue from skin. That would
> be ideal. Then the ini file could be edited.
> 
> How can a color from color_selector() be saved to a file?

You can use these functions to get the color components:

--/topic wxColour
--/func get_red( atom color )
--
--Returns the red intensity of a wxColour.
global function get_red( atom color )
	return and_bits(call_member( wxColour_Red, color, {} ), #FF)
end function

--/topic wxColour
--/func get_green( atom color )
--
--Returns the green intensity of a wxColour.
global function get_green( atom color )
	return and_bits(call_member( wxColour_Green, color, {} ), #FF)
end function

--/topic wxColour
--/func get_blue( atom color )
--
--Returns the blue intensity of a wxColour.
global function get_blue( atom color )
	return and_bits(call_member( wxColour_Blue, color, {} ), #FF)
end function


Matt Lewis

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu