Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/multiameter with controls
Function:
Required plugins for this example: MBS ChartDirector Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /ChartDirector/multiameter with controls
This example is the version from Wed, 13th Dec 2016.
Project "multiameter with controls.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class PicWindow Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Sub Open() // fix some properties if set wrong in IDE me.DoubleBuffer = false me.EraseBackground = false #if RBVersion >= 2013.0 then me.Transparent = False #endif End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) g.DrawPicture pic,0,0 End EventHandler
End Control
Control sliderBlue Inherits Slider
ControlInstance sliderBlue Inherits Slider
EventHandler Sub ValueChanged() redraw End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control sliderRed Inherits Slider
ControlInstance sliderRed Inherits Slider
EventHandler Sub ValueChanged() redraw End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control sliderYellow Inherits Slider
ControlInstance sliderYellow Inherits Slider
EventHandler Sub ValueChanged() redraw End EventHandler
End Control
Control sliderGreen Inherits Slider
ControlInstance sliderGreen Inherits Slider
EventHandler Sub ValueChanged() redraw End EventHandler
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control sliderGrey Inherits Slider
ControlInstance sliderGrey Inherits Slider
EventHandler Sub ValueChanged() redraw End EventHandler
End Control
EventHandler Sub Open() render End EventHandler
Sub redraw() render canvas1.Graphics.DrawPicture pic,0,0 End Sub
Sub render() // Create an AugularMeter object of size 200 x 200 pixels dim m as new CDAngularMeterMBS(200, 200) // Use white on black color palette for default text and line colors m.setWhiteOnBlackColors // Set the meter center at (100, 100), with radius 85 pixels, and span from 0 to // 360 degress m.setMeter(100, 100, 85, 0, 360) // Meter scale is 0 - 100, with major tick every 10 units, minor tick every 5 // units, and micro tick every 1 units m.setScale(0, 100, 10, 5, 1) // Set angular arc, major tick and minor tick line widths to 2 pixels. m.setLineWidth(2, 2, 2) // Add a blue (9999ff) ring between radii 88 - 90 as decoration m.addRing(88, 90, &h9999ff) // Set 0 - 60 as green (00AA00) zone, 60 - 80 as yellow (CCCC00) zone, and 80 - // 100 as red (AA0000) zone m.addZone(0, 60, &h00aa00) m.addZone(60, 80, &hcccc00) m.addZone(80, 100, &haa0000) // Add a text label centered at (100, 70) with 12 pts Arial Bold font call m.addText(100, 70, "PSI", "arialbd.ttf", 12, CDBaseChartMBS.kTextColor, CDBaseChartMBS.kCenter) // Add a semi-transparent blue (806666FF) pointer using the default shape call m.addPointer(sliderBlue.value, &h806666FF, &h6666ff) // Add a semi-transparent red (80FF6666) pointer using the arrow shape call m.addPointer(sliderRed.value, &h80FF6666, &hff6666).setShape(CDBaseChartMBS.kArrowPointer2) // Add a semi-transparent yellow (80FFFF66) pointer using another arrow shape call m.addPointer(sliderYellow.value, &h80FFFF66, &hffff66).setShape(CDBaseChartMBS.kArrowPointer) // Add a semi-transparent green (8066FF66) pointer using the line shape call m.addPointer(sliderGreen.value, &h8066FF66, &h66ff66).setShape(CDBaseChartMBS.kLinePointer) // Add a semi-transparent grey (80CCCCCC) pointer using the pencil shape call m.addPointer(SliderGrey.value, &h80CCCCCC, &hcccccc).setShape(CDBaseChartMBS.kPencilPointer) // output the chart pic=m.makeChartPicture End Sub
Property pic As picture
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS ChartDirector Plugin.




Links
MBS Xojo Plugins