Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have a writer odt document with a form and 2 option buttons (Option1: "yes/no") as well as other 
form elements.
Clicking one option button enables it and immediately disables the other if the component names are 
identical (eg "optionButtons1").

I run a macro whenever I detect the "Mouse pressed" event for these option buttons. This macro 
searches through all form components and grabs their values.
My goal is to get the "Option1" value (eg. 1 if YES was selected and 0 if NO was selected).

The macro function snippet below returns something like "&optionButtons1=0&optionButtons1=1" when 
the YES option button isn't clicked and the NO option button is.

Instead, how can I get something like "Option1=1" when the YES option button is clicked and the NO 
button isn't?
Likewise, get "Option1=0" when YES isn't clicked and NO is.

Doc = ThisComponent
Forms = Doc.Drawpage.Forms
 
For I = 0 To Forms.Count - 1
        Form = Forms.GetbyIndex(I)
        For J = 0 To Form.Count - 1
                Ctl = Form.GetbyIndex(J)
                If Ctl.supportsService("com.sun.star.form.component.TextField") Then
                        rep = rep & "&" & Ctl.getName() & "=" & Ctl.Text
                Else 
                        If Ctl.supportsService("com.sun.star.form.component.RadioButton") Or 
Ctl.supportsService("com.sun.star.form.component.CheckBox") Then
                                rep = rep & "&" & Ctl.getName() & "=" & Ctl.currentvalue
                        End If
                End If
        Next J
Next I

GetTextFields = rep

Come to think of it, one could have a set of 3 or more option buttons to choose from, eg. Option1: 
YES/NO/MAYBE
In this case, I suppose I'd like to get results such as Option1=0 or =1 or =2.

Any suggestions?

Thanks,

Vieri


-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.