Inputdlg function - how to edit it to fit to screen.

5 ビュー (過去 30 日間)
E
E 2011 年 2 月 7 日
I am trying to edit inputdlg function in order to get the dialogue box to fit to screen. Would love some help, as I keep editing the figure width and height but there seems to be some restriction somewhere in the code that I can't spot.
Has anyone done this before?

回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 2 月 7 日
inputdlg() calculates how much space it needs and then calls upon the utility routine getnicedialoglocation() to position that space upon the screen.
In order to get this to work, you will probably need to use the Options argument using the Resize and WindowStyle sub-options so that you get a non-model dialog. But before calling on inputdlg(), fire up a timer that will search for the dialog and resize it (timers interrupt.)
Or just hack the source near line 288 where it calls the getnicedialoglocation() function and toss in your own sizing.

E
E 2011 年 2 月 8 日
After playing around for a while, it seems the best option was adding the following line of code:
set(InputFig,'Position',[1 1 1280 1024])
just before line 328 where it calls to 'drawnow;'
The input box and input text is still needs to be centered if this is done though.
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 2 月 8 日
Instead of [1 1 1280 1024],
t = get(0,'MonitorPosition');
set(InputFig, 'Position', t(1,:) + [0 1 0 0])
This does force the first monitor, but if you want to be playing around with "full screen" when you have multiple monitors, you need be more specific about what that means.

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

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by