How can I make sure that the print command associated with pushbutton callback does not distort my GUI when resized?
1 view (last 30 days)
Show older comments
I have created a GUI using GUIDE. The figure contains static text box placed at the top of the figure window and a button. The button callback includes the following command:
print -dbitmap -loose
When I run the GUI and click on the button, the PRINT command executes as expected. However, when I resize the GUI and push the button, the GUI is distorted and the Static text box is moved out of the screen at the top.
Accepted Answer
MathWorks Support Team
on 21 Jan 2010
The PRINT command goes through several steps to print UICONTROLS. One of these steps is to take a picture of the UICONTROLS so it can be drawn into the printout. In order to take a picture, PRINT tries to push the entire figure onto the screen. When the figure is maximized, sometimes PRINT command fails to reliably take the picture of the UICONTROLS causing the text box to be pushed off the top of the screen.
One way to work around the issue is to include a callback for "ResizeFcn" of the GUI figure window. In this specific case, the height of the static text box can be a constant (34 pixels for example) and only the width can be made to change when the figure is resized. The "ResizeFcn" callback ensures that the static text box is 34 pixels high, as wide as the figure, and always attached to the top of the figure.
0 Comments
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!