| View previous topic :: View next topic |
| Author |
Message |
ncraven Newbie

Joined: 01 Mar 2004 Posts: 2
|
Posted: Mon Mar 01, 2004 5:10 am Post subject: Newbie Question regarding checkboxes |
|
|
I have a user excel spreadsheet which uses a checkbox control to fill a cell with TRUE/FALSE.
Is there an equivalent in OOCalc?
thanks |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Mon Mar 01, 2004 11:08 am Post subject: |
|
|
In OOo CALC there is no direct linkage between the controls on a form and a cell value.
Interaction between a control and cell value would be achieved by a macro assigned to a control event. In the case of the checkbox, the property representing checked/unchecked is STATE.
As the thought of using macros is daunting to some, I have include all the code necessary to set a calc cell value to match a checkbox
| Code: | Sub checkboxset
doc=thiscomponent 'basic shortcut to refer to the document with the macro
' controls are within a form, within a drawpage, within a sheet(in CALC), within a document
cbox = doc.sheets(0).drawpage.forms(0).getbyname("CheckBox")
if cbox.state = 1 then 'state property is an integer 0,1
' do something to the document (set value of cell A1)
doc.sheets(0).getcellrangebyname("A1").string = "CHECKED"
else doc.sheets(0).getcellrangebyname("A1").string = "UNCHECKED"
end if
End Sub |
Assign the macro to the control event "Item Status Changed"
A search on the API and MAcros forum will provide a lot of information on dealing with controls. |
|
| Back to top |
|
 |
ncraven Newbie

Joined: 01 Mar 2004 Posts: 2
|
Posted: Tue Mar 02, 2004 3:27 am Post subject: |
|
|
Thanks - this is exactly what I needed.
regards
Nick |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Wed Mar 03, 2004 5:55 pm Post subject: |
|
|
At version 1.1.1rc, the controls (including checkbox) do support linking to cells. The linkage is both ways.
The macro required at ver 1.1 will still function ok at 1.1.1 . |
|
| Back to top |
|
 |
cool_sabys Power User


Joined: 22 Feb 2004 Posts: 58
|
Posted: Thu Mar 04, 2004 10:06 pm Post subject: |
|
|
Hi ,
I Downloded 1.1.1rc but i didn't find it
Is it in the form control property interfaces or somewhere? |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Thu Mar 04, 2004 10:24 pm Post subject: |
|
|
| Control Properties > Data TAB > Linked Cell property (takes a reference like "A1") and the cell then takes on the values TRUE or FALSE |
|
| Back to top |
|
 |
cool_sabys Power User


Joined: 22 Feb 2004 Posts: 58
|
Posted: Fri Mar 05, 2004 12:14 am Post subject: |
|
|
| Thanks i got it |
|
| Back to top |
|
 |
|