Why are graphic positions not observable properties?
Back story: I am trying to port dialog boxes based on uicontrols to their uifigure equivalents: uilabel, uibutton, etc. The old system allowed you to size items based on the text contained within using the Extent property. For example, one could add a button with the String ‘Apply’, adjust the position to accomodate that text, and then size the figure as needed. Newer components lack an Extent property, and the closest I can come to that feature is stacking things in a uigridlayout using ‘fit’ for the row height and column width. However, there is noticeable lag, around a second or so, between when the component is created and grid sizing. The attached function illustrates this with a separate plot showing how long it takes for a uilable’s width/height to change from its default value.
I thought one would be able to add a listener to the grid or component contained within to see when sizing is complete. However, the Position property is not an observable property for the grid layout or a uilable inside. Is there some reason for that? The lag is bad enough, but at least I could keep the figure hidden until all resizing is complete. Right now I have to guess as to how long this might take, put in a manual delay, and then hope all layout grids are done changing before sizing the figure based on what is inside.
FWIW I am using the latest update of R2024b with the desktop beta on a Mac.Back story: I am trying to port dialog boxes based on uicontrols to their uifigure equivalents: uilabel, uibutton, etc. The old system allowed you to size items based on the text contained within using the Extent property. For example, one could add a button with the String ‘Apply’, adjust the position to accomodate that text, and then size the figure as needed. Newer components lack an Extent property, and the closest I can come to that feature is stacking things in a uigridlayout using ‘fit’ for the row height and column width. However, there is noticeable lag, around a second or so, between when the component is created and grid sizing. The attached function illustrates this with a separate plot showing how long it takes for a uilable’s width/height to change from its default value.
I thought one would be able to add a listener to the grid or component contained within to see when sizing is complete. However, the Position property is not an observable property for the grid layout or a uilable inside. Is there some reason for that? The lag is bad enough, but at least I could keep the figure hidden until all resizing is complete. Right now I have to guess as to how long this might take, put in a manual delay, and then hope all layout grids are done changing before sizing the figure based on what is inside.
FWIW I am using the latest update of R2024b with the desktop beta on a Mac. Back story: I am trying to port dialog boxes based on uicontrols to their uifigure equivalents: uilabel, uibutton, etc. The old system allowed you to size items based on the text contained within using the Extent property. For example, one could add a button with the String ‘Apply’, adjust the position to accomodate that text, and then size the figure as needed. Newer components lack an Extent property, and the closest I can come to that feature is stacking things in a uigridlayout using ‘fit’ for the row height and column width. However, there is noticeable lag, around a second or so, between when the component is created and grid sizing. The attached function illustrates this with a separate plot showing how long it takes for a uilable’s width/height to change from its default value.
I thought one would be able to add a listener to the grid or component contained within to see when sizing is complete. However, the Position property is not an observable property for the grid layout or a uilable inside. Is there some reason for that? The lag is bad enough, but at least I could keep the figure hidden until all resizing is complete. Right now I have to guess as to how long this might take, put in a manual delay, and then hope all layout grids are done changing before sizing the figure based on what is inside.
FWIW I am using the latest update of R2024b with the desktop beta on a Mac. graphics, slow, listener MATLAB Answers — New Questions