
;+ ***********************************************************************
; NAME:
;	CW_LABELNRH
;
; PURPOSE:
;	Tell what your routine does here.  I like to start with the words:
;	"This function (or procedure) ..."
;	Try to use the active, present tense.
;
; CATEGORY:
;	Compound widget
;
; CALLING SEQUENCE:
;	Str_label = CW_LABELNRH ()
;
; INPUTS:
;	
; KEYWORD PARAMETERS:
;	GROUP	identifieur du widget appelant
;	AXIS	widget de label des axes X, Y
;	CHARSIZE widget de dimension des caracteres (0.8 par defaut)
;
; OUTPUTS:
;	STR_LABEL	Structure definissant le contenu du label
;		STR_LABEL = {Str_label, $
;			Date:1, $	inscrite si = 1
;			Heure:1, $	inscrite si = 1
;			Freq:1, $	inscrite si = 1
;			Instrume:0, $	inscrit si =1
;			Physpar:0, $	inscrit si =1
;			Free:''}	Champ libre
;
; COMMON BLOCKS:
;
; PROCEDURE:
;	Cette fonction permet de definir le contenu d'un label par des 
;	boutons
;
; EXAMPLE:
;	Str_label = CW_LABELNRH(GROUP = event.top)
;
; MODIFICATION HISTORY:
;	Ecrit par: J Bonmartin (bonmartin@obspm.fr)
;	le 08/01/99 Rajout des keywords AXIS, CHARSIZE (JB)
;-*******************************************************************

PRO CW_LABELNRH_EVENT, event

COMMON LABELNRH, Str_label

ON_ERROR, 2
Parent = event.handler
Stash = WIDGET_INFO(parent, /Child)

WIDGET_CONTROL, event.id, GET_UVALUE = ev

Case ev of
	'Date':	Str_label.date = event.select

	'Freq':	Str_label.freq = event.select

	'Heure': Str_label.Heure = event.select

        'Phys': Str_label.Physpar = event.select

        'Instr': Str_label.instrume = event.select

	'Axes':	 Str_label.axis = event.select

	'Size':	 Str_label.charsize = event.value

        'Chaine': Str_label.free = event.value

        'Return': WIDGET_CONTROL, event.top, /Destroy

ENDCASE

END

FUNCTION CW_LABELNRH, GROUP = Group, AXIS = Axis, CHARSIZE = Charsize

COMMON LABELNRH, Str_label

	STR_LABEL = {NRH_STR_LABEL}
		Str_label.charsize = 1.1  ; 0.8 (22sep 2008)

IF N_ELEMENTS(Group) EQ 0 THEN Group = 0

Base = WIDGET_BASE(GROUP_LEADER = Group, /Column, /Align_center, $
				TITLE= 'Define Label')

	B = CW_BGROUP( Base, 'Date', Uvalue= 'Date', /Nonexclusive, $
				SET_VALUE = Str_label.date)
	B = CW_BGROUP( Base, 'Hour', Uvalue= 'Heure', /Nonexclusive, $
				SET_VALUE = Str_label.heure)
	B = CW_BGROUP( Base, 'Freq', Uvalue= 'Freq', /Nonexclusive, $
				SET_VALUE = Str_label.Freq)
	B = CW_BGROUP( Base, 'Instrume', Uvalue= 'Instr', /Nonexclusive, $
				SET_VALUE = Str_label.Instrume)
	B = CW_BGROUP( Base, 'Phys Param', Uvalue= 'Phys', /Nonexclusive, $
				SET_VALUE = Str_label.Physpar)
	IF KEYWORD_SET (AXIS) THEN $
	     B = CW_BGROUP( Base, 'Axis', Uvalue= 'Axes', /Nonexclusive, $
				SET_VALUE = Str_label.Axis)
	IF KEYWORD_SET (CHARSIZE) THEN $
	     B = CW_FIELD( Base, UVALUE = 'Size', $
		VALUE = STRING(Str_label.Charsize,FORMAT='(f4.2)'), $
		/RETURN_EVENT, /FLOATING, TITLE = 'Charsize:', XSIZE = 8)
        b= CW_FIELD(Base,Value=str_label.free,Uvalue='Chaine',/String, $
		TITLE='Free field',Xsize=15,/return_event)
        b= WIDGET_BUTTON(Base, Uvalue='Return',Value='OK')

WIDGET_CONTROL,Base,/Realize

XMANAGER, 'CW_LABELNRH', Base

RETURN, Str_label

END 

