Skip to content

Add support for controls whose parent is not the uifigure. #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

davidn-IA
Copy link

This allows, for example, a text area inside a panel, to have the text
formatted with bold face font. Previously this caused an error.

f = uifigure('Position', [680 558 560 420]);
p = uipanel(f,'Position',[20 20 520 380]);
txa = uitextarea(p, ...
'Value', 'Lorem ipsum', ...
'Position',[20 20 480 340]);
mlapptools.fontWeight(txa, 'bold');

This allows, for example, a text area inside a panel, to have the text
formatted with bold face font.  Previously this caused an error.

f = uifigure('Position', [680 558 560 420]);
p = uipanel(f,'Position',[20 20 520 380]);
txa = uitextarea(p, ...
'Value', 'Lorem ipsum', ...
'Position',[20 20 480 340]);
mlapptools.fontWeight(txa, 'bold');
@sco1
Copy link
Member

sco1 commented Jan 2, 2018

Thanks for the catch, we haven't looked too much at UI elements that aren't direct children of the UIFigure object.

I would prefer to use ancestor if you'd like to update & repoint the PR with something like the following instead:

function [win] = getWebWindow(hUIObj)
    hUIFig = ancestor(hUIObj, 'figure');

If not, I can add & push sometime this afternoon.

@altmany
Copy link

altmany commented Jan 2, 2018

Hi @davidn-IA, nice to see you here :-)

I think it would be better to leave the existing code as-is (i.e., a simple call to mlapptools.getWebWindow) and simply modify getWebWindow() to look not at the input arg directly but rather its figure ancestor (along the lines of what @sco1 just commented above)

@sco1
Copy link
Member

sco1 commented Jan 2, 2018

Thanks @altmany, that makes more sense. I forgot that there are multiple calls to getWebWindow so it's smarter to fix there :)

I've updated my comment above.

@davidn-IA
Copy link
Author

Did not realize ancestor worked with uifigure, thanks @sco1. @altmany , it's about time I give something back. :-)

So maybe close this and re-post as an issue to fix getWebWindow? (also please see the other issue I posted, thanks!)

@Dev-iL
Copy link
Member

Dev-iL commented Jan 2, 2018

@davidn-IA Feel free to add another commit to this PR to save time. When merging we'll just squash :)

@sco1 sco1 requested review from sco1 and Dev-iL January 2, 2018 17:38
@sco1 sco1 added the bug label Jan 2, 2018
@sco1
Copy link
Member

sco1 commented Jan 3, 2018

Fix has been implemented & pushed with 88b82f6 (fat-fingered the commit message reference)

This can be closed, thanks again for spotting the issue!

@sco1 sco1 closed this Jan 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants