BBjStandardGrid::getSortInfo

Description

In BBj 24.20 and higher, returns a BBjVector of BBjGridSortInfo objects that collectively describes the current sorting status of the BBjStandardGrid.

Syntax

Return Value Method
BBjVector getSortInfo()

Parameters

None.

Return Value

Returns a BBjVector of BBjGridSortInfo objects that collectively describes the current sorting status of the BBjStandardGrid.

Example

rem ' BBjStandardGrid::getSortInfo

sysgui! = bbjapi().openSysGui("X0") 
window! = sysgui!.addWindow(50,50,800,600,"getSortInfo",$00090083$) 
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
status! = window!.addStatusBar(99)

grid! = window!.addGrid(101,25,25,750,500,$81ce$,0,3) 
grid!.setRowHeight(25)
grid!.setLineColor(BBjColor.LIGHT_GRAY)
grid!.setSortByMultipleColumns(1) 
grid!.setColumnUserSortable(0,1)
grid!.setColumnUserSortable(1,1)
grid!.setColumnUserSortable(2,1)
grid!.setHasColumnHeader(1)
restore
while 1
  dread ownerName$, petType$, petName$,end=*break
  currentRow = grid!.getNumRows()
  grid!.insertRow(currentRow)
  grid!.setCellText(currentRow,0,ownerName$)
  grid!.setCellText(currentRow,1,petType$)
  grid!.setCellText(currentRow,2,petName$)
wend 

info! = window!.addButton(1,25,550,100,25,"getSortInfo",$$)
info!.setCallback(info!.ON_BUTTON_PUSH,"info")

unsort! = window!.addButton(2,150,550,100,25,"unsort",$$)
unsort!.setCallback(unsort!.ON_BUTTON_PUSH,"unsort")

process_events

eoj:
  release

resize:
  event! = sysgui!.getLastEvent()
  width = event!.getWidth()
  height = event!.getHeight()
  grid!.setSize(width-50,height-100)
  info!.setLocation(25,height-50)
  unsort!.setLocation(150,height-50)
return

info:
  vector! = grid!.getSortInfo()
  info$ = "getSortInfo:"
  if vector!.size() then
    for i = 0 to vector!.size()-1
      item! = vector!.get(i)
      print item!
      info$ = info$+" column:"+str(item!.getColumn())
      info$ = info$+",direction:"+str(item!.getDirection())
      info$ = info$+",related:"+Boolean.toString(item!.getRelated())
    next i
  else
    info$ = info$ + "(unsorted)"
  endif
  status!.setText(info$)
return

unsort:
  grid!.unsort()
  status!.setText("unsort")
return

DATA "Harold","parrot","Pete","Jane","cat","Matilda","George","ferret","Herbie","Mark","lizard","Tilton","John","snake","Spot"
DATA "Sally","dog","Wilson","Albert","fox","Whimbly","Karen","hamster","Huey","George","ferret","Anathasia","Karen","snake","Don't Eat Huey!"
DATA "Harold","macaw","Beakman","Albert","fox","Wiley","Harold","hamster","Mortimer","George","goldfish","Lincoln","Karen","rock","Bumpy"
DATA "Albert","macaw","Lorrie","Jane","cat","Fluffy","John","mouse","Squeaky","Taylor","penguin","Dapper","Laura","rabbit","Cloudberry"

ClosedVersion History

  • BBj 24.20: BBjStandardGrid::getSortInfo added.

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.