Problems in my GUI. I use uisplitpane function to create flexible panels and tabs but, when I try to put a tree into a tab and resize it, it doesn't work.

1 view (last 30 days)
Hello
I'm working on a GUI which simply includes a graphical area and a tree. I'm using uisplitpane by Y.Altman and uipanel and uitab from undocumented matlab functions. The tree is generated within a tab. I get no error when running my script but I cannot see the tree correctly within the tab if I try to move panes or resize the figure. It seems it is independent from the panel which is its parent. See the example below. I also followed this tread
but I'm unable to find a solution as I'm not expert in programming. I’m using R2012b.
Can anyone help me please?
Michele
Matlab script:
NOTE: The uisplitpane function, necessary to compile my code,can be found at:
%% code:
h = figure('Units','normalized','Position',[.1 .1 .3 .5],'Name','MyGUI',... 'dockcontrol','off','menubar','figure');
% Split figure
[hDown,hUp,hDiv1]=uisplitpane(h,'Orientation','ver');
hDiv1.DividerLocation = 0.3;
% Split again
[hLeft,hRight,hDiv2]=uisplitpane(hUp,'Orientation','hor');
hDiv2.DividerLocation = 0.4;
drawnow
% Create panel for each subfigure
hp1 = uipanel('Parent',hLeft,'Title','Panel 1','FontSize',7,... 'Units', 'normalized','Position',[0 0 1 1]);
hp2 = uipanel('Parent',hRight,'Title','Panel 2','FontSize',7,... 'Units', 'normalized','Position',[0 0 1 1]);
hp3 = uipanel('Parent',hDown,'Title','Plot Area','FontSize',7,... 'Units', 'normalized','Position',[0 0 1 1]); % Generate plot sample
t=0:.1:10; hax1=axes('Parent',hp3); plot(t,sin(t)); title('SIN(X)');
% Add Tabs
hTabGroup = uitabgroup(hp1);
tab1 = uitab(hTabGroup,'title','Tree 1');
tab2 = uitab(hTabGroup,'title','Tree 2');
% Add panel to each tab
hp4 = uipanel('Parent',tab1,... 'Units','normalized','Position',[0 0 1 1]); % panel in tab1 hp5 = uipanel('Parent',tab2,... 'Units','normalized','Position',[0 0 1 1]); % panel in tab2 set(hTabGroup,'SelectedTab',tab1);
%% TREE
% Fruits
fruits = uitreenode('v0', 'Fruits', 'Fruits', [], false);
fruits.add(uitreenode('v0', 'Apple', 'Apple', [], true));
fruits.add(uitreenode('v0', 'Pear', 'Pear', [], true));
% Vegetables
veggies = uitreenode('v0', 'Veggies', 'Vegetables', [], false);
veggies.add(uitreenode('v0', 'Potato', 'Potato', [], true));
veggies.add(uitreenode('v0', 'Tomato', 'Tomato', [], true));
% Root node
root = uitreenode('v0', 'Food', 'Food', [], false);
root.add(veggies);
root.add(fruits);
[mtree, container] = uitree('v0', 'Root', root);
set(container,'Parent',hp4)
set(container,'Units','normalized','Position', [0 0 1 1]);

Answers (0)

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!