Listing 1: CreateHeaderSortArrows

Public Sub CreateHeaderSortArrows()
Dim fontsize As Int16
Dim syntax, xpos, width, height, color, exprsn, align, col, fontheight As String
Dim myGOB As Sybase.DataWindow.GraphicObject

If MyBase.GetProperty("DataWindow.Processing") <> "1" Then Return
Dim columns As ArrayList = GetVisibleColumns()
For Each col In columns
  xpos = MyBase.GetProperty(col + ".X")
  width = MyBase.GetProperty(col + ".width")
  height = MyBase.GetProperty(col + ".height")
  fontheight = MyBase.GetProperty(col + ".font.height")
  fontsize = CType(fontsize.Parse(fontheight) * 1.2, Int16)
  fontheight = fontsize.ToString()
  color = "0"
  If MyBase.GetProperty(col + ".alignment") = "1" Then
    align = "0"
  Else
    align = "1"
  End If
  exprsn = """if(pos(lower(describe('datawindow.table.sort')), '"
  exprsn += col + " a') > 0, '5', "
  exprsn += "if(pos(lower(describe('datawindow.table.sort')), '"
  exprsn += col + " d') > 0, '6', "
  exprsn += "if(pos(lower(describe('datawindow.table.sort')), '"
  exprsn += "lookupdisplay(" + col + ") a') > 0, '5', "
  exprsn += "if(pos(lower(describe('datawindow.table.sort')), '"
  exprsn += "lookupdisplay(" + col + ") d') > 0, '6', ''))))"" "

  syntax = "create compute( band=header alignment=""" + align + """ expression=" + exprsn
  syntax += "border=""0"" color=""" + color + """ x=""" + xpos + """ y=""0"" "
  syntax += "height=""" + height + """ width=""" + width + """ format=""[general]"" "
  syntax += "name=" + col + "_a font.face=""Marlett"" font.height="" + fontheight + "" "
  syntax += "font.weight=""400"" font.family=""0"" font.pitch=""2"" font."
  syntax += "charset=""2"" background.mode=""1"" background.color=""553648127"" )"

  MyBase.Modify(syntax)

Next

End Sub