Platforms to show: All Mac Windows Linux Cross-Platform
/Util/Resplugin Examples/Modes and Fading
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/Resplugin Examples/Modes and Fading
This example is the version from Wed, 20th Jun 2017.
Project "Modes and Fading.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class MyWindow Inherits Window
Control ModeList Inherits ListBox
ControlInstance ModeList Inherits ListBox
EventHandler Sub DoubleClick()
If dis.GetResolution(Me.ListIndex).Switch = False Then
Beep 'Switch was unsuccessful
End If
End EventHandler
End Control
Control Fade50Red Inherits BevelButton
ControlInstance Fade50Red Inherits BevelButton
EventHandler Sub Action()
dis.FadeGammaTo(500, RGB(255, 0, 0), 500) 'Fade 50% to red in 500 ticks (1/2 sec)
dis.FadeGammaTo(1000, RGB(255, 0, 0), 500) 'Fade back in 500 ticks (1/2 sec)
End EventHandler
End Control
Control FadeQuickBlue Inherits BevelButton
ControlInstance FadeQuickBlue Inherits BevelButton
EventHandler Sub Action()
dis.FadeGammaTo(0, RGB(0, 0, 255), 200) 'Fade 100% to blue in 200 ticks (1/5 sec)
dis.FadeGammaTo(1000, RGB(0, 0, 255), 200) 'Fade back in 200 ticks (1/5 sec)
End EventHandler
End Control
Control ModeText Inherits Label
ControlInstance ModeText Inherits Label
End Control
Control ModeCount Inherits Label
ControlInstance ModeCount Inherits Label
End Control
EventHandler Sub Close()
Quit 'Tell to quit
End EventHandler
EventHandler Sub Open()
Dim resNum,c As Integer
Dim res As ResolutionMBS
Dim resStr As String
dim b as Boolean
if not ResolutionLibraryPresentMBS then
msgBox "The library RezLib was not found. Please place this library into the Realbasic or after compiling into your application folder."
end if
'Get the display on which to operate
dis = GetDisplayMBS(0)
if dis<>Nil then
c=dis.ResolutionCount(false)
ModeCount.Text = Str(c) 'Write number of resolutions
c=c-1
For resNum = 0 To c 'For every resolution:
res = dis.GetResolution(resNum) 'Get it and add it to the list
if res<>nil then
resStr = Str(res.Width) + "x" + Str(res.Height) + "x" + Str(res.Depth) + ", " + Str(res.Hz) + "Hz"
If res.IsSafe Then
resStr = resStr + " (*)"
End If
else
resstr="?"
end if
ModeList.AddRow resStr
Next
end if
End EventHandler
Property dis As DisplayMBS
End Class
MenuBar Menü
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu2 = "Ablage"
MenuItem FileQuit = "Beenden"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu0 = "Bearbeiten"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Ausschneiden"
MenuItem EditCopy = "Kopieren"
MenuItem EditPaste = "Einfügen"
MenuItem EditClear = "Löschen"
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Util Plugin.