Re: dialog_pickfile return question.. [message #54430 is a reply to message #54314] |
Sat, 09 June 2007 04:17  |
pook41
Messages: 16 Registered: January 2007
|
Junior Member |
|
|
On Jun 7, 1:51 am, ryans...@gmail.com wrote:
> On Jun 6, 10:13 am, jkj <k...@vexona.com> wrote:
>
>
>
>> On Jun 6, 10:44 am, ryans...@gmail.com wrote:
>
>>> How would I go about getting the path choosen from Dialog Pickfile and
>>> then having that path appear in a pre-existing widget_text? I have
>>> attempted using a pointer but I could not get it to work, as the
>>> widget_text doesn't 'update'.
>
>>> Here is my code, if anyone could help it would be fantastic!
>
>>> PRO test_event, ev
>>> widget_control, ev.id, get_value=value
>>> widget_control, ev.top, get_uvalue=info
>
>>> if value eq '...' then begin
>>> filepicked = DIALOG_PICKFILE (/READ)
>>> print, "File picked"
>>> print, filepicked
>>> fp = ptr_new(filepicked)
>>> END
>
>>> END
>
>>> PRO test, value
>
>>> main = widget_base (title='PRO', MBAR=bar, /row)
>>> wt0 = WIDGET_TEXT(main, XSIZE=15, uvalue='Filename', /ALL_EVENTS, /
>>> EDITABLE)
>
>>> findfiles = widget_button (main, value='...')
>
>>> widget_control, main, /realize
>>> widget_control, main, set_uvalue=info
>>> xmanager, 'experiment', main
>
>>> END
>
>>> Thanks,
>>> Ryan
>
>> Sent the id of widget_text to the handler in the info structure and
>> then update it from within the event handler:
>
>> 1. Add wt0 to the info structure:
>> info = { $
>> id:wt0 $
>> }
>
>> ....
>> 2. use wt0 in the event handler:
>> filepicked = DIALOG_PICKFILE (/READ)
>> widget_control, info.id, set_value=filepicked
>
>> -Kevin
>
> Thank you to the both of you!
> I got it working great now.
>
> I know my code there has some problems, that was just a small part of
> a bigger program
> I used to make showing you guys easier.
>
> Thanks again!
Dialog_pickfile has the GET_PATH keyword which would seem to be what
you want.
Andrew
|
|
|