How do I specify the location of a LISTDLG?

21 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 7 Juin 2012
I would like to specify the location of a LISTDLG. How can I do that?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 18 Avr 2018
The "listdlg" function currently does not support changing the position of the LISTDLG dialog box that it creates. This is true for other functions that create dialog boxes, such as, "inputdlg". As a work-around you need to modify "listdlg.m". The attached MATLAB file "listdlg2.m" is a good place to start if you want to modify other such functions. The file includes comments for the sections of the code that need to be changed to customize the position of the LISTDLG dialog box. The commented code segments are headed by %Custom Changes on lines 71, 108, and 200.
Please note that these changes have not been tested extensively and may affect the functionality of MATLAB. We are not able to guarantee that the modified "listdlg2.m" MATLAB file will work with other built-in MATLAB functions.
Here are the steps:
1. Find the $MATLABROOT directory where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing
matlabroot
at the MATLAB Command Prompt.
2. Quit MATLAB.
3. Navigate to the following location:
MATLABROOT\toolbox\matlab\uitools
4. Download the attached file. Place the new file in the same directory mentioned in step 3. You might need administrative privilege for this step. In that case, you can open a text editor as an administrator and copy-paste the contents of "listdlg2.m" in a new file and save that one in this location.
5. Restart MATLAB
6. After restarting MATLAB, issue the following command at the MATLAB Command Prompt:
rehash toolboxcache
With this new function you can pass the position of the LISTDLG box as an input argument:
[s, v] = listdlg2( ..., 'position', [left bottom width height]); % usual 1x4 vector for defining position of a figure in MATLAB
If you do not pass the "position" argument then this function should behave same as the "listdlg" function.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by