Skip to content

Commit

Permalink
bug fix for uicontextmenu in Condition and Field Panels
Browse files Browse the repository at this point in the history
  • Loading branch information
jaib1 committed Mar 29, 2019
1 parent 7259eef commit 64b81ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions +eui/ConditionPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@
% See also EUI.PARAMEDITOR, EUI.FIELDPANEL
obj.ParamEditor = ParamEditor;
obj.UIPanel = uix.VBox('Parent', f);
% Create a child menu for the uiContextMenus
c = uicontextmenu;
% Create a child menu for the uiContextMenus. The input arg is the
% figure holding the panel
c = uicontextmenu(ancestor(f, 'Figure'));
obj.UIPanel.UIContextMenu = c;
obj.ContextMenus = uimenu(c, 'Label', 'Make Global', ...
'MenuSelectedFcn', @(~,~)obj.makeGlobal, 'Enable', 'off');
Expand Down
2 changes: 1 addition & 1 deletion +eui/FieldPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
% See also ONEDIT, EXP.PARAMETERS/TITLE, EUI.PARAMEDITOR/BUILDUI
if nargin < 3; type = 'edit'; end
if isempty(obj.ContextMenu)
obj.ContextMenu = uicontextmenu;
obj.ContextMenu = uicontextmenu(ancestor(obj.UIPanel, 'Figure'));
uimenu(obj.ContextMenu, 'Label', 'Make Conditional', ...
'MenuSelectedFcn', @(~,~)obj.makeConditional);
end
Expand Down

3 comments on commit 64b81ab

@k1o0
Copy link
Contributor

@k1o0 k1o0 commented on 64b81ab Mar 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish you'd made a pull request about this on the paramUI branch: there are a number of relevant changes I could have made. Also did you re-run the tests?

@jkbhagatio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

figured it was a quick fix and we talked about making small bug fixes directly to the 'dev' branch? What other changes do you mean - you could still add them to the paramUI branch after pulling this commit into there? And yes I did re-run the tests, though I suppose I should have added a new test which would showcase this fix. I'll do that.

@k1o0
Copy link
Contributor

@k1o0 k1o0 commented on 64b81ab Mar 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's okay. I didn't know about 'ancestor' so I've been storing the figure handle as a property. I'll make some changes and push them to that branch next week

Please sign in to comment.