Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/CFHost Test
This example is the version from Sun, 17th Mar 2012.
Project "CFHost Test.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control iName Inherits TextField
ControlInstance iName Inherits TextField
EventHandler Sub TextChange()
update
End EventHandler
End Control
Control Radio Inherits RadioButton
ControlInstance Radio(0) Inherits RadioButton
ControlInstance Radio(1) Inherits RadioButton
EventHandler Sub Action(index as Integer)
update
End EventHandler
End Control
Control StartButton Inherits PushButton
ControlInstance StartButton Inherits PushButton
EventHandler Sub Action()
Start
End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open()
update
End EventHandler
Protected Sub Start()
c=new MyCFHost
if Radio(0).Value then
List.DeleteAllRows
if not c.LookupName(iName.text) then
MsgBox "LookupName failed."
end if
elseif Radio(1).Value then
List.DeleteAllRows
if not c.LookupAddress(iName.text) then
MsgBox "LookupAddress failed."
end if
else
beep // impossible?
end if
End Sub
Protected Sub update()
StartButton.Enabled=(Radio(0).Value or Radio(1).Value) and iName.text<>""
End Sub
Property Protected c As MyCFHost
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
Class MyCFHost Inherits CFHostMBS
EventHandler Sub Error(ErrorDomain as integer, ErrorCode as integer)
MsgBox "Error "+str(ErrorCode)+" in domain "+str(ErrorDomain)
End EventHandler
EventHandler Sub GotAddress(address as string, addressIndex as integer, count as integer)
dim l as Listbox
l=Window1.List
l.AddRow str(addressindex)
l.Cell(l.LastIndex,1)=str(count)
l.Cell(l.LastIndex,2)=address
End EventHandler
EventHandler Sub GotName(name as CFStringMBS, nameIndex as integer, count as integer)
dim l as Listbox
l=Window1.List
l.AddRow str(nameindex)
l.Cell(l.LastIndex,1)=str(count)
l.Cell(l.LastIndex,2)=name.str
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacCF Plugin.