Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

MBS Xojo Plugin Tutorial Videos

ChartDirectorWin Source

Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class

Class Window1
Inherits Window
// Controls
ControlInstance
Sub Open() Handles Event
me.ColumnType(0)=me.TypeEditable
me.ColumnType(1)=me.TypeEditable

End Sub
Sub Change() Handles Event
RemoveButton.Enabled=me.ListIndex>=0

MakeChart

End Sub
Function CellKeyDown(row as Integer, column as Integer, key as String) As Boolean Handles Event
if asc(key)=9 then // tab key
if column=0 then
me.EditCell(row,1)
Return true
elseif column=1 then
me.EditCell(row,0)
Return true
end if

end if
End Function
Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean Handles Event
if row mod 2=0 then
if row=me.ListIndex then // selected row
Return false
else
g.ForeColor=&cEEEEFF // light blue
g.FillRect 0,0,g.Width,g.Height
Return true
end if
end if
End Function
End ControlInstance
ControlInstance
Sub Action() Handles Event
list.AddRow ""
list.EditCell(list.LastIndex,0)

End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
list.RemoveRow list.ListIndex

End Sub
End ControlInstance
ControlInstance
End ControlInstance

// Event implementations
Sub Open()
MakeChart
End Sub

// Methods
Sub MakeChart()
dim u,i as integer

dim data(-1) as double
dim labels(-1) as string

u=list.ListCount-1
for i=0 to u
labels.Append list.Cell(i,0)
data.Append val(list.cell(i,1))
next

dim c as new CDXYChartMBS(canvas1.Width, canvas1.Height)

call c.setPlotArea(30,20, Canvas1.Width-50, canvas1.Height-50)

call c.addBarLayer data

call c.xAxis.setLabelS labels

canvas1.Backdrop=c.makeChartPicture

End Sub
End Class


All movies




Links
MBS FileMaker Plugins