[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60861] set command sometimes doesn't allow mu
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #60861] set command sometimes doesn't allow multiple items. |
Date: |
Wed, 30 Jun 2021 13:05:14 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?60861>
Summary: set command sometimes doesn't allow multiple items.
Project: GNU Octave
Submitted by: None
Submitted on: Wed 30 Jun 2021 05:05:11 PM UTC
Category: GUI
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name: Paul Mennen
Originator Email: paul@mennen.org
Open/Closed: Open
Release: 6.1.0
Discussion Lock: Any
Operating System: Microsoft Windows
_______________________________________________________
Details:
Usually the set command allows multiple items, i.e.
set(handle,prop1,value1,prop2,value2,prop3,value3);
Octave usually permits commands like that, however there are two situations
where this doesn't work. One is where you are setting a single property to
more than one object with different values. (The first set command in the
following script is an example of this. A 2nd one is where you are setting
multiple properties of a single object. (The second set command in the
following script is such an example, and is used to copy both the fontsize and
fontweight properties from one object to another):
figure;
locations = {[2 2 2 1]/20; [2 4 2 1]/20; [2 6 2 1]/20};
txt = {'ABC'; 'DEF'; 'HIJ'};
props = {'fontsize' 'fontweight'};
a = [uicontrol uicontrol uicontrol];
set(a,'units','normalized',{'position'},locations,{'string'},txt);
set(a(2),props,get(a(1),props),'backgroundcolor','red');
Although this script runs in Matlab, both of these set commands will produce
an error such as "argument 0 must be a property name".
There is a fairly easy workaround, which is to simply use only one
property/value pair at a time. So if you replace the above two set commands
with the following six set commands, the script runs fine with no errors:
set(a,'units','normalized');
set(a,{'position'},locations);
set(a,{'string'},txt);
set(a(2),props,get(a(1),props)); % copies both fontsize and fontweight
properties from a(1) to a(2)
set(a(2),'backgroundcolor','red');
I suspect this would not be a difficult bug to fix, but if that turns out not
to be the case, I suggest that you at least fix the error message. Almost all
error messages I have seen show the routine and line number where the error
occurred. However for this particular error message, neither the line number
nor the function where the error occurred are displayed. Since my program
contains hundreds of set commands it becomes quite laborious to single step
thru the code trying to find the set command that Octave was (unjustly)
complaining about.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60861>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #60861] set command sometimes doesn't allow multiple items.,
anonymous <=