私は最初の GUI をuifigure
(プログラムではなく、appdesigner
[しかし、関連しているのでキーワードとして追加しました]) で開発しようとしていますが、(予想どおり) によって提供される拡張機能とウィジェットの一部が欠けています標準 Java Figure 用のGUI レイアウト ツールボックスとウィジェット ツールボックス。
そこで、私が開発したいくつかのウィジェットを に変更しようとしましたuifigure
が、GUI Layout Toolboxのとuigridlayout
を置き換えるのに非常に便利なようです。uix.VBox
uix.HBox
標準的な Java の図については、クラスMyWidget
とそれに対応するインスタンスmywidget
があると仮定します。MyWidget
最後に、の祖先は、の動作をカスタマイズするためにオーバーライドできるメソッドをmatlab.ui.container.internal.UIContainer
提供しますaddChild
uicontrol(mywidget)
コンポーネントについても同じものを探していuifigure
ます。から派生した次のクラスを想定します。これは、呼び出しmatlab.ui.container.GridLayout
の結果のクラスです。uigridlayout
classdef MyGrid < matlab.ui.container.GridLayout
methods
function self = MyGrid(varargin)
self = self@matlab.ui.container.GridLayout(varargin{:});
end
end
methods ( Access = protected )
function addChild(self, child)
disp('hooray');
addChild@matlab.ui.container.GridLayout(self, child);
end
end
end
MyGrid
インスタンスを開始するとき
g = MyGrid()
すべてが良さそうです:
g =
MyGrid with properties:
RowHeight: {'1x' '1x'}
ColumnWidth: {'1x' '1x'}
addChild
ただし、子を追加してもメソッドは呼び出されません。
>> uibutton(g)
ans =
Button (Button) with properties:
Text: 'Button'
Icon: ''
ButtonPushedFcn: ''
Position: [100 100 100 22]
注:hooray
上記の出力はありません。プロパティはParent
正しいです:
>> ans.Parent
ans =
MyGrid with properties:
RowHeight: {'1x' '1x'}
ColumnWidth: {'1x' '1x'}
Show all properties
このことから、子を追加するためにaddChild
(少なくとも によって) 使用される方法ではないと思います。matlab.ui.container.GridLayout
uifigure
コンポーネント内のコンテナに子を追加するメカニズムを知っている人はいますか?