我正在编写测试应用程序,应该读取文件名并将其打印在电子表格的单元格中。我无法理解如何将文件名值放入单元格。这是我的代码:
PRO test
;D:\Proj\2\test1\data\HTML5_Logo_256.png
title='my example'
base = WIDGET_BASE(xsize=500, ysize=400, MBAR=mbar, TITLE=title, COLUMN=3, TLB_FRAME_ATTR=1)
fmenu = WIDGET_BUTTON(mbar, VALUE='File')
open_file = WIDGET_BUTTON(fmenu, value='Open file', uvalue='Open')
table = WIDGET_TABLE(base, XSIZE=4, YSIZE=4, COLUMN_LABELS=["name", "FID", "size", "foo"], X_SCROLL_SIZE=0)
WIDGET_CONTROL, base, /REALIZE
info={base:base}
infoptr=PTR_NEW(info)
WIDGET_CONTROL, base, SET_UVALUE=infoptr
XMANAGER,'test', base,/NO_BLOCK
END
PRO test_EVENT, event
WIDGET_CONTROL,event.top, GET_UVALUE=infoptr
info=*infoptr
WIDGET_CONTROL,event.id, GET_UVALUE=widget
IF (widget EQ 'Open') THEN BEGIN
filename=DIALOG_PICKFILE(PATH='D:\Proj\2')
envi_open_file, filename, r_fid=fid
if (fid eq -1) then return
ENVI_FILE_QUERY, fid, filename=filename, ns=ns
print,'filename=',filename
WIDGET_CONTROL, table, SET_VALUE = filename ; here is my attempt
ENDIF
END