Widget: ColorSelect

From AddOn Studio
Revision as of 04:35, 13 February 2021 by Bear (talk | contribs)
Jump to navigation Jump to search

Widget API < ColorSelect

If you want to use a ColorSelect widget, you may want to consider using the Using the ColorPickerFrame. This is a frame already defined by Blizzard. You can display it by calling: ColorPickerFrame:Show()

However, displaying it is not enough. You also need to define three functions:

  • ColorPickerFrame.func()
  • ColorPickerFrame.opacityFunc()
  • ColorPickerFrame.cancelFunc()

Examples

ColorPickerFrame.func = my_cpf_func;
ColorPickerFrame.opacityFunc = my_cpf_opacityfunc;
ColorPickerFrame.cancelFunc = my_cpf_cancelfunc;
function my_cpf_func()
print( "my_cpf_func()");
-- called when any member function is called on a ColorPickerFrame object
-- called numerous times when a point is clicked on the color wheel
-- called numerous times when a point is clicked on the shader bar
end
function my_cpf_opacityfunc()
print("my_cpf_opacityfunc()");
-- called when the user clicks the "Okay" button that is on the ColorPickerFrame
end
function my_cpf_cancelfunc()
print("my_cuf_cancelfunc()");
-- called when the user clicks the "Cancel" button that is on the ColorPickerFrame
end