changeset 29905:ad023dbe9606

Add support for ListBoxTop property of uicontrol objects (bug #60951) * ListBoxControl.cc (update): Add case for ID_LISTBOXTOP to switch statement. * NEWS: Announce change. Also, move some improvements from Matlab compatibility section to Graphics Backend section. Wrap text at 72 columns.
author Rik <rik@octave.org>
date Thu, 22 Jul 2021 08:03:41 -0700
parents 4f51ea7a510a
children e7c10a552ecc
files NEWS libgui/graphics/ListBoxControl.cc
diffstat 2 files changed, 35 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Jul 22 06:53:17 2021 -0700
+++ b/NEWS	Thu Jul 22 08:03:41 2021 -0700
@@ -106,15 +106,37 @@
 - Support for Qt4 for both graphics and the GUI has been removed.
 
 - If a working LaTeX tool chain is found on the path, including `latex`,
-`dvipng`, and `dvisvgm` binaries, then text strings can now be rendered properly
-when using the `"latex"` value for the text objects' `"interpreter"` property
-and axes objects' `"ticklabelinterpreter"`.  Type `doc "latex interpreter"`
-for further info.
+`dvipng`, and `dvisvgm` binaries, then text strings can now be rendered
+properly when using the `"latex"` value for the text objects'
+`"interpreter"` property and axes objects' `"ticklabelinterpreter"`.
+Type `doc "latex interpreter"` for further info.
+
+- The `FMT` format argument for plot commands now accepts long forms for
+color names which may be more understandable than the existing
+one-letter codes.  For example, the RGB value `[0 0 0]` can now be
+specified by `"black"` in addition to `"k"`.
+
+- The color graphics properties, for example `"EdgeColor"` or
+`"FaceColor"`, now accept HTML specifications.  An HTML specification is
+a string that begins with the character '#' and is followed by either 3
+or 6 hexadecimal digits.  For example, magenta which is 100% red and
+blue values can specified by `"#FF00FF"` or `"#F0F"`.
 
 - The additional property `"contextmenu"` has been added to all graphics
 objects.  It is equivalent to the previously used `"uicontextmenu"`
 property which is hidden now.
 
+- `uicontrol` objects now fully implement the `"Off"` and `"Inactive"`
+values of the `"Enable"` property.  When the value is `"Off"`, no
+interaction with the object occurs and the `uicontrol` changes color
+(typically to gray) to indicate it is disabled.  When the value is
+`"Inactive"`, the object appears normally (no change in color), but it
+is not possible to change the value of the object (such as modifying
+text in an `Edit` box or clicking on a `RadioButton`).
+
+- The `"ListBoxTop"` property for `uicontrol` objects has been
+implemented for `set` commands.
+
 - Additional properties have been added to the `axes` graphics object:
     * `"alphamap"` (not yet implemented)
     * `"alphascale"` (not yet implemented)
@@ -156,25 +178,6 @@
 - The function `importdata` now produces more compatible results when
 the file contains a 2-D text matrix.
 
-- The `FMT` format argument for plot commands now accepts long forms for
-color names which may be more understandable than the existing
-one-letter codes.  For example, the RGB value `[0 0 0]` can now be
-specified by `"black"` in addition to `"k"`.
-
-- The color graphics properties, for example `"EdgeColor"` or
-`"FaceColor"`, now accept HTML specifications.  An HTML specification is
-a string that begins with the character '#' and is followed by either 3
-or 6 hexadecimal digits.  For example, magenta which is 100% red and
-blue values can specified by `"#FF00FF"` or `"#F0F"`.
-
-- `uicontrol` objects now fully implement the `"Off"` and `"Inactive"`
-values of the `"Enable"` property.  When the value is `"Off"`, no
-interaction with the object occurs and the `uicontrol` changes color
-(typically to gray) to indicate it is disabled.  When the value is
-`"Inactive"`, the object appears normally (no change in color), but it is
-not possible to change the value of the object (such as modifying text
-in an `Edit` box or clicking on a `RadioButton`).
-
 - The functions `scatter` and `scatter3` now return a handle to a
 scatter graphics object.  For compatibility, they return an `hggroup` of
 patch graphics objects when the `"gnuplot"` graphics toolkit is used.  In
--- a/libgui/graphics/ListBoxControl.cc	Thu Jul 22 06:53:17 2021 -0700
+++ b/libgui/graphics/ListBoxControl.cc	Thu Jul 22 08:03:41 2021 -0700
@@ -152,7 +152,6 @@
         break;
 
       case uicontrol::properties::ID_MIN:
-
       case uicontrol::properties::ID_MAX:
         if ((up.get_max () - up.get_min ()) > 1)
           list->setSelectionMode (QAbstractItemView::ExtendedSelection);
@@ -160,6 +159,15 @@
           list->setSelectionMode (QAbstractItemView::SingleSelection);
         break;
 
+      case uicontrol::properties::ID_LISTBOXTOP:
+        {
+          int idx = octave::math::fix (up.get_listboxtop ());
+          if (idx > 0)
+            list->scrollToItem (list->item (idx-1),
+                                QAbstractItemView::PositionAtTop);
+          break;
+        }
+
       case uicontrol::properties::ID_VALUE:
         m_blockCallback = true;
         updateSelection (list, up.get_value ().matrix_value ());