OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Newbie Question regarding checkboxes

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
ncraven
Newbie
Newbie


Joined: 01 Mar 2004
Posts: 2

PostPosted: Mon Mar 01, 2004 5:10 am    Post subject: Newbie Question regarding checkboxes Reply with quote

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
View user's profile Send private message
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Mon Mar 01, 2004 11:08 am    Post subject: Reply with quote

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
View user's profile Send private message
ncraven
Newbie
Newbie


Joined: 01 Mar 2004
Posts: 2

PostPosted: Tue Mar 02, 2004 3:27 am    Post subject: Reply with quote

Thanks - this is exactly what I needed.

regards

Nick
Back to top
View user's profile Send private message
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Wed Mar 03, 2004 5:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
cool_sabys
Power User
Power User


Joined: 22 Feb 2004
Posts: 58

PostPosted: Thu Mar 04, 2004 10:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Thu Mar 04, 2004 10:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
cool_sabys
Power User
Power User


Joined: 22 Feb 2004
Posts: 58

PostPosted: Fri Mar 05, 2004 12:14 am    Post subject: Reply with quote

Thanks i got it
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group