EasyGUI コードの詳細な読み取りに基づいて、他のものではなく、Figure ウィンドウ全体を GUI の親として使用するようgui.manualgui
に見えます。(たぶん私が間違っているかもしれませんが、 and以外にサブクラス化された他のファイルは見当たりません。gui.container
uicontainer
gui.container
autogui
manualgui
しかし、運が良さそうです!コードのgui.container
コンストラクターには次のものが含まれています。
elseif ishandle(uihandle) && strmatch(get(uihandle,'type'), ...
{'figure', 'uipanel', 'uicontainer', 'uiflowcontainer', 'uigridcontainer'})
obj.UiHandle = uihandle;
gui.container
これは、オブジェクトがオブジェクトの子として作成されるシナリオがあることを意味しuipanel
ます。ハンドル グラフィックス オブジェクトを受け入れて の代わりにgui.manualgui
新しいオブジェクトを作成し、それをスーパークラス コンストラクターに渡すようにコンストラクターを変更しました。uipanel
figure
function obj = manualgui(hg)
if exist('hg', 'var')
h = uipanel(...
'Parent', hg);
else
h = figure(...
'Name', 'gui.manualgui', ...
'BackingStore' , 'off', ...
'DockControls' , 'off', ...
'NumberTitle' , 'off', ...
'MenuBar' , 'none', ...
'Resize' , 'on', ...
'Visible' , 'on', ...
'WindowStyle' , 'normal');
end
obj@gui.container(h);
end
次に、コンストラクターにいくつかのコードを追加して、Figure の一部のプロパティ (つまり ) が(つまり) のプロパティではないgui.container
という事実を説明します。Color
uipanels
BackgroundColor
function obj = container(uihandle)
if ~exist('uihandle', 'var')
obj.UiHandle = figure();
elseif ishandle(uihandle) && strcmp(get(uihandle, 'tag'), 'EasyGUIContainer')
% return the existing instance
obj = get(uihandle, 'userdata');
return;
elseif ishandle(uihandle) && strmatch(get(uihandle,'type'), ...
{'figure', 'uipanel', 'uicontainer', 'uiflowcontainer', 'uigridcontainer'})
obj.UiHandle = uihandle;
else
throw(MException('container:InvalidHandle', 'Invalid HG handle'));
end
% Backgroundcolor is the same as used by GUIDE
if ishandle(uihandle) && strcmp(get(uihandle,'type'), ...
'uipanel')
set(obj.UiHandle, 'units', 'pixels', ...
'tag', 'EasyGUIContainer', ...
'backgroundcolor', [0.8314 0.8157 0.7843], ...
'userdata', obj, ...
'DeleteFcn', @(h,e) delete(obj));
else
set(obj.UiHandle, 'units', 'pixels', ...
'tag', 'EasyGUIContainer', ...
'color', [0.8314 0.8157 0.7843], ...
'userdata', obj, ...
'DeleteFcn', @(h,e) delete(obj));
end
end
freq1
あなたの例でオブジェクトをインスタンス化しようとしました。これは、gui.manualgui
オブジェクトではなくオブジェクトを使用しているためですgui.autogui
。これを拡張して作業できる可能性がautogui
あります。私は MATLAB を利用できる場所で仕事を離れようとしているので、今はしませんでした。これはそれほど簡単なことではありません。上記の変更を行った後、この図を作成するために使用した最終的なコードは次のとおりです。
fh = figure('Units', 'normalized', ...
'OuterPosition', [0.1 0.2 0.4 0.4], ...
'Toolbar', 'none', 'Menu', 'none');
% ------------------Create Tabs---------------------
p = uiextras.TabPanel('Parent', fh); % Tab Component
Tab1 = uiextras.HBox('Parent', p); % 1st Tab
Tab2 = uiextras.HBox('Parent', p); % 2nd Tab - Horiz Box
Tab3 = uiextras.HBox('Parent', p); % 3rd Tab - Horiz Box
Tab4 = uiextras.HBox('Parent', p); % 4th Tab - Horiz Box
Tab5 = uiextras.HBox('Parent', p); % 5th Tab - Horiz Box
Tab6 = uiextras.HBox('Parent', p); % 6th Tab - Horiz Box
myGui = gui.manualgui(Tab2);
freq1 = gui.slider('Frequency 1 (Hz)', [1 40], myGui);
% freq2 = gui.slider('Frequency 2 (Hz)', [1 40]);
% phaseDiff = gui.numericmenu('Phase difference (degrees)', 0:30:180);
% plotType = gui.textmenu('Lissajous plot type', {'2d-phase', '2d-comet'});
結果は次のとおりです。

明らかに、スライダーを自分で手動で配置するか、正しいハンドルグラフィックスオブジェクトを使用するように変更する必要があるのmanualgui
ではなく、私が使用しているためです。autogui
autogui