Talk:Documentation/BASIC Guide/Control Element Forms
From Apache OpenOffice Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Option Button grouping method
The code described in this article used to group Option Buttons returns an error:
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
--Ottoshmidt 07:24, 30 March 2010 (UTC)
- Thanks for the feedback. Frank corrected the example and also made a few other corrections to the text. --ccornell 10:48, 30 March 2010 (UTC)
