1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00
InForm/examples/GIFPlaySample/GIFPlaySample.bas

104 lines
2.7 KiB
QBasic
Raw Normal View History

2023-11-19 04:53:36 +00:00
': This program uses
': InForm - GUI library for QB64 - Beta version 9
': Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
': https://github.com/FellippeHeitor/InForm
'-----------------------------------------------------------
DEFLNG A-Z
OPTION _EXPLICIT
2023-11-19 04:53:36 +00:00
': Controls' IDs: ------------------------------------------------------------------
DIM SHARED gifplaySample AS LONG
DIM SHARED PictureBox1 AS LONG
DIM SHARED LoadBT AS LONG
DIM SHARED PlayBT AS LONG
': External modules: ---------------------------------------------------------------
'$INCLUDE:'../../InForm/InForm.bi'
'$INCLUDE:'../../InForm/extensions/GIFPlay.bi'
'$INCLUDE:'../../InForm/extensions/MessageBox.bi'
2023-11-19 04:53:36 +00:00
'$INCLUDE:'GIFPlaySample.frm'
': Event procedures: ---------------------------------------------------------------
SUB __UI_BeforeInit
END SUB
SUB __UI_OnLoad
Control(PlayBT).Disabled = True
END SUB
SUB __UI_BeforeUpdateDisplay
GIF_Update PictureBox1
2023-11-19 04:53:36 +00:00
END SUB
SUB __UI_BeforeUnload
END SUB
SUB __UI_Click (id AS LONG)
SELECT CASE id
CASE gifplaySample
CASE LoadBT
'file 'globe.gif' comes from:
'https://en.wikipedia.org/wiki/GIF#/media/File:Rotating_earth_(large).gif
IF GIF_Open(PictureBox1, "globe.gif") THEN
2023-11-19 04:53:36 +00:00
Control(PlayBT).Disabled = False
IF GIF_GetTotalFrames(PictureBox1) > 1 THEN
2023-11-19 04:53:36 +00:00
Caption(PlayBT) = "Play"
ELSE
Caption(PlayBT) = "Static gif"
Control(PlayBT).Disabled = True
END IF
Caption(LoadBT) = "globe.gif loaded"
Control(LoadBT).Disabled = True
ELSE
MessageBox "File 'globe.gif' could not be found.", "", MsgBox_Exclamation
2023-11-19 04:53:36 +00:00
END IF
CASE PlayBT
IF GIF_IsPlaying(PictureBox1) THEN
GIF_Pause PictureBox1
2023-11-19 04:53:36 +00:00
Caption(PlayBT) = "Play"
ELSE
GIF_Play PictureBox1
2023-11-19 04:53:36 +00:00
Caption(PlayBT) = "Pause"
END IF
CASE PictureBox1
GIF_HideOverlay PictureBox1
2023-11-19 04:53:36 +00:00
END SELECT
END SUB
SUB __UI_MouseEnter (id AS LONG)
END SUB
SUB __UI_MouseLeave (id AS LONG)
END SUB
SUB __UI_FocusIn (id AS LONG)
END SUB
SUB __UI_FocusOut (id AS LONG)
END SUB
SUB __UI_MouseDown (id AS LONG)
END SUB
SUB __UI_MouseUp (id AS LONG)
END SUB
SUB __UI_KeyPress (id AS LONG)
END SUB
SUB __UI_TextChanged (id AS LONG)
END SUB
SUB __UI_ValueChanged (id AS LONG)
END SUB
SUB __UI_FormResized
END SUB
'$INCLUDE:'../../InForm/InForm.ui'
'$INCLUDE:'../../InForm/xp.uitheme'
'$INCLUDE:'../../InForm/extensions/GIFPlay.bas'
'$INCLUDE:'../../InForm/extensions/MessageBox.bas'