octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49143] inputdlg processes 2 element row vecto


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #49143] inputdlg processes 2 element row vector rowscols input as heights instead of height and width
Date: Wed, 14 Sep 2022 15:25:43 -0400 (EDT)

Update of bug #49143 (project octave):

                  Status:                   Fixed => Confirmed              
             Open/Closed:                  Closed => Open                   
                 Release:               4.2.0-rc1 => dev                    
                 Summary: inputdlg does not handle well vectors => inputdlg
processes 2 element row vector rowscols input as heights instead of height and
width

    _______________________________________________________

Follow-up Comment #13:

yes, [1 60; 1 30; 1 30] is the 'array input' option that both accept and treat
the same. one row per prompt element, col 1 is height, col 2 is width. the
issue seems to just be with what Matlab does with a 2 element row vector.

I've read through the public facing help and the examples more closely, and I
think matlab's behavior is 'correct' and documented, but they have conflicting
documentation. I'll submit a doc correction bug report to mathworks. Octave
followed that conflicting piece, hence the current bug. Full explanation
below.

I'm going to reopen the bug report for now since it's close enough to the
original problem. 


Matlab doc text currently states:  

First:

answer = inputdlg(prompt,dlgtitle,dims) specifies the height of each edit
field when dims is a scalar value. When dims is an array, the first value in
each array element sets the edit field height. The second value in each array
element sets the edit field width.


Then later, specifically defining 'dims':

Text edit field height and width (dimensions), specified as one of these
values:

* If dims is a scalar, then it specifies the height for all edit fields.
Height is the distance between the baselines of two lines of text. The width
for all edit fields is the maximum that the dialog box allows.

* If dims is a column vector or row vector, then each element specifies the
height of each corresponding edit field from the top to the bottom of the
dialog box. The width for all edit fields is the maximum that the dialog box
allows.

* If dims is an array, then it must be size m-by-2, where m is the number of
prompts in the dialog box. Each row refers to the edit field for the
corresponding prompt. The first column specifies the height of the edit field
in lines of text. The second column specifies the width of that edit field in
character units. The width of a character unit equals the width of the letter
x when using the system font.


Octave's help indicates that it followed the second set of instructions in
it's implementation. However, the very first example on that page matches the
comment #8 input triggering an error in Octave:


prompt = {'Enter matrix size:','Enter colormap name:'};
dlgtitle = 'Input';
dims = [1 35];
definput = {'20','hsv'};
answer = inputdlg(prompt,dlgtitle,dims,definput)


note that it has two prompts, and a single dim array, a 2 element row vector.
Octave interprets this as the height (number of rows) of each prompt field,
with the first 1 high, the other 35 high.  Matlab displays two prompts both
sized to 1 high, 35 wide. So it matches the first statement in their help, but
not the second. 

proposing that we adjust the behavior to match the documented example.  a 2
element row vector is treated with the 'array' rules, implicitly expanded to
each input prompt.

other examples to verify:


answer = inputdlg({'first', 'second', 'third'},'sample',[1; 10; 4])
--> Matlab: 3 prompts, heights 1, 10, and 4.
--> Octave: same

answer = inputdlg({'first', 'second', 'third'},'sample',[1, 10, 4])
--> Matlab: 3 prompts, heights 1, 10, and 4
--> Octave: same

answer = inputdlg({'first', 'second', 'third'},'sample',[1; 10])
--> Matlab: error, 3 inputs but only 2 heights specified
--> Octave: same

answer = inputdlg({'first', 'second', 'third'},'sample',[1, 10])
--> Matlab: 3 prompts, size 1x10, 1x10, 1x10
--> Octave: error, 3 inputs but only 2 heights specified

answer = inputdlg({'first', 'second'},'sample',[1; 10])
--> Matlab: 2 prompts, heights 1, 10
--> Octave: same

answer = inputdlg({'first', 'second'},'sample',[1, 10])
--> Matlab: 2 prompts, size 1x10, 1x10
--> Octave: 2 prompts, heights 1, 10

answer = inputdlg({'first'},'sample',[1; 10])
--> Matlab: error, 1 input but  2 heights specified
--> Octave: error, 1 input but 2 heights specified

answer = inputdlg({'first'},'sample',[1, 10])
--> Matlab: 1 prompt, size 1x10
--> Octave: same



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?49143>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]