Pro thm_ui_set_data_id, state_or_id
@tplot_com
have_widget = 0b
If(is_struct(state_or_id)) Then state = state_or_id $
Else If(widget_valid(state_or_id)) Then Begin
have_widget = 1b
widget_control, state_or_id, get_uval = state, /no_copy
Endif Else message, 'Invalid Input'
If(is_struct(data_quants) And n_elements(data_quants) Gt 1) Then Begin
tx = time_string(data_quants.trange)
didx = data_quants.name+':'+tx[0, *]+' To '+tx[1, *]
If(ptr_valid(state.data_id)) Then ptr_free, state.data_id
state.data_id = ptr_new(didx)
Endif Else Begin
state.data_id = ptr_new('None')
Endelse
If(have_widget) Then Begin
widget_control, state_or_id, set_uval = state, /no_copy
Endif Else state_or_id = temporary(state)
Return
End