Skip to content

Commit

Permalink
modify selection demo to show #69
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Wald committed Nov 13, 2018
1 parent ca011e6 commit 501679e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions BBjGridExWidget.bbj
Expand Up @@ -979,13 +979,17 @@ class public BBjGridExWidget extends BBjWidget
rem * @param BBJNumber x!: 0 select all , 1 select all filtered
rem */
method public void selectAll(BBjNumber x!)
#deselectAll()
script$="gw_selectAll(" + str(x!) + ");"
#executeScript(script$)
methodend
rem /**
rem * deselect all rows
rem */
method public void deselectAll()
rem need to clear old selection
rem TODO / missing: create the SelectedRowsMap based on the new programmatic setting
#SelectedRowsMap!.clear()
script$="gw_deselectAll(0);"
#executeScript(script$)
methodend
Expand Down
24 changes: 22 additions & 2 deletions Demo/SelectionDemo.bbj
Expand Up @@ -21,16 +21,19 @@ st! = wnd!.addStaticText(200,20,10,200,25,"Enter rows to select, e.g. ""5,7""")
ed! = wnd!.addEditBox(201,200,10,250,22,"")
btn! = wnd!.addButton(202,460,10,80,22,"SELECT")

cb! = wnd!.addCheckBox(203,550,10,200,22,"Use Selection Checkbox")
cb! = wnd!.addCheckBox(203,550,10,200,22,"Use Checkbox")

btn_show! = wnd!.addButton(204,660,10,80,22,"SHOW SEL")

btn!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onSelectButton")
btn_show!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onShowButton")
cb!.setCallback(BBjAPI.ON_CHECK_OFF,"onUseCheckbox")
cb!.setCallback(BBjAPI.ON_CHECK_ON,"onUseCheckbox")

grid!.setCallback(grid!.ON_GRID_SELECT_ROW(),"onSelection")
grid!.setCallback(grid!.ON_GRID_DOUBLE_CLICK(),"onDoubleCLick")

grid!.setSelectionMode(grid!.GRID_SELECT_CELL())
grid!.setSelectionMode(grid!.GRID_SELECT_ROW())
grid!.setMultipleSelection(1)


Expand Down Expand Up @@ -146,3 +149,20 @@ onUseCheckbox:
gosub fillGrid

return


onShowButton:
sel! = grid!.getSelectedRows()
it! = sel!.iterator()
? 'CS','SHOW','RAISE',"Selected Rows are:"
while it!.hasNext()
sr! = it!.next()
? "ChildInde: ",sr!.getChildIndex()
? "Data: ",sr!.asDataRow()
? "Id: ",sr!.getId()
? "Index: ",sr!.getIndex()
? ""
wend


return

0 comments on commit 501679e

Please sign in to comment.