13 from pyfbsdk_additions
import *
15 def OnSpreadEvent(control, event):
16 print "Type:%s, Action %d, Row:%d, Column:%d Value: %s" % (event.Type, event.Action, event.Row, event.Column, str(control.GetCellValue(event.Row, event.Column)))
18 def OnDragAndDrop(control, event):
20 DragAndDropEvent documentation:
21 Accept (): Accept a drag and drop sequence.
22 Add (FBComponent pComponent, int pId=0): Add an item to the drag and drop list.
23 Clear (): Clear drag and drop list.
24 Get (int pIndex): Get the FBComponent specified by pIndex from the Drag and Drop list.
25 GetCount (): Get the number of items in the DragAndDrop list.
27 Data: Property: User specified reference. (for example, FBSpread:row)
28 PosX: Property: X position of mouse.
29 PosY: Property: Y position of mouse.
30 State: Property: Drag and drop sub-event.
31 components: list of dragged components
33 if event.State == FBDragAndDropState.kFBDragAndDropDrag:
35 print "Type:%s, State%d, PosX:%d, PosY:%d, NbElements:%d" % (event.Type, event.State, event.PosX, event.PosY, event.GetCount())
38 def PopulateLayout(mainLyt):
43 mainLyt.AddRegion(
"main",
"main", x, y, w, h)
47 mainLyt.SetControl(
"main",s)
57 s.OnCellChange.Add(OnSpreadEvent)
58 s.OnRowClick.Add(OnSpreadEvent)
59 s.OnColumnClick.Add(OnSpreadEvent)
60 s.OnDragAndDrop.Add(OnDragAndDrop)
63 c.Caption =
"first column"
66 s.SetCellValue(0, 0, 3)
67 s.SetCellValue(0, 1, 3.1416)
68 s.SetCellValue(0, 2,
"py = 3.1416")