comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Tree widget woes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Tree widget woes [message #37281] Fri, 12 December 2003 08:37 Go to next message
robert.dimeo is currently offline  robert.dimeo
Messages: 42
Registered: November 2001
Member
Hi,

I work quite a bit with tree widgets in my IDL code and I have run
into a problem. I use tree widgets to represent data in a folder
hierarchy and clicking on the leaves usually results in a plot of a
single data set or a multiple data set depending on whether or not the
user selects more than one leaf. I want to be able to create
dynamically the same kind of folder layout at the root level. If the
multiple keyword is set in the tree widget then I have problems with
where the duplicate folder layout gets realized if one of the leaf
widgets is selected. I tried unselecting the selected leaf widget
prior to adding the folder hierarchy but this does not solve the
problem.

I have found that this problem does not occur on LINUX but only on
WINDOWS. (might be a useful hint there...?)

If the description above does not make sense I hope the code below
will help...

The code at the end of this message illustrates the problems I'm
having. To run it, compile it and type TREE_WIDGET_TEST,MULT = 1.
The keyword MULT simply tells the tree widget to allow multiple
leaf/folder selections. Select one of the leaves (labeled DATA) and
then press the button labeled ADD_FOLDER. What I want to happen is
for a whole new hierarchy of folders to appear at the root level. It
actually appears under the leaf that was selected. Now if you run the
program with the keyword MULT=0 you get the desired behavior.
Unfortunately I want to be able to select multiple files AND be able
to put in the new folder hierarchy. Can I have my cake and eat it
too? Any help would be greatly appreciated.

Thanks,

Rob

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tt_add_folder,event
file_tree = widget_info(event.top,find_by_uname = 'FILE_TREE')
group = widget_tree(file_tree,value = 'Data Group',/folder,$
/expanded)
leaf1 = widget_tree(group, value = 'Data')
leaf2 = widget_tree(group, value = 'Data')
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tt_event,event
uname = widget_info(event.id,/uname)
case uname of
'QUIT': widget_control,event.top,/destroy
'ADD_FOLDER': tt_add_folder,event
else:
endcase
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tree_widget_test,mult = mult
if n_elements(mult) eq 0 then mult = 0
register_name = 'tw_test'
tlb = widget_base(title = 'Tree Widget Test',/col,/tlb_frame_attr)
tree_base = widget_base(tlb,/col)
file_tree = widget_tree(tree_base,multiple = mult,uname = 'FILE_TREE')

group = widget_tree(file_tree,value = 'Data Group',/folder,$
/expanded)
leaf1 = widget_tree(group, value = 'Data')
leaf2 = widget_tree(group, value = 'Data')
void = widget_button(tlb,value = 'ADD FOLDER',uname = 'ADD_FOLDER')
void = widget_button(tlb,value = 'QUIT',uname = 'QUIT')
widget_control,tlb,/realize
xmanager,register_name,tlb,/no_block,event_handler = 'tt_event'
end
Re: Tree widget woes [message #37391 is a reply to message #37281] Mon, 15 December 2003 06:49 Go to previous messageGo to next message
robert.dimeo is currently offline  robert.dimeo
Messages: 42
Registered: November 2001
Member
robert.dimeo@nist.gov (Rob Dimeo) wrote in message news:<cb539436.0312120837.5f2aa843@posting.google.com>...

> then press the button labeled ADD_FOLDER. What I want to happen is
> for a whole new hierarchy of folders to appear at the root level. It
> actually appears under the leaf that was selected. Now if you run the
> program with the keyword MULT=0 you get the desired behavior.
> Unfortunately I want to be able to select multiple files AND be able
> to put in the new folder hierarchy. Can I have my cake and eat it
> too? Any help would be greatly appreciated.
>

So I guess I'll reply to my own posting with a workaround (the silence
was deafening...anyone else out there using the tree widgets?). The
code below shows how I implemented the workaround. The idea is to add
a folder (node) at the root level and make all additional folders
children of that one. I would rather not have to put in the root
folder but it's the only fix that I could come up with.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tt_add_folder,event
; Get the widget id of the root node...
root = widget_info(event.top,find_by_uname = 'ROOT')
; and make the additional folders and leaves children of the root.
group = widget_tree(root,value = 'Data Group',/folder,$
/expanded)
leaf1 = widget_tree(group, value = 'Data')
leaf2 = widget_tree(group, value = 'Data')
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tt_event,event
uname = widget_info(event.id,/uname)
case uname of
'QUIT': widget_control,event.top,/destroy
'ADD_FOLDER': tt_add_folder,event
else:
endcase
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tree_widget_test,mult = mult
if n_elements(mult) eq 0 then mult = 0
register_name = 'tw_test'
tlb = widget_base(title = 'Tree Widget Test',/col,/tlb_frame_attr)
tree_base = widget_base(tlb,/col)
file_tree = widget_tree(tree_base,multiple = mult,uname = 'FILE_TREE')
; Define the root node...
root = widget_tree(file_tree,value = 'Root',/folder,/expanded, $
uname = 'ROOT')
; and make all the rest children of that node
group = widget_tree(root,value = 'Data Group',/folder,$
/expanded)
leaf1 = widget_tree(group, value = 'Data')
leaf2 = widget_tree(group, value = 'Data')
void = widget_button(tlb,value = 'ADD FOLDER',uname = 'ADD_FOLDER')
void = widget_button(tlb,value = 'QUIT',uname = 'QUIT')
widget_control,tlb,/realize
xmanager,register_name,tlb,/no_block,event_handler = 'tt_event'
end
Re: Tree widget woes [message #37425 is a reply to message #37391] Thu, 18 December 2003 05:13 Go to previous messageGo to next message
robert.dimeo is currently offline  robert.dimeo
Messages: 42
Registered: November 2001
Member
robert.dimeo@nist.gov (Rob Dimeo) wrote in message news:<cb539436.0312150649.442558b5@posting.google.com>...
> robert.dimeo@nist.gov (Rob Dimeo) wrote in message news:<cb539436.0312120837.5f2aa843@posting.google.com>...

>
> So I guess I'll reply to my own posting with a workaround (the silence
> was deafening...anyone else out there using the tree widgets?). The
> code below shows how I implemented the workaround. The idea is to add
> a folder (node) at the root level and make all additional folders
> children of that one. I would rather not have to put in the root
> folder but it's the only fix that I could come up with.

Hi again,

The good folks at RSI have contacted me that this is indeed a bug and
is being investigated.

Rob
Re: Tree widget woes [message #37490 is a reply to message #37425] Mon, 22 December 2003 13:09 Go to previous message
robert.dimeo is currently offline  robert.dimeo
Messages: 42
Registered: November 2001
Member
robert.dimeo@nist.gov (Rob Dimeo) wrote in message news:<cb539436.0312180513.60ecac74@posting.google.com>...
> robert.dimeo@nist.gov (Rob Dimeo) wrote in message news:<cb539436.0312150649.442558b5@posting.google.com>...
>> robert.dimeo@nist.gov (Rob Dimeo) wrote in message news:<cb539436.0312120837.5f2aa843@posting.google.com>...
>
>>
>> So I guess I'll reply to my own posting with a workaround (the silence
>> was deafening...anyone else out there using the tree widgets?). The
>> code below shows how I implemented the workaround. The idea is to add
>> a folder (node) at the root level and make all additional folders
>> children of that one. I would rather not have to put in the root
>> folder but it's the only fix that I could come up with.
>
> Hi again,
>
> The good folks at RSI have contacted me that this is indeed a bug and
> is being investigated.
>
> Rob

Hi again,

Thanks to the technical support at RSI for pointing out a workaround
for the tree widget problem. The workaround is to de-select the
entire tree widget prior to adding a new node. The modified code with
this workaround is listed below. Also they indicate that this bug is
fixed in 6.1.

Rob

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tt_add_folder,event
file_tree = widget_info(event.top,find_by_uname = 'FILE_TREE')
; Here comes the workaround....
widget_control, file_tree, set_tree_select = 0
; That's all there is to it!
group = widget_tree(file_tree,value = 'Data Group',/folder,$
/expanded)
leaf1 = widget_tree(group, value = 'Data')
leaf2 = widget_tree(group, value = 'Data')
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tt_event,event
uname = widget_info(event.id,/uname)
case uname of
'QUIT': widget_control,event.top,/destroy
'ADD_FOLDER': tt_add_folder,event
else:
endcase
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro tree_widget_test,mult = mult
if n_elements(mult) eq 0 then mult = 0
register_name = 'tw_test'
tlb = widget_base(title = 'Tree Widget Test',/col,/tlb_frame_attr)
tree_base = widget_base(tlb,/col)
file_tree = widget_tree(tree_base,multiple = mult,uname = 'FILE_TREE')

group = widget_tree(file_tree,value = 'Data Group',/folder,$
/expanded)
leaf1 = widget_tree(group, value = 'Data')
leaf2 = widget_tree(group, value = 'Data')
void = widget_button(tlb,value = 'ADD FOLDER',uname = 'ADD_FOLDER')
void = widget_button(tlb,value = 'QUIT',uname = 'QUIT')
widget_control,tlb,/realize
xmanager,register_name,tlb,/no_block,event_handler = 'tt_event'
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: test, please ignore
Next Topic: Re: Array has too many elements?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 07:42:57 PDT 2025

Total time taken to generate the page: 1.44035 seconds