; $Id: lk_dialog_combobox.pro,v 1.1 2006/11/09 23:30:10 kneller Exp $
;###############################################################################
;
;NAME:
;        lk_dialog_combobox
;
;PURPOSE:
;
;PARAMETERS:
;
;KEYWORDS:
;
;_EXTRA - is used to pass keywords meant for the superclass.
;
;RETURN VALUE:
;
;###############################################################################
function lk_dialog_combobox,list,title=title

    if n_elements(title) eq 0 then title = 'Make selection:'

    b = widget_base(title=title,/col,uvalue='lk_dialog_combobox_b',$
                    /TLB_KILL_REQUEST_EVENTS,/TLB_ICONIFY_EVENTS )
    c = widget_combobox(b,value=list,editable=0,uvalue='lk_dialog_combobox_c')
    g = widget_button(b,value='Select',uvalue='lk_dialog_combobox_g')
    n = widget_button(b,value='Exit (No Selection)',uvalue='lk_dialog_combobox_n')

    centertlb,b
    widget_control,b,/realize

    event = {id:0L,top:0L,handler:0L}


    while event.id eq 0L or event.id eq b or event.id eq c do begin
        event = widget_event(b,/nowait)
    endwhile


    ret = nse_comboindex(c)

    case event.id of
    g:begin
        widget_control,b,/destroy
        return,ret
    end
    n:begin
        widget_control,b,/destroy
        return,-1
    end
    else:
    endcase

    return,-1

end;lk_dialog_combobox

