Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/IOPowerSources
Function:
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/IOPowerSources
This example is the version from Fri, 15th Jun 2017.
Project "IOPowerSources.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() p = new MyIOPowerSourcesMBS update End EventHandler
Sub Update() dim d as CFDictionaryMBS dim o as CFObjectMBS dim i,c as integer list.DeleteAllRows List.AddRow str(p.count)+" Power sources." List.AddRow "" for i=0 to p.Count-1 List.AddRow "Power Source "+str(i+1) d=p.Item(i) // show on the console CFShowMBS d if p<>Nil then o=d.Value(NewCFStringMBS("Current Capacity")) if o isa CFNumberMBS then List.AddRow "CurrentCapacity: "+str(CFNumberMBS(o).integerValue) end if o=d.Value(NewCFStringMBS("Name")) if o isa CFStringMBS then List.AddRow "Name: "+CFStringMBS(o).str end if o=d.Value(NewCFStringMBS("BatteryHealth")) if o isa CFStringMBS then List.AddRow "Battery Health: "+CFStringMBS(o).str end if end if List.AddRow "" next End Sub
Property p As iopowerSourcesMBS
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 MyIOPowerSourcesMBS Inherits IOPowerSourcesMBS
EventHandler Sub Changed() MainWindow.update End EventHandler
End Class
End Project

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins