comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » PRO: Color Selection
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
PRO: Color Selection [message #2549] Tue, 26 July 1994 13:44
tai is currently offline  tai
Messages: 14
Registered: June 1994
Junior Member
Thanks again to all who replied or posted to my query on a
color-selection widget for IDL. It turns out that cw_colorsel was the
answer. I hacked up the following standalone function to use
cw_colorsel in its own window.


Alan

;------------------------ select_color_event -------------------------------
pro select_color_event, Event
common ColorSel_Comm, MainBase, DRAW10_Id, DefaultColor, SelColor
WIDGET_CONTROL,Event.Id,GET_UVALUE=Ev
CASE Ev OF
'BtnOK': widget_control, /destroy, MainBase
'BtnCancel': begin
SelColor = DefaultColor
widget_control, /destroy, MainBase
end
'ColorSel': begin
SelColor = Event.Value
wset, DRAW10_Id
Erase, SelColor
end
endcase
end

;--------------------------- select_color ----------------------------------
function select_color, DefColor, GROUP = Group, Help = Help
; DefColor = color index to start with (usually 0)
; Group = parent widget
; Returns: selected color index
COMMON ColorSel_Comm, MainBase, DRAW10_Id, DefaultColor, SelColor

IF N_ELEMENTS(Group) EQ 0 THEN GROUP=0
MAIN13 = WIDGET_BASE(GROUP_LEADER=Group, /Column, TITLE='Select Color', $
UVALUE='MAIN13')
BASE32 = WIDGET_BASE(MAIN13, /ROW, TITLE='Buttons', UVALUE='BASE32')
BUTTON30 = WIDGET_BUTTON( BASE32, UVALUE='BtnOK', VALUE=' OK ')
BUTTON31 = WIDGET_BUTTON( BASE32, UVALUE='BtnCancel', VALUE='Cancel')
DRAW33 = WIDGET_DRAW( BASE32, RETAIN=2, /FRAME, UVALUE='ColorSquare', $
XSIZE=32, YSIZE=32)
BASE35 = WIDGET_BASE(MAIN13, /ROW, UVALUE='BASE35')
ColorSel = cw_colorsel(MAIN13, uvalue = 'ColorSel')

; post-processing
WIDGET_CONTROL, MAIN13, /REALIZE
MainBase = MAIN13
DefaultColor = DefColor
widget_control, ColorSel, set_value = DefaultColor
WIDGET_CONTROL, DRAW33, GET_VALUE=DRAW10_Id
wset, DRAW10_Id
Erase, DefaultColor
XMANAGER, 'select_color', MAIN13
return, SelColor
end
[Message index]
 
Read Message
Previous Topic: Please help with buggy widget code
Next Topic: Re: Please help with buggy widget code

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 18:01:27 PDT 2025

Total time taken to generate the page: 0.00185 seconds