From 7653d3476041b8cfd9e7b063285f813debc0d1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sun, 19 Mar 2023 22:56:21 +0100 Subject: [PATCH] WebComboBox: In read-only mode, ensure that no item is selected if the 'Index' property is negative. [GB.WEB.GUI] * BUG: WebComboBox: In read-only mode, ensure that no item is selected if the 'Index' property is negative. --- comp/src/gb.web.gui/.project | 2 +- comp/src/gb.web.gui/.src/Test/Webform3.class | 6 +++++ .../src/gb.web.gui/.src/Test/Webform3.webform | 23 ++++++++++++------- comp/src/gb.web.gui/.src/WebComboBox.class | 2 ++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/comp/src/gb.web.gui/.project b/comp/src/gb.web.gui/.project index a785f3a82..406a739a9 100644 --- a/comp/src/gb.web.gui/.project +++ b/comp/src/gb.web.gui/.project @@ -1,6 +1,6 @@ # Gambas Project File 3.0 Title=Web application development using processes as session -Startup=Webform1 +Startup=Webform3 Icon=.hidden/webform.png Version=3.18.90 VersionFile=1 diff --git a/comp/src/gb.web.gui/.src/Test/Webform3.class b/comp/src/gb.web.gui/.src/Test/Webform3.class index 459261296..5b726cb17 100644 --- a/comp/src/gb.web.gui/.src/Test/Webform3.class +++ b/comp/src/gb.web.gui/.src/Test/Webform3.class @@ -50,3 +50,9 @@ Public Sub WebListBox1_KeyPress() WebTextBox1_KeyPress End + +Public Sub WebButton1_Click() + + WebComboBox1.Index = -1 + +End diff --git a/comp/src/gb.web.gui/.src/Test/Webform3.webform b/comp/src/gb.web.gui/.src/Test/Webform3.webform index 6c0dede67..dafa9110b 100644 --- a/comp/src/gb.web.gui/.src/Test/Webform3.webform +++ b/comp/src/gb.web.gui/.src/Test/Webform3.webform @@ -6,26 +6,33 @@ Arrangement = Arrange.Vertical Margin = True Spacing = True - { WebComboBox1 WebComboBox - #MoveScaled(1,1,62,4) - ReadOnly = False - List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5"), ("Élément 6")] + { WebContainer1 WebHBox + #MoveScaled(1,1,62,6) + Spacing = True + { WebComboBox1 WebComboBox + #MoveScaled(1,1,22,4) + List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5"), ("Élément 6")] + } + { WebButton1 WebButton + #MoveScaled(24,1,15,4) + Text = ("Reset") + } } { WebComboBox2 WebComboBox - #MoveScaled(1,6,62,4) + #MoveScaled(1,8,62,4) ReadOnly = False List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5"), ("Élément 6")] } { WebListBox1 WebListBox - #MoveScaled(1,11,62,28) + #MoveScaled(1,13,62,28) Height = "10em" List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5"), ("Élément 6"), ("Élément 7"), ("Élément 8"), ("Élément 9"), ("Élément 10"), ("Élément 11"), ("Élément 12")] } { WebTextBox1 WebTextBox - #MoveScaled(1,40,62,4) + #MoveScaled(1,42,62,4) } { WebTextArea1 WebTextArea - #MoveScaled(1,45,62,16) + #MoveScaled(1,47,62,16) Expand = True ReadOnly = True } diff --git a/comp/src/gb.web.gui/.src/WebComboBox.class b/comp/src/gb.web.gui/.src/WebComboBox.class index cf79365db..f4a5760ab 100644 --- a/comp/src/gb.web.gui/.src/WebComboBox.class +++ b/comp/src/gb.web.gui/.src/WebComboBox.class @@ -94,6 +94,8 @@ Public Sub _Render() If Not $bReadOnly Then Print ""; WebForm._AddJavascript("gw.combobox.resize(" & JS(Me.Name) & ");") + Else + If $iIndex < 0 Then WebForm._AddJavascript("gw.combobox.update(" & JS(Me.Name) & ",-1);") Endif Print