Announcement

Collapse
No announcement yet.

EZGUI 4.0 Pro - Sale on Upgrades from 1.0, 2.0, 3.0 or PV

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chris Boss
    replied
    EZGUI's Canvas control can not only display Bitmaps, but it has a Sprite engine where it can show/hide/move non-rectangular images (you define a transparent pixel color) on top of the Canvas. The Sprites can also be anti-aliased and alphablended to the background.

    Here is a screenshot of Sprites (balls) on a Canvas and then the Sprites being alphablended to the background:



    Leave a comment:


  • Chris Boss
    replied
    Chris,

    One way or another you will need to create a visual interface for your application. Using Powerbasic this requires some kind of GUI command set. PowerBasics DDT is fine, but if you need more advanced interfaces you will have to deal with the Windows API. The Windows API is the operating system calls needed to generate the interface (windows).

    The visual interface is made of two basic parts.

    Forms or Dialogs

    which are basically the parent window for the entire application.

    Controls

    these are unique smaller child windows which act as the interface. A button is considered a control. A listbox is a control. A text box is a control. A checkbox or radio (option) box is a control.

    Even having a Bitmap displayed requires either the form (dialog) to display it or a control which can display graphics.

    While such GUI code can be manually coded, it is very time consuming to get it just right. Most PB'ers use some kind of Visual Designer, where you can visually (WYSIWYG) design the layout of where the buttons go, where the picture control goes, etc.

    Beyond the creation of the GUI (Graphic user interface), one needs to interact with it. This requires loading a Bitmap and passing it to the control/form that displays it, responding to a mouse click, etc.

    To play a video requires calling the operating system to load and play the video.

    Windows is very different than a text based user interface (ie. DOS apps).

    Windows is event oriented (or message based actually). Your code does not run in a linear fashion. Your code with be routines which will respond to an event. An application runs in an idle mode (called the message loop) waiting for something to happen (a mouse click, a key pressed). When something happens an event (or message) is generated and passed to your application. Your applications must parse out that event and handle it somehow.

    Here is a screenshot of a simple Form with many different controls on it:



    The Standard controls are relatively easy to work with using DDT.

    The Common Controls (more advanced) and RichEdit control are a bit more complicated and will require some knowledge of the Windows API (operating system calls) to work with them.

    At the right above, are a number of controls unique to EZGUI. EZGUI has its own Ownerdraw engine which makes it easy to customize a number of controls. For example, Buttons normally can't have colors. EZGUI's ownerdraw engine allows you to display 2D and 3D colored buttons, as well as to be able to customize them any way you want.

    EZGUI also provides a number of custom controls (which I designed) which are not found in Windows. There is:

    - Canvas control (for drawing images and includes a Sprite engine which can AlphaBlend sprites on top of your canvas)
    - Turtle Graphics control (vector based Turtle Graphic Macro language)
    - Properties Listbox control
    - Files Listbox control
    - Shape/HotSpot control
    - MCI control

    The MCI control makes it easy to work with the MCI command set and it provides a simplified command set for you. For example the control can be for displaying video (AVI, MPEG, etc.). The control can display the video inside itself or as a stand alone window floating above the application. The control can play audio, audio CD's and MIDI. The EZGUI simplified MCI command set is much easier to use than pure MCI using the Windows API.

    For example, here is a screenshot of a very simple media player, which can play video, audio, audio CD and MIDI. The application is a non-rectangular window based on a Bitmap background image. It also has 3D Buttons.



    The program above is playing a 3D animation video.

    Here is the source code for the application:

    Code:
    #COMPILE EXE
    #DIM ALL        '   This is helpful to prevent errors in coding
    ' ------------------------------
    #INCLUDE "C:\ezgui40pro\includes\ezgui40.inc"                          ' EZGUI Include file for Declares
    ' --------------------
    ' *************************************************************************************
    '                   Code Generator Defined Constants and Declares
    ' *************************************************************************************
    DECLARE FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG
    DECLARE SUB OtherForm_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB OtherForm_Design(FormName$)
    DECLARE FUNCTION PreProcess_Events(FormName$, CID&, CMsg&, CVal&, Cancel&) AS LONG
    DECLARE SUB EZ_MPLAY_Display(BYVAL Parent$)
    DECLARE SUB EZ_MPLAY_Design()
    DECLARE SUB EZ_MPLAY_ParseEvents(CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_Events(CID&, CMsg&, CVal&, Cancel&)
    ' ------------------------------------------------
    %MPLAY_MCIMSGBOX          = 100
    %MPLAY_OPENMOVIEBUTTON    = 105
    %MPLAY_OPENAUDIOBUTTON    = 110
    %MPLAY_OPENMIDIBUTTON     = 115
    %MPLAY_OPENCDBUTTON       = 120
    %MPLAY_PLAYBUTTON         = 125
    %MPLAY_REWINDBUTTON       = 130
    %MPLAY_FASTFORWARDBTN     = 135
    %MPLAY_PAUSEBUTTON        = 140
    %MPLAY_STOPBUTTON         = 145
    %MPLAY_RIGHTBUTTON        = 150
    %MPLAY_DOWNBUTTON         = 155
    %MPLAY_MCIPLAYER          = 160
    %MPLAY_XBUTTON            = 165
    %MPLAY_TEMPLATE           = 170
    DECLARE SUB MPLAY_OPENMOVIEBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_OPENAUDIOBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_OPENMIDIBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_OPENCDBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_PLAYBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_REWINDBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_FASTFORWARDBTN_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_PAUSEBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_STOPBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_RIGHTBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_DOWNBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_MCIPLAYER_Set(BYVAL C$)
    DECLARE SUB MPLAY_MCIPLAYER_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MPLAY_XBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    ' --------------------
    #INCLUDE "C:\ezgui40pro\includes\ezwmain.inc"                          ' EZGUI Include file for WinMain
    ' --------------------
    '
    '<<SAVE>>
    GLOBAL App_FormRightStatus&
    GLOBAL App_FormDownStatus&
    GLOBAL App_MediaType&
    '<<END>>
    '
    SUB EZ_Main(VerNum&)     ' (PROTECTED)
         EZ_Reg %EZ_CUSTID,%EZ_REGNUM
         EZ_DefImageFolder "Graphics"
         EZ_AllowCommandEvents  0
         EZ_DefFont 6, "Arial", 10, "V"
         EZ_DefFont 7, "Courier New", 10, "F"
         EZ_DefFont 8, "Times New Roman", 10, "V"
         EZ_DefFont 9, "Modern", 10, "V"
         EZ_DefSystemColor 32, 4
         EZ_DefSystemColor 33, 5
         EZ_DefSystemColor 34, 15
         EZ_DefSystemColor 35, 24
         EZ_DefColorL 36, &H649BFF
         EZ_DefColorL 37, &HDD
         EZ_DefColorL 38, &H47A7FF
         EZ_DefColorL 39, &HD2AACF
         EZ_DefColorL 40, &H1CD5E3
         EZ_DefColorL 41, &HBC8943
         EZ_DefColorL 42, &H6C6AB7
         EZ_DefColorL 43, &HDD4489
         IF Main_Initialize(VerNum&) THEN
              EZ_MPLAY_Display ""
         END IF
    END SUB
    '
    ' -------------------------------------------------------------------------------------
    '
    SUB EZ_DesignWindow(FormName$)     ' (PROTECTED)
         SELECT CASE FormName$
              CASE "MPLAY"
                   EZ_MPLAY_Design
              CASE ELSE
                   OtherForm_Design FormName$
         END SELECT
    END SUB
    '
    ' -------------------------------------------------------------------------------------
    '
    SUB EZ_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE FormName$
              CASE "MPLAY"
                   EZ_MPLAY_ParseEvents CID&, CMsg&, CVal&, Cancel&
              CASE ELSE
         END SELECT
    END SUB
    '
    ' -------------------------------------------------------------------------------------
    '
    FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG
         LOCAL RV&
         App_FormRightStatus&=1   ' right side expanded
         App_FormDownStatus&=1    ' down side expanded
         App_MediaType&=0         ' no media loaded
         RV&=1
         FUNCTION=RV&
    END FUNCTION
    '
    '<<BEGINFORM>> "MPLAY"
    '
    SUB EZ_MPLAY_Display(BYVAL Parent$)     ' (PROTECTED)
         LOCAL PN$
         PN$=EZ_LoadPicture("mediabg.bmp")
         EZ_ShapeFormToPicture PN$, -1
         EZ_Color -1, -1
         EZ_Form "MPLAY", Parent$, "EZGUI Media Player", 0, 0, 67.875, 20.9375, "C"
         EZ_FreeImage PN$
    END SUB
    '
    SUB EZ_MPLAY_Design()     ' (PROTECTED)
         LOCAL CText$
         EZ_Color 22, 0
         EZ_UseFont 0
         EZ_Label %MPLAY_MCIMSGBOX, 6.25, 6.6875, 34.125, 4.3125, "Ready !", "CH"
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_OPENMOVIEBUTTON, 52, 4, 13.5, 1.625, "Open Movie File", "T"
         EZ_SetRegion "MPLAY", %MPLAY_OPENMOVIEBUTTON,-2,0
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_OPENAUDIOBUTTON, 52, 6.125, 13.5, 1.625, "Open Audio File", "T"
         EZ_SetRegion "MPLAY", %MPLAY_OPENAUDIOBUTTON,-2,0
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_OPENMIDIBUTTON, 52, 8.3125, 13.5, 1.625, "Open MIDI File", "T"
         EZ_SetRegion "MPLAY", %MPLAY_OPENMIDIBUTTON,-2,0
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_OPENCDBUTTON, 52, 10.5, 13.5, 1.625, "Use Audio CD", "T"
         EZ_SetRegion "MPLAY", %MPLAY_OPENCDBUTTON,-2,0
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_PLAYBUTTON, 16.125, 18.9375, 7.5, 1.5, "{{BIG_SAME_ARROWRT}}", "T"
         EZ_SetRegion "MPLAY", %MPLAY_PLAYBUTTON,-2,0
         EZ_AddToolTip "MPLAY", %MPLAY_PLAYBUTTON
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_REWINDBUTTON, 24.5, 18.9375, 7.5, 1.5, "{{DOUBLE_ARROWLF}}", "T"
         EZ_SetRegion "MPLAY", %MPLAY_REWINDBUTTON,-2,0
         EZ_AddToolTip "MPLAY", %MPLAY_REWINDBUTTON
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_FASTFORWARDBTN, 32.875, 18.9375, 7.5, 1.5, "{{DOUBLE_ARROWRT}}", "T"
         EZ_SetRegion "MPLAY", %MPLAY_FASTFORWARDBTN,-2,0
         EZ_AddToolTip "MPLAY", %MPLAY_FASTFORWARDBTN
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_PAUSEBUTTON, 11.625, 18.9375, 3.625, 1.5, "{{DOUBLE_SAME_RECT}}", "T"
         EZ_SetRegion "MPLAY", %MPLAY_PAUSEBUTTON,-2,0
         EZ_AddToolTip "MPLAY", %MPLAY_PAUSEBUTTON
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_STOPBUTTON, 7.25, 18.9375, 3.625, 1.5, "{{SAME_RECT}}", "T"
         EZ_SetRegion "MPLAY", %MPLAY_STOPBUTTON,-2,0
         EZ_AddToolTip "MPLAY", %MPLAY_STOPBUTTON
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_RIGHTBUTTON, 43.25, 7.75, 2.375, 1.75, "{{SAME_ARROWLF}}", "T"
         EZ_SetRegion "MPLAY", %MPLAY_RIGHTBUTTON, 1,0
         EZ_AddToolTip "MPLAY", %MPLAY_RIGHTBUTTON
         ' -----------------------------------------------
         EZ_Color 0, 36
         EZ_UseFont 4
         EZ_ODButton %MPLAY_DOWNBUTTON, 21.5, 15.875, 3.5, 1.25, "{{SAME_ARROWUP}}", "T"
         EZ_SetRegion "MPLAY", %MPLAY_DOWNBUTTON, 1,0
         EZ_AddToolTip "MPLAY", %MPLAY_DOWNBUTTON
         ' -----------------------------------------------
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_MCIControl %MPLAY_MCIPLAYER, 52, 1.75, 2.5, 1.25, "H"
         MPLAY_MCIPLAYER_Set ""
         ' -----------------------------------------------
         EZ_Color 15, 37
         EZ_UseFont 0
         EZ_ODButton %MPLAY_XBUTTON, 63.5, 1.75, 3, 1.5, "X", ""
         EZ_SetRegion "MPLAY", %MPLAY_XBUTTON,-2,0
         ' -----------------------------------------------
         EZ_Color 0, 24
         EZ_UseFont 4
         EZ_Label %MPLAY_TEMPLATE, 5, 2.25, 36.5, 13, "", "CH"
         ' -----------------------------------------------
    END SUB
    '
    SUB EZ_MPLAY_ParseEvents(CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE CID&
              CASE %EZ_Window
                   MPLAY_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_LButtonDown THEN
                        EZ_DragForm "MPLAY"
                   END IF
              CASE  %MPLAY_OPENMOVIEBUTTON
                   MPLAY_OPENMOVIEBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_OPENMOVIEBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_OPENAUDIOBUTTON
                   MPLAY_OPENAUDIOBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_OPENAUDIOBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_OPENMIDIBUTTON
                   MPLAY_OPENMIDIBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_OPENMIDIBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_OPENCDBUTTON
                   MPLAY_OPENCDBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_OPENCDBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_PLAYBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Play"
                   MPLAY_PLAYBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_PLAYBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_REWINDBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Rewind"
                   MPLAY_REWINDBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_REWINDBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_FASTFORWARDBTN
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Fast Forward"
                   MPLAY_FASTFORWARDBTN_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_FASTFORWARDBTN, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_PAUSEBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Pause"
                   MPLAY_PAUSEBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_PAUSEBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_STOPBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Stop"
                   MPLAY_STOPBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_STOPBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_RIGHTBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip ""
                   MPLAY_RIGHTBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonE "MPLAY", %MPLAY_RIGHTBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_DOWNBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip ""
                   MPLAY_DOWNBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonE "MPLAY", %MPLAY_DOWNBUTTON, CVal&, 36, 0,  4
                   END IF
              CASE  %MPLAY_MCIPLAYER
                   MPLAY_MCIPLAYER_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %MPLAY_XBUTTON
                   MPLAY_XBUTTON_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "MPLAY", %MPLAY_XBUTTON, CVal&, 37, 15,  0
                   END IF
              CASE ELSE
                   MPLAY_Events CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    SUB MPLAY_Events(CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CID&
              CASE %EZ_Window
                   SELECT CASE CMsg&
                        CASE %EZ_Loading
                        CASE %EZ_Loaded
                        CASE %EZ_Started
                        CASE %EZ_Close
                        CASE ELSE
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    '<<SAVE>>
    SUB ShowMCIMessage(BYVAL M$)
         IF M$="" THEN
              EZ_HideC "MPlay", %MPLAY_MCIMSGBOX, %MPLAY_MCIMSGBOX
         ELSE
              EZ_SetText "MPlay", %MPLAY_MCIMSGBOX, M$
              EZ_ShowC "MPlay", %MPLAY_MCIMSGBOX, %MPLAY_MCIMSGBOX
         END IF
    END SUB
    '
    SUB ResizeMCI(BYVAL Mode&)
         LOCAL C!, R!, W!, H!
         IF Mode&=1 THEN
              EZ_GetSizeC "MPlay", %MPLAY_TEMPLATE, C!, R!, W!, H!
              EZ_ResizeC "MPlay",%MPLAY_MCIPLAYER, C!, R!, W!, H!
              EZ_ShowC "MPlay",%MPLAY_MCIPLAYER,%MPLAY_MCIPLAYER
         ELSE
              EZ_HideC "MPlay",%MPLAY_MCIPLAYER,%MPLAY_MCIPLAYER
         END IF
    END SUB
    '
    SUB OpenMedia(BYVAL Mode&)
         LOCAL F$, TT$, EX$, CMD$, M$, P$
         EZ_UseMCI "MPlay", %MPLAY_MCIPLAYER
         SELECT CASE Mode&
              CASE 1    ' movie
                   TT$="Select Movie File"
                   EX$="AVI (*.avi))|*.avi|MPeg (*.mpg,*.mpeg)|*.mpg,*.mpeg|"
                   CMD$="EZOpenMovie "
                   P$=" +"
              CASE 2    ' audio
                   TT$="Select Audio File"
                   EX$="Wave (*.wav))|*.wav"
                   CMD$="EZOpenWave "
              CASE 3    ' MIDI
                   TT$="Select MIDI File"
                   EX$="MIDI (*.mid)|*.mid"
                   CMD$="EZOpenMIDI "
              CASE 4    ' CD
                   TT$=""
                   EX$=""
                   CMD$="EZOpenCD"
         END SELECT
         IF TT$<>"" THEN
              EZ_Color -1,-1
              F$=EZ_OpenFile("MPlay",TT$, "", EX$, "RZN")
              IF F$<>"" THEN
                   ResizeMCI Mode&
                   EZ_SetMCI CMD$+"|"+F$+"|"+P$
                   M$=EZ_GetMCI
                   IF M$="OK" THEN
                        App_MediaType&=Mode&
                   ELSE
                        ShowMCIMessage M$
                        App_MediaType&=0
                   END IF
              END IF
         ELSE ' must be CD
              ResizeMCI Mode&
              EZ_SetMCI CMD$
              M$=EZ_GetMCI
              IF M$="OK" THEN
                   App_MediaType&=Mode&
              ELSE
                   ShowMCIMessage M$
                   App_MediaType&=0
              END IF
         END IF
         ShowMCIMessage ""
    END SUB
    '<<END>>
    '
    SUB MPLAY_OPENMOVIEBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   OpenMedia 1
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_OPENAUDIOBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   OpenMedia 2
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_OPENMIDIBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   OpenMedia 3
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_OPENCDBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   OpenMedia 4
              CASE ELSE
         END SELECT
    END SUB
    '
    '<<SAVE>>
    SUB ExeMCICommand(BYVAL Mode&)
         LOCAL P$, DFlag&
         LOCAL CTrack&, MaxTrack&
         IF App_MediaType&<>0 THEN
              EZ_UseMCI "MPlay", %MPLAY_MCIPLAYER
              SELECT CASE Mode&
                   CASE 1    ' play
                        EZ_SetMCI "EZPlay"
                        IF App_MediaType&=1 THEN ShowMCIMessage "" ELSE ShowMCIMessage "Playing"
                   CASE 2    ' rewind
                        IF App_MediaType&=4 THEN
                             DFlag&=-1
                             GOSUB ChangeCDTrack
                        ELSE
                             EZ_SetMCI "EZToStart"
                             IF App_MediaType&=1 THEN ShowMCIMessage "" ELSE ShowMCIMessage "Rewinding to Start"
                        END IF
                   CASE 3    ' fast forward
                        IF App_MediaType&=4 THEN
                             DFlag&=1
                             GOSUB ChangeCDTrack
                        ELSE
                             EZ_SetMCI "EZToEnd"
                             IF App_MediaType&=1 THEN ShowMCIMessage "" ELSE ShowMCIMessage "Fast Forward to End"
                        END IF
                   CASE 4    ' pause
                        EZ_SetMCI "EZPause"
                        IF App_MediaType&=1 THEN ShowMCIMessage "" ELSE ShowMCIMessage "Pause"
                   CASE 5    ' stop
                        EZ_SetMCI "EZStop"
                        IF App_MediaType&=1 THEN ShowMCIMessage "" ELSE ShowMCIMessage "Stop"
                   CASE ELSE
              END SELECT
         END IF
         EXIT SUB
    '
         ChangeCDTrack:
         ' must set Time frame using EZTimeBy before using the EZTO command
         EZ_SetMCI "EZTimeBy"     ' use default
         EZ_SetMCI "EZTrack CURRENT"
         CTrack&=VAL(EZ_GetMCI)
         EZ_SetMCI "EZTrack MAX"
         MaxTrack&=VAL(EZ_GetMCI)
         CTrack&=CTrack&+DFlag&
         IF CTrack&<1 THEN CTrack&=1
         IF CTrack&>MaxTrack& THEN CTrack&=MaxTrack&
         EZ_SetMCI "EZStop"
         EZ_SetMCI "EZTo"+STR$(CTrack&)+":0:0:0"
         EZ_SetMCI "EZTrack CURRENT"
         ShowMCIMessage "Track "+EZ_GetMCI
         RETURN
    END SUB
    '<<END>>
    '
    SUB MPLAY_PLAYBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   ExeMCICommand 1
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_REWINDBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   ExeMCICommand 2
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_FASTFORWARDBTN_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   ExeMCICommand 3
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_PAUSEBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   ExeMCICommand 4
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_STOPBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   ExeMCICommand 5
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    '<<SAVE>>
    SUB ExpandMainForm(BYVAL Mode&)
         IF Mode&=1 THEN
              IF App_FormRightStatus&=0 THEN
                   App_FormRightStatus&=1
                   EZ_ExpandForm "MPlay", 20,0
                   EZ_SetText "MPlay", %MPLAY_RIGHTBUTTON, "{{SAME_ARROWLF}}"
              ELSE
                   App_FormRightStatus&=0
                   EZ_ExpandForm "MPlay", -20,0
                   EZ_SetText "MPlay", %MPLAY_RIGHTBUTTON, "{{SAME_ARROWRT}}"
              END IF
         END IF
         IF Mode&=2 THEN
              IF App_FormDownStatus&=0 THEN
                   App_FormDownStatus&=1
                   EZ_ExpandForm "MPlay", 0, 3
                   EZ_SetText "MPlay", %MPLAY_DOWNBUTTON, "{{SAME_ARROWUP}}"
              ELSE
                   App_FormDownStatus&=0
                   EZ_ExpandForm "MPlay", 0,-3
                   EZ_SetText "MPlay", %MPLAY_DOWNBUTTON, "{{SAME_ARROWDN}}"
              END IF
         END IF
    END SUB
    '<<END>>
    '
    SUB MPLAY_RIGHTBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   ExpandMainForm 1
              CASE %EZ_ToolTip
                   EZ_SetToolTip "Hello"
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_DOWNBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   ExpandMainForm 2
              CASE %EZ_ToolTip
                   EZ_SetToolTip "Hello"
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_MCIPLAYER_Set(BYVAL C$)
    END SUB
    '
    SUB MPLAY_MCIPLAYER_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MPLAY_XBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   EZ_UnloadForm "MPlay"
              CASE ELSE
         END SELECT
    END SUB
    The application uses the EZGUI command set which is provided via DLL (Dynamic Link Library). This runtime library is distributed with the applications EXE file (your compiled app). The runtime library is 515 KB in size. The MCI control is also a DLL and it is only 31 KB in size.

    EZGUI applications, rather than use the DDT command set in the PowerBasic compiler or rather than call the Windows API (SDK style), call the EZGUI runtime DLL for its functionality. The command set is easy to learn and use.

    Here is the help files info on the MCI control command:

    EZ_MCIControl

    Purpose:

    Create a MCI control

    Syntax:

    EZ_MCIControl IDNum&, C!, R!, W!, H!, CProp$

    Description:

    This command is used to create a MCI Custom control on the current Form. The control can be hidden when using MCI features that do not require a display. It can be displayed for MCI features (ie. video) which do require a display.

    The CProp$ parameter is used to define the controls properties. The properties are listed below.

    Here is the list of properties for the MCI control :

    Properties:
    -------------------------------
    F = Flat Edge
    H = Hidden
    R = Raised Edge
    S = Sunken Edge

    You send MCI commands to the control by using the EZ_SetText command or the EZ_SetMCI command. After each command, you can check for a return string by using the EZ_GetText function or the EZ_GetMCI function. (see: API docs for more info on MCI commands)

    EZGUI also has its own EZ MCI command set as follows:
    (Pass these commands by using EZ_SetText or EZ_SetMCI)

    Note: EZOpenAVI and EZOpenMPeg no longer supported !

    "EZOpenMovie filename prop" Opens any movie type

    prop value for above command can be any of the following (no spaces)

    P - Popup window rather than child
    S - shareable (not always supported OS)
    + - Size Popup window to actual size or Stretch image
    if to large to fit child window
    N - Notify flag (generates %EZ_FinishMCI event)
    W - Wait flag (waits until command is finished before returning)

    "EZOpenWave filename prop" Opens a wave audio file
    "EZOpenMidi filename prop" Opens a Midi audio file
    "EZOpenCD prop" Opens first CD for playing

    prop value for above commands can be any of the following (no spaces)

    S - shareable (not always supported by OS)
    N - Notify flag (generates %EZ_FinishMCI event)
    W - Wait flag (waits until command is finished before returning)

    Note: it is recommended to surround the filename with quotes.
    you can also use the | character and EZGUI will change
    them to quotes.

    "EZClose" Closes object opened by any EZOpen command
    "EZPlay prop" Plays object opened by any EZOpen command

    prop value can be any of the following (no spaces):

    F - Full Screen (if supported)
    R - Repeat continuously
    N - Notify flag (generates %EZ_FinishMCI event)
    W - Wait flag (waits until command is finished before returning)

    "EZStop" Stops play for object opened by any EZOpen command
    "EZPause" Pauses play for object opened by any EZOpen command
    "EZResume" Resumes play for object opened by any EZOpen command
    "EZStep #" Steps object opened by any EZOpen command by # of frames
    "EZTo #" Moves object opened by any EZOpen command to position (#)
    "EZToStart" Moves object opened by any EZOpen command to start
    "EZToEnd" Moves object opened by any EZOpen command to end

    "EZVIDEODLG prop" Display Video configuration Dialog

    prop value can be any of the following (no spaces):

    N - Notify flag (generates %EZ_FinishMCI event)
    W - Wait flag (waits until command is finished before returning)

    "EZALIAS" get default Alias name used by above Open commands
    "EZDOOR mode prop" if mode is OPEN it opens CD door, otherwise it
    closes it (use CLOSE).

    prop value can be any of the following (no spaces):

    N - Notify flag (generates %EZ_FinishMCI event)
    W - Wait flag (waits until command is finished before returning)

    "EZSOUND mode" turns sound ON and OFF. Possible modes are:
    ON - turn on
    OFF - turn off
    LEFT ON - left speaker on
    LEFT OFF - left speaker off
    RIGHT ON - right speaker on
    RIGHT OFF - right speaker off

    "EZTRACK mode" gets status of audio CD tracks. Possible modes are:
    MAX - Maximum number of tracks
    CURRENT - current track
    TYPE - track type
    LENGTH - track length

    "EZINFO mode" gets info about open device. If mode is DEVICE then
    the return value of EZ_GetMCI is the device MCI name.
    otherwise the return value is the device name and version.
    (ie. for video it would return the codec used)

    "EZGETSIZE filename prop" get size of video for filename. The file is not
    opened by this command. It is just read to get
    its size.

    prop value can be any of the following (no spaces):

    N - Notify flag (generates %EZ_FinishMCI event)
    W - Wait flag (waits until command is finished before returning)

    "EZFLAG value prop" This command sets flags in a video to generate the
    %EZ_FlagMCI event. The value parameter depends
    upon the properties used.

    prop value can be any of the following (no spaces):

    I - Flag every interval (value equals the interval)
    F - Flag at a specific position (value equals the position)

    If no properties are used then all Flags are canceled.

    "EZTIMEBY prop" This command sets the Time by a specific interval.
    If prop is not defined, then the default is used:
    Defaults:
    Video - by Frames
    CD - by track:minutes:seconds:frames
    WAVE - by milliseconds
    MIDI - by milliseconds

    You can define prop to change time interval using one of the following properties:

    M - milliseconds
    F - Frames
    T - Tracks

    You can also define prop as one of the MCI "time format" modes
    (ie. song_pointer) If the time format mode description has multiple
    words use an _ character instead of a space.



    "EZLENGTH" This command requests the length of the currently open
    media. The length is returned in the current time format.
    Use EZ_GetMCI to get the return value.


    Macros for MCI commands:

    | The | character can be used to replace quotation marks (which are
    needed around filenames). EZGUI will convert them to quotation
    marks internally.

    {EZ} Default Alias macro. Previously you could not mix and match
    EZGUI EZ commands and pure MCI commands. Now you can. Instead
    of using your own alias name, you can use this macro instead
    and EZGUI will replace it with its internal alias name, which
    will allow you to use the EZ commands along with other pure
    MCI commands. For example, you can open a device using the
    MCI open command using the {EZ} macro for the alias and EZGUI
    will allow you to use any of the above EZ commands with that
    open device.


    Example:

    EZ_MCIControl %Form1_MCI, 12, 2, 34, 14, "S"
    EZ_SetText "Form1", %Form1_MCI, _
    "EZOpenMovie myvideo.mpeg"
    EZ_SetText "Form1", %Form1_MCI, "EZPlay"
    Last edited by Chris Boss; 4 Jun 2008, 02:00 PM.

    Leave a comment:


  • Chris Burgess
    replied
    Hi Chris,

    You said:

    I don't want to discuss my GUI tool in any detail here (check out third party forum for posts), but it does come with a MCI control which has a simplified MCI command set. It can play any MCI device (video, audio, CD) and it is a real control. For more info post a question in the third party forum.

    Had a quick look at the stuff on your site, but it's a little above my level for now.
    You say you can play a video, but nor sure what you mean by a "real" control. The only (playback "user") controls I want are stop and play, and maybe pause. No seek / FF / REW or the like.

    Also, can your GUI addon be used to show a bitmap image as the background of the application window? For a more detailed explanation of what I want to achieve, see the "jobs wanted" forum post I made today.

    Regards,
    Chris

    Leave a comment:


  • EZGUI 4.0 Pro - Sale on Upgrades from 1.0, 2.0, 3.0 or PV


    I am having a sale on upgrades now, through June 8, 2008.

    EZGUI 4.0 is a professional level tool with an amazing list of features.

    For more details check out these posts:

    http://www.powerbasic.com/support/pb...ad.php?t=28721

    http://chrisboss.hypermart.net/ubb/F...ML/000088.html


    From May 22, 2008 until June 8, 2008 (extended) you can purchase EZGUI 4.0 Pro (upgrade) for :

    EZGUI 4.0 Pro Upgrade from 1.0, 2.0, 3.0 - $69 (Save $90)
    EZGUI 4.0 Pro Upgrade from Personal Version - $99 (Save $100)

    The save time ordering you can go directly to the oder page on my web site here:

    http://cwsof.com/order.htm

    For those who have a previous version of EZGUI Professional, this is one deal you don't want to miss. (note: my DDT Designers are NOT a previous version of EZGUI 4.0 Pro)

    Note: You won't see the sale prices reflected on my web site, until you get to the final order page which links to the actual order forms)
Working...
X