Play a video on a PanelGadget?
Play a video on a PanelGadget?
Is there any way to use LoadMovie to play a video on a specific X/Y position on a PanelGadget? Every time I try the video seems to be overlayed on top of it, so that if I switch panels, the video is still showing. I was using OpenWindowedScreen to play the video.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Play a video on a PanelGadget?
Here's a modified version of the OpenWindowedScreen example from the Help. What I want it to do, is only show the video when tab 2 is selected, and hide the video when tab 1 is selected. I can't work it out. Do you think it's possible?
Code: Select all
If InitSprite() = 0
MessageRequester("Error", "Can't open screen & sprite enviroment!", 0)
End
EndIf
If OpenWindow(0, 0, 0, 400, 300, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1,5,5,390,290)
AddGadgetItem(1,-1,"1")
AddGadgetItem(1,-1,"2")
CloseGadgetList()
m=OpenWindowedScreen(WindowID(0), 40, 40, 160, 160, 0, 0, 0)
If m
CreateSprite(0, 20, 20)
If StartDrawing(SpriteOutput(0))
Box(0, 0, 20, 20, RGB(255, 0, 155))
Box(5, 5, 10, 10, RGB(155, 0, 255))
StopDrawing()
EndIf
Else
MessageRequester("Error", "Can't open windowed screen!", 0)
End
EndIf
EndIf
direction = 2
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_Gadget
If EventGadget() = 1
If GetGadgetState(1)=1
ShowWindow_(m,#SW_HIDE) ; Doesn't work.
Else
ShowWindow_(m,#SW_SHOW) ; Doesn't work.
EndIf
EndIf
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
FlipBuffers()
ClearScreen(RGB(0, 0, 0))
DisplaySprite(0, x, x)
x + direction
If x > 140 : direction = -2 : EndIf
If x < 0 : direction = 2 : EndIf
Delay(1)
ForEver
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Re: Play a video on a PanelGadget?
This works for me:
Use ResizeMovie() to relocate the playing area.
Code: Select all
InitMovie()
OpenWindow(0, 0, 0, 400, 300, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1,5,5,390,290)
AddGadgetItem(1,-1,"1")
AddGadgetItem(1,-1,"2")
CloseGadgetList()
LoadMovie(0,"*yourmovie*")
PlayMovie(0,GetWindow_(GadgetID(1),#GW_CHILD))
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Re: Play a video on a PanelGadget?
> GetWindow_(GadgetID(1),#GW_CHILD)
That's the magic stuff!
Thanks very much, FB!
That's the magic stuff!

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Play a video on a PanelGadget?
Does it work with this command OpenGadgetList(1,0) ?
Sorry I can't test this code. (PB not installed on my notebook)
Sorry I can't test this code. (PB not installed on my notebook)
Code: Select all
InitMovie()
OpenWindow(0, 0, 0, 400, 300, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1,5,5,390,290)
AddGadgetItem(1,-1,"1")
AddGadgetItem(1,-1,"2")
CloseGadgetList()
LoadMovie(0,"*yourmovie*")
PlayMovie(0,OpenGadgetList(1,0)) ; <--- display the movie inside the first tab panel (don't know if it works)
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend

Re: Play a video on a PanelGadget?
> PlayMovie(0,OpenGadgetList(1,0))
Yep, that works for me too.
Yep, that works for me too.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Play a video on a PanelGadget?
The OpenGadgetList version is preferable here because you can choose any panel. The GetWindow code is only good for the first panel.
BERESHEIT
Re: Play a video on a PanelGadget?
OpenGadgetList does not work with Windows 7 x64 PB x64
GetWindow_(GadgetID(1),#GW_CHILD) is ok
But PB want the movie in panel 2
here is my tip
Have fun
GetWindow_(GadgetID(1),#GW_CHILD) is ok
But PB want the movie in panel 2
here is my tip
Code: Select all
InitMovie()
OpenWindow(0, 0, 0, 400, 300, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1,5,5,390,290)
AddGadgetItem(1,-1,"2")
AddGadgetItem(1,0,"1")
CloseGadgetList()
LoadMovie(0,"**your movie here**")
SetGadgetState(1,0)
Repeat
Event = WaitWindowEvent()
If Event=#PB_Event_Gadget
Num =GetGadgetState(1)
Result$ = GetGadgetItemText(1, Num,0)
If Result$ = "2"
If Movieflag = 0
PlayMovie(0,GetTopWindow_(GadgetID(1)))
ResizeMovie(0,0,(265-(MovieHeight(0)*384/MovieWidth(0)))/2,384,MovieHeight(0)*384/MovieWidth(0))
Else
ResumeMovie(0)
EndIf
ElseIf Result$ = "1"
If IsMovie(0)
PauseMovie(0)
Movieflag = 1
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
Egypt my love
Re: Play a video on a PanelGadget?
Perhaps a bugRASHAD wrote:OpenGadgetList does not work with Windows 7 x64 PB x64

But does PB support Win7 officially ?
Re: Play a video on a PanelGadget?
Yes eddy I think that it is a bug in PB x64
Will you please check again and report if it is a bug
OpenGadgetList is the proper command to be used
thanks
Will you please check again and report if it is a bug
OpenGadgetList is the proper command to be used
thanks
Egypt my love
Re: Play a video on a PanelGadget?
I have a x86. I think you can report this problem.
[Edit]
it's not a bug
[Edit]
it's not a bug
Last edited by eddy on Wed Oct 21, 2009 1:13 am, edited 1 time in total.

- utopiomania
- Addict
- Posts: 1655
- Joined: Tue May 10, 2005 10:00 pm
- Location: Norway
Re: Play a video on a PanelGadget?
Place a webgadget on the panelgadget, and some html in it with either the dynsrc or object tag to play the video?
Re: Play a video on a PanelGadget?
OpenGadgetList() does not return a value. Whatever you get on x86 is just a coincidence.
quidquid Latine dictum sit altum videtur
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Play a video on a PanelGadget?
Ha, I thought it was meant to. If not, then this (windows only) will get it, iirc by GPI:
Code: Select all
ProcedureDLL.l GetPanelItemhWnd(gadget, Item); Return the WindowID of a Panel-Item
tc_item.TC_ITEM
tc_item\mask=#TCIF_PARAM
SendMessage_(GadgetID(Gadget),#TCM_GETITEM,Item,tc_item)
ProcedureReturn tc_item\lparam
EndProcedure
BERESHEIT
Re: Play a video on a PanelGadget?
I see. Thx Freak for this confirmation.
Here is a fixed version:
Here is a fixed version:
Code: Select all
InitMovie()
MovieName$=OpenFileRequester("Choose the movie to play", "", "Movie/Audio files|*.avi;*.mpg;*.asf;*.mp3;*.wav|All Files|*.*", 0)
If MovieName$
OpenWindow(0, 0, 0, 400, 300, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1, 5, 5, 390, 290)
AddGadgetItem(1, -1, "1")
AddGadgetItem(1, -1, "2")
CloseGadgetList()
OpenGadgetList(1, 0)
w=GetGadgetAttribute(1, #PB_Panel_ItemWidth)
h=GetGadgetAttribute(1, #PB_Panel_ItemHeight)
MovieContainer=ContainerGadget(2, 0, 0, w, h, #PB_Container_BorderLess)
LoadMovie(0, MovieName$)
ResizeMovie(0, 0, 0, w, h)
PlayMovie(0, MovieContainer) ; <--- display the movie inside the first tab panel (don't know if it works)
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
EndIf
