Skip to content

Commit

Permalink
fix: replace GxOptions.RowDeselection with `GxOptions.SuppressRowDe…
Browse files Browse the repository at this point in the history
…selection`

BREAKING CHANGE: rowDeselection no longer has any affect as the grid now
allows row deselection by default. To block row deselection set
suppressRowDeselection to true.
  • Loading branch information
hyyan committed Apr 12, 2022
1 parent 1df89ad commit 75d243a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
30 changes: 26 additions & 4 deletions GxOptions.bbj
Expand Up @@ -387,12 +387,19 @@ class public GxOptions
rem * another row is selected in its place).
rem * <br><b><small>#Configuration</small></b>
rem * <br><b><small>#GridRenderer</small></b>
rem *
rem * @deprecated since v1.7.0 - use `SuppressRowDeselection` instead
rem */
field public BBjNumber RowDeselection! = 0

rem /**
rem * If true, rows won't be selected when clicked. Use, for example,
rem * when you want checkbox selection, and don't want to also select when the row
rem * is clicked.
rem * If true, rows will not be deselected if you hold down Ctrl and click the row or press Space.
rem * <br><b><small>#Configuration</small></b>
rem * <br><b><small>#GridRenderer</small></b>
rem */
field public BBjNumber SuppressRowDeselection! = 1
rem /**
rem * If true, rows will not be deselected if you hold down Ctrl and click the row or press Space.
rem * <br><b><small>#Configuration</small></b>
rem * <br><b><small>#GridRenderer</small></b>
rem */
Expand Down Expand Up @@ -1170,6 +1177,21 @@ class public GxOptions
methodret #getImmutableColumns()
methodend
rem /**
rem * @deprecated since v1.7.0 - use `GxOptions.setSuppressRowDeselection(BBjNumber value!)` instead
rem */
method public void setRowDeselection(BBjNumber value!)
GxLogger.warn("since version 1.7.0, GxOptions.setRowDeselection(BBjNumber value!) is deprecated. Use GxOptions.setSuppressRowDeselection(BBjNumber value!) instead.")
#RowDeselection! = value!
#SuppressRowDeselection! = !value!
methodend
rem /**
rem * @deprecated since v1.7.0 - use `GxOptions.setSuppressRowDeselection(BBjNumber value!)` instead
rem */
method public BBjNumber getRowDeselection()
GxLogger.warn("since version 1.7.0, GxOptions.getRowDeselection() is deprecated. use GxOptions.getSuppressRowDeselection() instead.")
methodret #RowDeselection!
methodend
rem /**
rem * Set a result set of pinned rows on top
rem *
rem * @param ResultSet rs! A ResultSet instance
Expand Down Expand Up @@ -1279,7 +1301,7 @@ class public GxOptions
rem ===========================
options!.addProperty("rowSelection",iff(#getMultipleSelection() = 1 , "multiple" ,"single"), err=*next)
options!.addProperty("rowMultiSelectWithClick",#getRowMultiSelectWithClick().booleanValue() , err=*next)
options!.addProperty("rowDeselection",#getRowDeselection().booleanValue())
options!.addProperty("suppressRowDeselection",#getSuppressRowDeselection().booleanValue())
options!.addProperty("suppressRowClickSelection",#getSuppressRowClickSelection().booleanValue())
options!.addProperty("enableRangeSelection",#getEnableRangeSelection().booleanValue(), err=*next)
options!.addProperty("suppressMultiRangeSelection",#getSuppressMultiRangeSelection().booleanValue(), err=*next)
Expand Down
17 changes: 9 additions & 8 deletions demo/Selection.bbj
Expand Up @@ -63,12 +63,13 @@ rowDeselectionHelp! = wnd!.addButton(207,10,130,20,22,"")
rowDeselectionHelp!.setImage(icon!)
rowDeselectionHelp!.setImageSize(10 , 10)
rowDeselectionHelp!.setToolTipText("Click to learn more.")
rowDeselectionHelp!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onRowDeselectionHelp")
rowDeselectionHelp!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onSuppressRowDeselectionHelp")
rowDeselectionHelp!.setNoEdge(1)

rowDeselection! = wnd!.addCheckBox(208,32,130,200,22,"Row Deselection")
rowDeselection!.setCallback(BBjAPI.ON_CHECK_OFF,"onRowDeselectionToggle")
rowDeselection!.setCallback(BBjAPI.ON_CHECK_ON,"onRowDeselectionToggle")
rowDeselection! = wnd!.addCheckBox(208,32,130,200,22,"Suppress RowDeselection")
rowDeselection!.setSelected(1)
rowDeselection!.setCallback(BBjAPI.ON_CHECK_OFF,"onSuppressRowDeselection")
rowDeselection!.setCallback(BBjAPI.ON_CHECK_ON,"onSuppressRowDeselection")
REM --- End Row Deselection Controls

REM --- Start Suppress Row Click Selection Controls
Expand Down Expand Up @@ -162,10 +163,10 @@ onRowMultiSelectWithClickToggle:
gosub rerender
return

onRowDeselectionToggle:
onSuppressRowDeselection:
event! = BBjAPI().getLastEvent()
control! = event!.getControl()
grid!.getOptions().setRowDeselection(control!.isSelected())
grid!.getOptions().setSuppressRowDeselection(control!.isSelected())
gosub rerender
return

Expand Down Expand Up @@ -234,8 +235,8 @@ onRowMultiSelectWithClickHelp:
a! = msgbox("With Multiple Selection checked, set to true to allow multiple/single row(s) to be selected with a single click. For example, if you click to select one row, then click to select another row, the first row will stay selected. Clicking a selected row in this mode will deselect the row. This is useful for touch devices where Ctrl- and Shift-clicking is not an option.",0,"Multi/Single Select With Click")
return

onRowDeselectionHelp:
a! = msgbox("If true, then rows will be deselected if you Ctrl+click the row. Normal behaviour with the grid disallows deselection of nodes, i.e. once a node is selected, it remains selected until another row is selected in its place.",0,"Row Deselection")
onSuppressRowDeselectionHelp:
a! = msgbox("If true, rows will not be deselected if you hold down Ctrl and click the row or press Space",0,"Suppress Row Deselection")
return

onSuppressRowClickSelectionHelp:
Expand Down

0 comments on commit 75d243a

Please sign in to comment.