Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/HTMLViewer Mac/Google Search
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacControls Plugin, MBS Main Plugin, MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/HTMLViewer Mac/Google Search
This example is the version from Sun, 17th Mar 2012.
Project "Google Search.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() window1.left=10 window1.show window2.left=window1.left+window1.Width+10 window2.show End EventHandler
End Class
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim url as string dim query as string query=ConvertEncoding(EditField1.text,encodings.UTF8) query=EncodeURLComponent(query) url="http://www.google.com/search?q="+query+"&ie=UTF-8&oe=UTF-8" HTMLViewer1.LoadURL url End EventHandler
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
End Control
EventHandler Sub Open() EditField1.SetFocus End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class Window2 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim url as string dim query as string query=ConvertEncoding(EditField1.text,encodings.UTF8) if TargetMacOS then call HTMLViewer1.EvaluateJavaScriptMBS "document.f.q.value="""+query+"""" call HTMLViewer1.EvaluateJavaScriptMBS "document.f.submit();" else call HTMLViewer1.IERunJavaScriptMBS "document.f.q.value="""+query+"""" call HTMLViewer1.IERunJavaScriptMBS "document.f.submit();" end if End EventHandler
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
EventHandler Sub Open() me.loadurl "http://www.google.com/" End EventHandler
End Control
EventHandler Sub Open() EditField1.SetFocus End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo PDF Plugins