Strange behavior of graphical objects in GUI after launch of application

2 ビュー (過去 30 日間)
andreadr
andreadr 2018 年 4 月 9 日
回答済み: laiba 2024 年 7 月 29 日
I'm developing the GUI for a Matlab application. I'm not using GUIDE or App Designer, as I needed more flexibility.
As a general way of coding, my window figures are created with the Visible property set to off, children objects are declared, set and then moved programmatically to their right position. Only at the end, the Visible property set to on.
Everything seems to work quite good, except for a strange particular: every time the deployed app is launched, or when the GUI code is launched from Matlab for the first time (after Matlab startup), the main window is created and, after being made visible, all the figure content is slightly resized a couple of times, before the correct sizes and positions are reached (the whole process taking a couple of seconds).
I tried to use the drawnow command in several ways and positions in order to "freeze" all objects properties before setting Visible, but nothing seems to work. It seems the
hFig.Visible = 'on';
command triggers the strange "trembling" behavior (or at least it triggers the triggering mechanism). Also, the fact that this happens in Matlab but only on the first run seems related to the specific new Matlab session (which is coherent with the fact that it happens all the times with the standalone application).
Any clue for the reason of this behaviour and/or possible ways to fix it? I know is not a big deal, but is quite annoying and unpleasant to see.
  2 件のコメント
Stephen23
Stephen23 2018 年 5 月 10 日
編集済み: Stephen23 2018 年 5 月 11 日
@andreadr: what MATLAB version are you using? What OS are you using? Did you change any renderer settings?
andreadr
andreadr 2018 年 5 月 11 日
@Stephen Cobeldick:
I'm mostly using R2017b on Windows.
Actually I don't remember changing any renderer settings, but I cannot exclude it. What kind of settings are you thinking about?

サインインしてコメントする。

回答 (1 件)

laiba
laiba 2024 年 7 月 29 日
originalImage = imread('NSWPremierStateNumberPlate.jpg');
grayImage = rgb2gray(originalImage);
edgeImage = edge(grayImage, 'Canny');
boundaries = bwboundaries(edgeImage);
results = ocr(numberPlateRegion);
disp(results.Text);

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by