Talk:Documentation/BASIC Guide/Control Element Forms

From Apache OpenOffice Wiki
Jump to: navigation, search

Option Button grouping method

The code described in this article used to group Option Buttons returns an error:

Lens diff.png


this error is caused by the following line:

    Ctl = Form. GetGroupbyName("MyOptions")

However I found this method that works fine:

Function test
Dim oGroup as object
Dim Doc As Object
Dim Forms As Object
Dim Form As Object
Dim Ctl As Object
Dim I as Integer
 
Doc = ThisComponent
Forms = Doc.Drawpage.Forms
 
 
  Form = Forms.GetbyIndex(0)
 
     oForm.getGroupByName("MyOptions", oGroup)
   msg=""
   for i=0 to UBound(oGroup)
       oCtl = oGroup(i)
       msg = msg + oCtl.Name + " " + (str(oCtl.State)) + chr(10)
   next i
   MsgBox msg 
 
end Function

See: [1] and [2]

--Ottoshmidt 07:24, 30 March 2010 (UTC)

Personal tools