Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Compression/zlib/Compress example
Function:
Required plugins for this example: MBS Compression Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Compression/zlib/Compress example
This example is the version from Sun, 17th Mar 2012.
Project "Compress example.rbp"
Class Window1 Inherits Window
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim s as string me.Enabled=false s=editfield1.text // Compression is from Level 0 to Level 9, where 0 is no compression and 9 is best compression. s=CompressZLibMBS(s,9) delta=s staticText2.text=str(lenb(s))+" Bytes" editfield1.text=s editfield1.selstart=0 PushButton2.Enabled=true End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim s as string me.Enabled=False 's=editfield1.text s=delta // on Windows you can't reuse the string form the editfield, // so we save it now in delta. // You need to give a good guess for the output size. // if your guess is to small you get an empty string back s=DecompressZLibMBS(s,10000) editfield1.text=s editfield1.selstart=0 staticText2.text=str(lenb(s))+" Bytes" PushButton1.Enabled=true End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
EventHandler Sub Open() backup=editfield1.text staticText2.text=str(lenb(backup))+" Bytes" End EventHandler
Property Protected backup As string
Property Protected delta As string
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 Compression Plugin.




Links
MBS Xojo Plugins