Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/Cocoa Controls/Koingo Progress Bar
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacControls Plugin, MBS MacFrameworks Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/Cocoa Controls/Koingo Progress Bar
This example is the version from Sun, 17th Mar 2012.
Project "Koingo Progress Bar.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control progExample Inherits ProgressBarKSW
ControlInstance progExample Inherits ProgressBarKSW
EventHandler Sub ValueChanged(newValue As Double) lblValue.Text = Str(newValue) End EventHandler
End Control
Control lblValue Inherits Label
ControlInstance lblValue Inherits Label
End Control
Control chkIndeterminate Inherits CheckBox
ControlInstance chkIndeterminate Inherits CheckBox
EventHandler Sub Action() self.ApplySettingsToBar() End EventHandler
End Control
Control lblValue1 Inherits Label
ControlInstance lblValue1 Inherits Label
End Control
Control lblValue11 Inherits Label
ControlInstance lblValue11 Inherits Label
End Control
Control lblValue111 Inherits Label
ControlInstance lblValue111 Inherits Label
End Control
Control txtValue Inherits TextField
ControlInstance txtValue Inherits TextField
EventHandler Sub TextChange() self.ApplySettingsToBar() End EventHandler
End Control
Control txtMaxValue Inherits TextField
ControlInstance txtMaxValue Inherits TextField
EventHandler Sub TextChange() self.ApplySettingsToBar() End EventHandler
End Control
Control txtMinValue Inherits TextField
ControlInstance txtMinValue Inherits TextField
EventHandler Sub TextChange() self.ApplySettingsToBar() End EventHandler
End Control
Control lblValue1111 Inherits Label
ControlInstance lblValue1111 Inherits Label
End Control
Control chkAnimated Inherits CheckBox
ControlInstance chkAnimated Inherits CheckBox
EventHandler Sub Action() self.ApplySettingsToBar() End EventHandler
End Control
Control lblValue112 Inherits Label
ControlInstance lblValue112 Inherits Label
End Control
Control popTint Inherits PopupMenu
ControlInstance popTint Inherits PopupMenu
EventHandler Sub Change() self.ApplySettingsToBar() End EventHandler
End Control
Control chkBezeled Inherits CheckBox
ControlInstance chkBezeled Inherits CheckBox
EventHandler Sub Action() self.ApplySettingsToBar() End EventHandler
End Control
Control popSize Inherits PopupMenu
ControlInstance popSize Inherits PopupMenu
EventHandler Sub Change() self.ApplySettingsToBar() End EventHandler
End Control
Control lblValue11111 Inherits Label
ControlInstance lblValue11111 Inherits Label
End Control
Control lblValue11112 Inherits Label
ControlInstance lblValue11112 Inherits Label
End Control
Control sldAlpha Inherits Slider
ControlInstance sldAlpha Inherits Slider
EventHandler Sub ValueChanged() self.ApplySettingsToBar() End EventHandler
End Control
Control lblValue113 Inherits Label
ControlInstance lblValue113 Inherits Label
End Control
EventHandler Sub Open() self.ApplySettingsToBar() End EventHandler
Sub ApplySettingsToBar() progExample.IsIndeterminate = chkIndeterminate.Value progExample.AnimateIndeterminate = chkAnimated.Value progExample.MaxValue = Val(txtMaxValue.Text) progExample.MinValue = Val(txtMinValue.Text) progExample.Value = Val(txtValue.Text) select Case popTint.ListIndex Case 0 progExample.Tint = 0 //NSDefaultControlTint Case 1 progExample.Tint = 1 //NSBlueControlTint Case 2 progExample.Tint = 6 //NSGraphiteControlTint Case 3 progExample.Tint = 7 //NSClearControlTint End Select progExample.IsBezeled = chkBezeled.Value progExample.ControlSize = popSize.ListIndex progExample.Opacity = (sldAlpha.Value/100) End Sub
Property n1 As NSProgressIndicatorMBS
Property n2 As NSProgressIndicatorMBS
Property n3 As NSProgressIndicatorMBS
Property n4 As NSProgressIndicatorMBS
Property n5 As NSProgressIndicatorMBS
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
Class ProgressBarKSW Inherits CocoaControlMBS
ComputedProperty AnimateIndeterminate As Boolean
Sub Set() ActualAnimateIndeterminate = value me.Update() End Set
Sub Get() Return ActualAnimateIndeterminate End Get
End ComputedProperty
ComputedProperty ControlSize As Integer
Sub Set() ActualControlSize = value me.Update() End Set
Sub Get() Return ActualControlSize End Get
End ComputedProperty
ComputedProperty IsBezeled As Boolean
Sub Set() ActualIsbezeled = value me.Update() End Set
Sub Get() return ActualIsbezeled End Get
End ComputedProperty
ComputedProperty IsIndeterminate As Boolean
Sub Set() ActualIsIndeterminate = value me.Update() End Set
Sub Get() Return ActualIsIndeterminate End Get
End ComputedProperty
ComputedProperty MaxValue As Double
Sub Set() ActualMaxValue = value me.Update() End Set
Sub Get() Return ActualMaxValue End Get
End ComputedProperty
ComputedProperty MinValue As Double
Sub Set() ActualMinValue = value me.Update() End Set
Sub Get() Return ActualMinValue End Get
End ComputedProperty
ComputedProperty Opacity As Double
Sub Set() ActualOpacity = value me.Update() End Set
Sub Get() return ActualOpacity End Get
End ComputedProperty
ComputedProperty Tint As Integer
Sub Set() ActualTint = value me.Update() End Set
Sub Get() Return ActualTint End Get
End ComputedProperty
ComputedProperty Value As Double
Sub Set() ActualValue = value me.Update() RaiseEvent ValueChanged(value) End Set
Sub Get() Return ActualValue End Get
End ComputedProperty
Event ValueChanged(newValue As Double) End Event
EventHandler Function GetView() As NSViewMBS me.Update() System.DebugLog("geTvIEW") Return ActualControl End EventHandler
Private Sub Update() If ActualControl = Nil Then ActualControl = New NSProgressIndicatorMBS(0,0,me.Width,me.Height) ActualControl.StopAnimation() ActualControl.alphaValue = ActualOpacity ActualControl.doubleValue = ActualValue ActualControl.maxValue = ActualMaxValue ActualControl.minValue = ActualMinValue ActualControl.isIndeterminate = ActualIsIndeterminate ActualControl.isBezeled = ActualIsbezeled ActualControl.controlTint = ActualTint If me.ActualControlSize = NSProgressIndicatorMBS.NSSmallControlSize Then ActualControl.controlSize = NSProgressIndicatorMBS.NSSmallControlSize me.Height = 12 Else ActualControl.controlSize = NSProgressIndicatorMBS.NSRegularControlSize me.Height = 20 End If ActualControl.sizeToFit() If me.ActualAnimateIndeterminate Then ActualControl.StartAnimation() Else ActualControl.stopAnimation End If End Sub
Property Private ActualAnimateIndeterminate As Boolean
Property Private ActualControl As NSProgressIndicatorMBS
Property Private ActualControlSize As Integer
Property Private ActualIsIndeterminate As Boolean
Property Private ActualIsbezeled As Boolean
Property Private ActualMaxValue As Double
Property Private ActualMinValue As Double
Property Private ActualOpacity As Double
Property Private ActualTint As Integer
Property Private ActualValue As Double
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins