Tsutomu ,
Thanks a lot

I was making the Datamodel  and ColumnModel  like

Datamodel = CreateUnoService("com.sun.star.awt.grid.DefaultGridDataModel") ColumnModel = CreateUnoService("com.sun.star.awt.grid.DefaultGridColumnModel")

and then adding this ellements to the gGridModel was/is not working the columns are not sortable . Using your way: Making first the GridModel and retrieving then the DataModel and columnModel from it, works like a charme

Fernand



Sub Main
   d = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
   dm = d.getModel()
   gm = dm.createInstance("com.sun.star.awt.grid.UnoControlGridModel")
   gm.setPropertyValues(_
     array("Height", "PositionX", "PositionY", "Width"), _
     array(100, 0, 0, 100))
   dm.insertByName("grid", gm)
   gm.SelectionModel = com.sun.star.view.SelectionType.MULTI

   cm = gm.ColumnModel
   c = cm.createColumn()
   c.Title = "foo"
   cm.addColumn(c)
   dm = gm.GridDataModel
   dm.addRows(array("", "", ""), array(array("c"), array("b"), array("a")))

   d.execute()
   d.dispose()
End Sub

Reply via email to