FiveWin ActiveX Event

FiveWin ActiveX Event

Postby Jimmy » Sat Jul 16, 2022 11:27 pm

hi,

i try to understand how i can Event from ActiveX work under FiveWin.

i found bOnEvent but no Sample with aEvents which are Property of TActiveX()

---

Code: Select all  Expand view
  oAct:bOnEvent = { | cEvent, aParams | RibbonBarEvent( cEvent, aParams ) }

function RibbonBarEvent( cEvent, aParams )
   ...
   do case
      case cEvent == "Execute"

is this the Way to get Event under FiveWin :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveWin ActiveX Event

Postby Jimmy » Sun Jul 17, 2022 4:12 am

hi,

i try to use VLC Player under FiveWin
Code: Select all  Expand view
#include "fivewin.ch"
PROCEDURE Main()
LOCAL oIcon, oVLCX, oWnd

   DEFINE WINDOW oWnd FROM 0, 0 TO 600, 800 TITLE "MyPlayer" PIXEL

   @ 0, 0 ACTIVEX oVLCX OF oWnd PROGID "VideoLAN.VLCPlugin.2" SIZE 640, 480
   oVLCX:bOnEvent := { |event, aParams, pParams| OnEvent( event, aParams, pParams ) }

*  oWnd:oClient := oVLCX                  // fill Window
   @ 010, 650 BUTTON "load" OF oWnd SIZE 80, 48 PIXEL ACTION LoadFile(oVLCX)

   ACTIVATE WINDOW oWnd CENTER

   oVLCX:End()
   oWnd:End()

RETURN

FUNCTION LoadFile(oVLCX)
LOCAL cFileName := cGetFile( "Video |*.mp4|Musica |*.mp3", "Selecione medio", nil, "", .f., .t. )
LOCAL oControl
LOCAL oplaylist
LOCAL oVideo

   IF hb_isObject( oVLCX )

      oControl  := oVLCX
      oplaylist := oControl:playlist
      oVideo    := oControl:Video

      oControl:Toolbar  := .T.
      oControl:volume   := 50
      oControl:FullscreenEnabled := .T.

      oplaylist:items:clear()
      oplaylist:add( "File:///" + cFileName )

      oplaylist:playitem(0)

*     oVideo:fullscreen := .T.

   ELSE
      MsgInfo("no Object")
   ENDIF

RETURN nil

PROCEDURE OnEvent( cEvent, aParams, pParams )
   do case
      case cEvent == "MediaPlayerNothingSpecial"
      case cEvent == "MediaPlayerOpening"
      case cEvent == "MediaPlayerBuffering"
      case cEvent == "MediaPlayerPlaying"
      case cEvent == "MediaPlayerPaused"
      case cEvent == "MediaPlayerForward"
      case cEvent == "MediaPlayerBackward"
      case cEvent == "MediaPlayerEncounteredError"
      case cEvent == "MediaPlayerEndReached"
         MsgInfo("MediaPlayerEndReached")

      case cEvent == "MediaPlayerStopped"
      case cEvent == "MediaPlayerStopAsyncDone"
      case cEvent == "MediaPlayerTimeChanged"
      case cEvent == "MediaPlayerPositionChanged"
      case cEvent == "MediaPlayerSeekableChanged"
      case cEvent == "MediaPlayerPausableChanged"
      case cEvent == "MediaPlayerMediaChanged"
      case cEvent == "MediaPlayerTitleChanged"
      case cEvent == "MediaPlayerLengthChanged"
      case cEvent == "MediaPlayerChapterChanged"
      case cEvent == "MediaPlayerVout"
      case cEvent == "MediaPlayerMuted"
      case cEvent == "MediaPlayerUnmuted"
      case cEvent == "MediaPlayerAudioVolume"

      case cEvent == "Click"
      case cEvent == "DblClick"
         MsgInfo("DblClick " + VAR2CHAR(aParams),VAR2CHAR(pParams))
      case cEvent == "KeyDown"
         MsgInfo("KeyDown "  + VAR2CHAR(aParams),VAR2CHAR(pParams))
      case cEvent == "KeyPress"
         MsgInfo("KeyPress " + VAR2CHAR(aParams),VAR2CHAR(pParams))
      case cEvent == "KeyUp"

      case cEvent == "MouseDown"
      case cEvent == "MouseMove"
      case cEvent == "MouseUp"

   endcase

RETURN

FUNCTION VAR2CHAR( cIn )
LOCAL cOut := hb_valToExp( cIn )
RETURN STRTRAN( cOut, '"', '' )

that work so far and i can load / play Video
but VLC ActiveX does not react on DblClick to go "FullScreen" :o

