Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/IORegistry Serial Devices
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/IORegistry Serial Devices
This example is the version from Sun, 17th Mar 2012.
Project "IORegistry Serial Devices.rbp"
Class Window1 Inherits Window
Control List Inherits ListBox
ControlInstance List Inherits ListBox
EventHandler Sub Change() update End EventHandler
EventHandler Sub ExpandRow(row As Integer) dim i as IORegistryNodeMBS = List.RowTag(row) dim nodes() as IORegistryNodeMBS = i.parents for each node as IORegistryNodeMBS in nodes addnode node next End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control oname Inherits Label
ControlInstance oname Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control oclass Inherits Label
ControlInstance oclass Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control opath Inherits Label
ControlInstance opath Inherits Label
End Control
Control dataList Inherits ListBox
ControlInstance dataList Inherits ListBox
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
EventHandler Sub Open() if IORegistryMBS.Present then start else msgBox "No IO Registry. Please run on Mac OS X." end if End EventHandler
Function VariantText(v as Variant) As string if v.IsArray then Return "<Array>" if v isa Dictionary then Return "<Dictionary>" Return v exception // ignore all End Function
Sub addnode(i as ioregistrynodeMBS) if i<>nil then if i.ParentCount<=0 then list.addrow i.name else list.addfolder i.name end if list.cell(list.lastIndex,1)=str(i.ParentCount) list.RowTag(List.LastIndex) = i else MsgBox "addnode: nil!" end if End Sub
Sub showdata(node as ioregistrynodeMBS) dim dic as Dictionary = node.Properties for each key as Variant in dic.keys dim value as Variant = dic.Value(key) dataList.AddRow VariantText(key) dataList.cell(dataList.LastIndex,1) = VariantText(value) next End Sub
Sub start() dim items() as IORegistryNodeMBS = IORegistryMBS.MatchingServices("IOSerialBSDClient") for each item as IORegistryNodeMBS in items addnode item next End Sub
Sub update() dim n as integer dataList.deleteAllRows dim l as integer = list.listindex if l>=0 then dim i as IORegistryNodeMBS = List.RowTag(l) oname.text=i.name oclass.text=i.IOClass opath.text=i.path showdata i return end if oname.text="" oclass.text="" opath.text="" End Sub
Property root As IORegistryNodeMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo PDF Plugins