| View previous topic :: View next topic |
| Author |
Message |
Aquarina General User


Joined: 07 Apr 2007 Posts: 17
|
Posted: Sat Apr 07, 2007 10:03 pm Post subject: checkbox value |
|
|
Hi,
I need to hide a seccion of my text in accordance to a checkbox I defined earlyer.
I don't know how to use the value of the checkbox in the condition to hide that seccion.
I'd apreciate if anyone could help me.
Ilustraton:
option 1 [ ]
option 2 [ ]
...
Section of text to show if 1st checkbox is checked.
Section of text to show if 2nd checkbox is checked. |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Sun Apr 08, 2007 5:07 am Post subject: |
|
|
| I don't think this is possible unless you create some glue using a macro. Is that what you want to do? How did you insert the checkbox in your document? |
|
| Back to top |
|
 |
Aquarina General User


Joined: 07 Apr 2007 Posts: 17
|
Posted: Sun Apr 08, 2007 6:23 am Post subject: |
|
|
| acknak wrote: | | How did you insert the checkbox in your document? |
I just used the forms toolbar and named the checkbox field "cruz1".
Then, in the "data" tab of the properties dialog i assigned y to the "reference value (on)" and n to the "reference value (off)".
Finaly, on the properties of the section i used as a formula to hide the section: cruz1 = n. |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Mon Apr 09, 2007 4:58 am Post subject: |
|
|
OK, as far as I know, the form controls are not connected to Writer's variables or conditions, which are required for hiding a section. It would be nice if they were--maybe someone else knows differently.
Typically, you simply insert a variable field (Insert > Fields > Other > Variables > Set Variable). Then, to set the variable, the user double-clicks on the field and a dialog pops up where the value can be changed. You could also use a drop-down list field instead of a plain variable, and provide selectable values, e.g. "Hidden" and "Visible". |
|
| Back to top |
|
 |
Aquarina General User


Joined: 07 Apr 2007 Posts: 17
|
Posted: Tue Apr 10, 2007 1:04 am Post subject: I think you are right! :-/ |
|
|
Yes, I think you are right!
The only way I could hide the section was, like you mentioned, using a variable field. It is just not as interesting (graphicaly) as the way I was intending to do.
Wouldn't it be possible to implement this for future releases?
I already registered myself for the openoffice website, but that's way way too confusing for me. I could no even undestando where or how could I maka a suggestion!
Well, thanks anyway  |
|
| Back to top |
|
 |
Aquarina General User


Joined: 07 Apr 2007 Posts: 17
|
Posted: Wed Apr 11, 2007 1:25 pm Post subject: I still wonder... |
|
|
I was wondering...
What if i tried to set a variable value to the same value I had set on the field? I could then hide the section based on that variable, isn't it?!
How would I do such a thing? |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Wed Apr 11, 2007 2:22 pm Post subject: |
|
|
Sure.
When you define (or edit) a section, there is a checkbox for "Hide" with a sub-entry called "With condition". Activate the "Hide" option and in the "With condition" entry, type: MyVariable != 0
Now, if you use Insert > Fields > Other > Variables > Set variable to define a variable called "MyVariable" with format "1234" (numeric) and value 1 (or anything but zero), then the section will be hidden. You can access a hidden section through the Navigator (F5) or the Format > Sections menu.
The "Set variable MyVariable=1" field must precede the section in your document.
The user will have to double click on the field to change the value of the variable.
You may want to use a text format variable and make the condition something like HideSection == "YES" just to make it a bit more clear. |
|
| Back to top |
|
 |
Aquarina General User


Joined: 07 Apr 2007 Posts: 17
|
Posted: Wed Apr 11, 2007 2:32 pm Post subject: |
|
|
Yes, that I know, but I was wondering if it would not be possible to change de variable value using that damn checkbox...
like this:
1st - insert a checkbox (named "lalala", on value = y, off value = n)
2nd - insert variable (named "blabla", value=lalala)
3rd - hide section if blabla=y
Thanks againd you must be very patient  |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Wed Apr 11, 2007 2:59 pm Post subject: |
|
|
Well, I had a feeling that's really where you were going, and to be honest, I'm not 100% sure of the answer, but given the number of simple things that currently do not work with Writer's fields, I feel confident that it will not work. So confident in fact, that I'm not going to spend the time to try it for you
You should (might? may?) be able to make a small database that holds your variables (one row, each column is one "variable") and connect that to the checkbox. You can use database fields in conditional statements, no problem. Whether a change in the checkbox would then propagate into the database and into the document fields is another question. |
|
| Back to top |
|
 |
Aquarina General User


Joined: 07 Apr 2007 Posts: 17
|
Posted: Wed Apr 11, 2007 3:07 pm Post subject: |
|
|
I am already trying that.
Thanks  |
|
| Back to top |
|
 |
foxcole Super User


Joined: 19 Jan 2006 Posts: 2771 Location: Minneapolis, Minnesota
|
Posted: Wed Apr 11, 2007 9:15 pm Post subject: |
|
|
| Aquarina wrote: | Yes, that I know, but I was wondering if it would not be possible to change de variable value using that damn checkbox...
like this:
1st - insert a checkbox (named "lalala", on value = y, off value = n)
2nd - insert variable (named "blabla", value=lalala)
3rd - hide section if blabla=y
Thanks againd you must be very patient  |
I think that would assume the same availability of the checkbox to the document that the original use of the checkbox value would have provided... meaning, if you could do what you're suggesting here, you could also have done what you wanted in the first place and use that checkbox value. But the checkbox is not a document variable and the data does not exist where the document can use it... it's designed for external use. _________________ Cheers!
---Fox
WinXP Pro SP2, OOo Portable 2.3.1, OOo local 2.4 RC4
New OpenOffice forum: http://user.services.openoffice.org/en/forum/
Manuals: http://documentation.openoffice.org/manuals/index.html |
|
| Back to top |
|
 |
|