Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/PHP/PHPTest callback
Required plugins for this example: MBS Tools Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/PHP/PHPTest callback
This example is the version from Thu, 6th Apr 2016.
Project "PHPTest callback.rbp"
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
EventHandler Sub Open() dim n as integer dim f as FolderItem if TargetWin32 then f=FindFile("php5ts.dll") elseif TargetMachO then f=FindFile("libphp5.mac.dylib") elseif TargetLinux then f=FindFile("libphp5.so") else MsgBox "Unsupported Platform." quit end if if not PHPMBS.LoadLibrary(f) then MsgBox "Failed to load php library." end if dim p as new MYPHP if p.Inited then if p.Run("echo callRealbasic();") then MsgBox "Ok" else MsgBox "fail" end if if p.Run("echo callRealbasic(1.0,2);") then MsgBox "Ok" else MsgBox "fail" end if if p.Run("echo callRealbasic('php','callback');") then MsgBox "Ok" else MsgBox "fail" end if if p.Run("echo callRealbasic(true,2);") then MsgBox "Ok" else MsgBox "fail" end if else MsgBox "Failed to initialize." end if quit End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
End Class
Class MYPHP Inherits PHPMBS
EventHandler Function Callback(ArgumentCount as Integer) As variant MsgBox "callback "+CallbackArgumentString(0)+" "+CallbackArgumentString(1) Return "returnvalue "+CallbackArgumentString(0)+" "+CallbackArgumentString(1) End EventHandler
EventHandler Sub LogMessage(message as string) MsgBox "LogMessage"+EndOfLine+EndOfLine+message End EventHandler
EventHandler Sub Write(data as string) MsgBox "Write"+EndOfLine+EndOfLine+data End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo Chart Plugins