it does work under Xbase++ and harbour HMG / Extended Version

---

VLC have Event Dblclick but "Fullscreen" IHMO does not need that Event under Xbase++ or harbour HMG
it also does not react on VLC ALT + F to switch "Fullscreen" under FiveWin

i have "test" Event
it does "react" when oWnd have Focus and VLC is NOT playing
as soon VLC play (Directshow Overlay) i do not get Dblclick Event ... :(

so what is Different in FiveWin :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveWin ActiveX Event

Postby Antonio Linares » Sun Jul 17, 2022 11:38 am

Jimmy wrote:hi,

i try to understand how i can Event from ActiveX work under FiveWin.

i found bOnEvent but no Sample with aEvents which are Property of TActiveX()

---

Code: Select all  Expand view
  oAct:bOnEvent = { | cEvent, aParams | RibbonBarEvent( cEvent, aParams ) }

function RibbonBarEvent( cEvent, aParams )
   ...
   do case
      case cEvent == "Execute"

is this the Way to get Event under FiveWin :?:


Dear Jimmy,

Please search for bOnEvent on *.prg on FWH\samples folder and you will find several examples :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveWin ActiveX Event

Postby Jimmy » Sun Jul 17, 2022 6:49 pm

hi Antonio,

thx for Answer.

i have try every *.PRG where i found bOnEvent and i "think" i got it

---

my "Problem" is that VLC does not "react" on "Click" or "KeyPress" when it is "active" (play Video).

Code: Select all  Expand view
  oVLCX:bOnEvent := { |event, aParams, pParams| OnEvent( event, aParams, pParams ) }

PROCEDURE OnEvent( cEvent, aParams, pParams )
   do case
      case cEvent == "DblClick"
         MsgInfo("DblClick " + VAR2CHAR(aParams),VAR2CHAR(pParams))

but it does "react" on VLC "internal" Event

Code: Select all  Expand view
     case cEvent == "MediaPlayerEndReached"
         MsgInfo("MediaPlayerEndReached")


---


"Click" or "KeyPress" goes to (Parent) Window where i can use SETKEY()

Code: Select all  Expand view
  SetKey( ASC("F"), { || SwitchFull( oVLCX )  } )

PROCEDURE SwitchFull( oVLCX )
LOCAL oControl
LOCAL oVideo

   IF hb_isObject( oVLCX )
      oControl  := oVLCX
      oVideo    := oControl:Video

      oVideo:toggleFullscreen()
   ENDIF
RETURN


---

but how to use SETKEY() for multiple Instance of VLC in one Dialog :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveWin ActiveX Event

Postby Antonio Linares » Sun Jul 17, 2022 10:52 pm

You may give the focus to a specific control before sending the key

oControl:SetFocus()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveWin ActiveX Event

Postby Jimmy » Mon Jul 18, 2022 11:56 pm

hi Antonio,

while i want to use multi Instance of VLC i have now use CLASS Code

Code: Select all  Expand view
CLASS FWTVlc    // FROM TActiveX

METHOD New( oWnd, nRow, nCol, nWidth, nHeight , nIndex) CLASS FWTVlc
      ::oControl := TActiveX() :New( oWnd, "VideoLAN.VLCPlugin.2", nRow, nCol, nWidth, nHeight )
      //  ::oControl := ::SUPER:New( oWnd, "VideoLAN.VLCPlugin.2", nRow, nCol, nWidth, nHeight )

      // Events
      ::oControl:bOnEvent = { | cEvent, aParams | ::VLC_Event( cEvent, aParams ) }

btw. it work with "FROM TActiveX" / ::SUPER or as show
Question : what is the right Way :?:

i also add Slot for ::bRClicked
Code: Select all  Expand view
     // ActiveX have no Property bRClicked so ADD it
      ::bRClicked = { |nRow, nCol| VLCMenu( oWnd, nRow, nCol,::oControl,::nIndex ) } 

and call it when got right-click for POPUP-Menu
Code: Select all  Expand view
     CASE cEvent == "MouseDown"
         IF aParams[1] = MK_RBUTTON
            IF !EMPTY(::bRClicked)
               EVAL(::bRClicked,aParams[4],aParams[3])
            ENDIF
         ENDIF


---

funny thing : DblClick to switch "FullScreen" does work now using CLASS Code :)
i was this line
Code: Select all  Expand view
oWnd:oClient := oVLCX                  // fill Window

which i do not have for multiple Instance of VLC in one Window
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: FiveWin ActiveX Event

Postby Antonio Linares » Tue Jul 19, 2022 5:25 am

Very good!

You are mastering FWH ;-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests