Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Preview Handler
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Preview Handler
This example is the version from Wed, 10th Jul 2012.
Project "Preview Handler.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control PHList Inherits Listbox
ControlInstance PHList Inherits Listbox
EventHandler Sub Change() PushButton1.Enabled = me.ListIndex >= 0 End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() if w<>Nil then w.unload w = nil end if dim f as FolderItem = GetOpenFolderItem("") if f = nil then Return dim id as string = PHList.Cell(PHList.ListIndex, 0) w = new WindowsPreviewHandlerMBS(id) if w.Lasterror = 0 then w.InitWithFile(F) if w.Lasterror = 0 then w.SetWindow(self, canvas1.Left, canvas1.top, canvas1.Width, canvas1.Height) if w.Lasterror = 0 then w.DoPreview if w.Lasterror = 0 then // ok else MsgBox "Failed to run preview: "+w.LasterrorString end if else MsgBox "Failed to set window: "+w.LasterrorString end if else MsgBox "Failed to load file: "+w.LasterrorString end if else MsgBox "Failed to load preview handler: "+w.LasterrorString end if End EventHandler
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
EventHandler Sub Close() if w<>Nil then w.unload end if End EventHandler
EventHandler Sub Open() ListHandlers End EventHandler
EventHandler Sub Resized() if w<>nil then w.SetRect(canvas1.Left, canvas1.top, canvas1.Width, canvas1.Height) end if End EventHandler
EventHandler Sub Resizing() if w<>nil then w.SetRect(canvas1.Left, canvas1.top, canvas1.Width, canvas1.Height) end if End EventHandler
Sub ListHandlers() PHList.DeleteAllRows dim r as new RegistryItem("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PreviewHandlers", false) dim c as integer = r.KeyCount-1 for i as integer = 0 to c PHList.AddRow r.Name(i) PHList.Cell(PHList.LastIndex,1) = r.Value(r.Name(i)) next End Sub
Property w As WindowsPreviewHandlerMBS
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
End Project

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins