--- :wxColourDialog: :detail: :pre: :programlisting: - :pattern: !ruby/regexp /.*/ :replace: | ```ruby # Some function for redrawing using the given colour. Ideally, it # shouldn't do anything if the colour is the same as the one used # before. # def redraw(colour) ... end data = Wx::ColourData.new data.set_colour(initialColourToUse) Wx::ColourDialog(self, data) do |dlg| dlg.evt_colour_changed { |event| redraw(event.get_colour) } if dlg.show_modal == Wx::ID_OK # Colour did change. else # Colour didn't change. end end # This call is unnecessary under platforms generating # Wx::EVT_COLOUR_CHANGED if the dialog was accepted and unnecessary # under the platforms not generating this event if it was cancelled, # so we could check for the different cases explicitly to avoid it, # but it's simpler to just always call it. redraw(data.get_colour) ```