Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Checkbox in a column of a FBSpread()
  RSS 2.0 ATOM  

Checkbox in a column of a FBSpread()
Rate this thread
 
31356
 
Permlink of this thread   Subscribe to this thread
avatar
  • lokkook
  • Posted: 24 June 2009 03:58 AM
  • Total Posts: 15
  • Joined: 09 October 2008 08:14 PM

Hi Everybody!

I am trying to design a FBSpread() in wich one column would be a checkbox.
Does anybody know how to do that ?

There is a ‘Style’ attribute in the FBSpreadPart() object, but I do not succeed to use it.

Thanks,
L.



Replies: 0
avatar
  • lokkook
  • Posted: 24 June 2009 04:39 AM

Ok, I found the answer :

FBSpread()
cell 
s.GetCell(0,0)
cell
.Style FBCellStyle.kFBCellStyle2StatesButton

Now I need to understand how to retrieve the cell data !

EDIT 25/6:
Ok, now that’s a REAL question: how do you set/retrieve data in a FBSpread’ cells ??? Please help !!!

L.



Replies: 0
avatar
  • LPXO
  • Posted: 02 November 2009 10:35 PM

Bump..

Surely there is a way of doing this?  If FBSpread is exposed to python then you must be able to get/set cell values?  According to the documentation there is a “Caption” attribute but in actual fact there is not.

These are the available attributes and functions for an FBSpreadCell object:

[’BeginChange’, ‘ClassName’, ‘Column’, ‘Components’, ‘ConnectAt’, ‘ConnectDst’, ‘ConnectDstAt’, ‘ConnectSrc’, ‘ConnectSrcAt’, ‘DisableObjectFlags’, ‘DisconnectAllDst’, ‘DisconnectAllSrc’, ‘DisconnectDst’, ‘DisconnectDstAt’, ‘DisconnectSrc’, ‘DisconnectSrcAt’, ‘EnableObjectFlags’, ‘Enabled’, ‘EndChange’, ‘FBCreate’, ‘FBDelete’, ‘FBDestroy’, ‘GetDst’, ‘GetDstCount’, ‘GetDstType’, ‘GetObjectFlags’, ‘GetObjectStatus’, ‘GetOwned’, ‘GetOwnedCount’, ‘GetOwner’, ‘GetOwnerCount’, ‘GetSrc’, ‘GetSrcCount’, ‘GetSrcType’, ‘HasObjectFlags’, ‘Is’, ‘IsSDKComponent’, ‘Justify’, ‘MoveSrcAt’, ‘Name’, ‘OnUnbind’, ‘Parents’, ‘ProcessNamespaceHierarchy’, ‘ProcessObjectNamespace’, ‘PropertyAdd’, ‘PropertyCreate’, ‘PropertyList’, ‘PropertyRemove’, ‘ReadOnly’, ‘ReplaceDstAt’, ‘ReplaceSrcAt’, ‘Row’, ‘Selected’, ‘SetObjectFlags’, ‘SetObjectStatus’, ‘Style’, ‘SwapSrc’, ‘__class__’, ‘__delattr__’, ‘__dict__’, ‘__doc__’, ‘__getattribute__’, ‘__hash__’, ‘__init__’, ‘__module__’, ‘__new__’, ‘__reduce__’, ‘__reduce_ex__’, ‘__repr__’, ‘__setattr__’, ‘__str__’, ‘__weakref__’]

There is no SetCell function available to an FBSpread object as there is in the SDK.  Can someone at Autodesk confirm if Im wasting my time trying to work this out?

Thanks



Replies: 0
avatar
  • LPXO
  • Posted: 04 November 2009 10:47 PM

Right Autodesk have said this is fixed in MB 2010.  I can confirm it is partially fixed.

While they have exposed GetCellvalue and SetCellValue functions you can only set/get values for strings, floats and ints so checkboxes and combo boxes are a no go as far as I can tell.  Autodesk are going to confirm.



Replies: 0
avatar
  • steebu
  • Posted: 10 August 2010 01:15 PM

LPXO 05 November 2009 06:47 AM

Right Autodesk have said this is fixed in MB 2010.  I can confirm it is partially fixed.

While they have exposed GetCellvalue and SetCellValue functions you can only set/get values for strings, floats and ints so checkboxes and combo boxes are a no go as far as I can tell.  Autodesk are going to confirm.

I just found a workaround which I think works fairly well if you know the structure of your spreadsheet (which, really, you should).

If you know that your checkbox is always going to be in column 0 (or whatever), then you can do something like:

s = FBSpread()
# add columns, data, etc., then set the style to be a checkbox as explained above:

cell = s.GetSpreadCell( 1,0 ) # row 1, column 0 - column 0 will ALWAYS be a checkbox
cell.Style = FBCellStyle.kFBCellStyle2StatesButton

# here’s the key
s.OnCellChange.Add( clickycallback )

then somewhere else do

def clickycallbackcontrolevent ):
    if 
event.Column == 0:            # see if it's column 0 that someone clicked on
        
print 'you changed the checkbox state!'

So, you really don’t need to know the value of the checkbox, but rather, that someone changed it.



Replies: 0
avatar
  • steebu
  • Posted: 11 August 2010 09:46 AM

OK, confirmed that checkboxes DO work in MB 2011.

Just use

SetCellValue( row, col, 0 )

to uncheck and

SetCellValue( row, col, 1 )

to check it.

Using GetCellValue() also returns the current state of the check.

Anyone gotten a DropList to work in the cell?



Replies: 0




   
  Settings Choose Theme color: