Re: how to create a Hierarchical data model in the ListBox
- From: venky.iitd@xxxxxxxxx
- Date: Tue, 23 Dec 2008 22:55:21 -0800 (PST)
On Dec 22, 10:17 pm, Walter Roberson <rober...@xxxxxxxxxxxx> wrote:
venky.i...@xxxxxxxxx wrote:
I want to create a Hierarchical data model in the GUI using ListBox.
Like
hListBox = uicontrol('Style','listBox','Position',[20 80 150
250],'String',{'Item1','Item2','Item3'})
Now if I click Item1, under this I want to display a sub-list
{'item1.1', 'item1.2'} (something like the list of folders appear in
the windows Folders Explorer) and If I click item1.1, then a
corresponding callback function needs to be invoked.
Is it possible to do this using Listbox or do I need to create it
using some other method?
It is not directly possible with uicontrol('Style','listbox'). Perhaps you
might find uicontextmenu() and uimenu() useful in this matter.
Note: when you create a listbox, the Callback is the same for every item
in the list. However, that callback could have been programmed to know that some
of the entries had sub-menus, and could set an existing second listbox Visible
to present the second layer. However, if you mouse out of the second listbox
then it would not know enough to disappear.
--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?
Hi,
thanks for your reply walter.
I think I need to explain my scenario in more detail.
I don't want to add something in menu item or Right click options to
an object. So using uimenu() and uicontextmenu() is not solving my
purpose. In a figure window, I need to display some items at some
Position.
If I click one item, then it's sub items are to be shown just under it
(as sub-items) and if I click the MainItem again, it should be
contracted. And there should be some provision in the callback
function to know which item/sub-item is selected (like 'Value' in
listBox Callback), so that the corresponding item function is invoked.
It seems as bit complicated. If there is any means of doing this in
matlab gui, suggest me.
thanks
.
- Follow-Ups:
- Re: how to create a Hierarchical data model in the ListBox
- From: matt dash
- Re: how to create a Hierarchical data model in the ListBox
- References:
- how to create a Hierarchical data model in the ListBox
- From: venky . iitd
- Re: how to create a Hierarchical data model in the ListBox
- From: Walter Roberson
- how to create a Hierarchical data model in the ListBox
- Prev by Date: Re: loading images
- Next by Date: nike air max 87, nike air max ltd, Nike Air Max series, Nike Air Max
- Previous by thread: Re: how to create a Hierarchical data model in the ListBox
- Next by thread: Re: how to create a Hierarchical data model in the ListBox
- Index(es):
Relevant Pages
|