Re: how to create a Hierarchical data model in the ListBox



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
.



Relevant Pages

  • Re: how to create a Hierarchical data model in the ListBox
    ... under this I want to display a sub-list ... the windows Folders Explorer) and If I click item1.1, ... when you create a listbox, the Callback is the same for every item ...
    (comp.soft-sys.matlab)
  • Re: error 3048 - Cannot open any more databases
    ... The combo that uses the callback function as its RowSourceType will still be able to display the desired data. ... What happens is that you load the static array one, and then it calls the callback function whenever it needs a value. ... I am using these combo boxes not only as a way of selecting a ... > the same subform, just inserted 48 times. ...
    (microsoft.public.access.formscoding)
  • Re: get text from listbox
    ... it is drug data and you would it recognize directy if you had found ... database entry displayed by the respective list entry. ... At least this is the way>I< would code such listbox... ... shouldn't be very difficult if you know the font properties used to display ...
    (microsoft.public.vb.winapi)
  • Re: Having trouble populating listboxes
    ... At the end I want to put in a couple of other items in the listbox that are not in the dataset. ... Value of type '2-dimensional array of String' cannot be converted to '1-dimensional array of System.Object' because the array types have different numbers of dimensions. ... It uses the toString of the object as the display member. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Using a List Box to Select Data in a Subform
    ... The purpose of the list box is to display the actual name of the dispatch ... listbox will then be used as the form of navigation for the subform. ... Lets say I have this data in tblInfo: ... If Anaheim County is clicked in the list box, ...
    (microsoft.public.access.forms)