Undocking behavior

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Undocking behavior

Postby fizzjob » Tue Jun 21, 2016 3:36 pm

I'm trying to figure out how to natively make my HTML Now Playing Panel go full-screen. I've been able to figure out how to move it around from within the UI:

Code: Select all
Sub dockPanel(where)
   Dim panel : set Panel = CreateObject("SongsDB.SDBApplication")
   Panel.Objects("htmlpanel").dockedTo = where
End Sub

That code is in the html file that the panel loads - a javascript function calls the vbscript and it works fine if I just want to move the panel around within MediaMonkey. But if I try to pass that sub a parameter of 0 to undock, the panel just disappears. When I re-dock the panel, it's just a blank white panel.

The secondary trick is to make the panel go fullscreen, but that's irrelevant if I can't figure out the undocking issue first.
Posts: 401
Joined: Fri Mar 30, 2007 12:37 pm

Re: Undocking behavior

Postby Peke » Tue Jun 21, 2016 6:47 pm

Can you make small VBS sample with just resize function in order to track reasons?
Best regards,
MM Core Developer and Admin of free MediaMonkey extensions Hosting
Posts: 10589
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia

Re: Undocking behavior

Postby fizzjob » Wed Jun 22, 2016 9:54 am

This should illustrate the disappearing panel issue. I've added a sub to toggle the panel's handle so you can see that manually undocking and docking the panel works.

For some reason, if I open the same HTML file in IE it's not controlling the panel. I swear that was working for me before and I don't think anything I did should have broken that. It's a secondary concern if I can get the panel undocking properly, but I'm confused by it all the same.

Both of these should go into /scripts/auto:

Code: Select all
   <meta http-equiv="X-UA-Compatible" content="IE=10">
   <meta http-equiv="X-Frame-Options" content="allow">
   <title>Test Panel</title>
   <script type="text/vbscript">
   Sub dockPanel(where)
      Dim panel : set Panel = CreateObject("SongsDB.SDBApplication")
      Panel.Objects("testpanel").dockedTo = where
   End Sub
   Sub toggleHandle()
      Dim panel : set Panel = CreateObject("SongsDB.SDBApplication")
      If Panel.Objects("testpanel").ShowCaption = true Then
         Panel.Objects("testpanel").ShowCaption = false
         Panel.Objects("testpanel").ShowCaption = true
      End If
   End Sub
<body style="background-color:#000000; color:#FFFFFF">
   <input type="button" value="Top" onclick="vbscript:dockPanel('3')">
   <input type="button" value="Bottom" onclick="vbscript:dockPanel('4')">
   <input type="button" value="Left" onclick="vbscript:dockPanel('1')">
   <input type="button" value="Right" onclick="vbscript:dockPanel('2')">
   <input type="button" value="Undock" onclick="vbscript:dockPanel('0')">
   <input type="button" value="Toggle Handle" onclick="vbscript:toggleHandle()">

Code: Select all
Dim testPanel : Set testPanel = SDB.UI.NewDockablePersistentPanel("testpanel")
Dim testHtmlPnl
Dim Mnu

Sub OnStartup
   If testPanel.IsNew then
      testPanel.DockedTo = 3
      testPanel.Common.Height = 500
   End If
   testPanel.Caption = "testpanel"
   testPanel.ShowCaption = 0
   Set testHtmlPnl = SDB.UI.NewActiveX(testPanel, "Shell.Explorer.2")
   testHtmlPnl.Common.Align = 5
   testHtmlPnl.Interf.Navigate SDB.ScriptsPath & "Auto\panel.html"
   Set SDB.Objects("testpanel") = testPanel
   Set SDB.Objects("htmltestpanel") = testHtmlPnl
   Set Sep = SDB.UI.AddMenuItemSep(SDB.UI.Menu_View,0,0)
   Set Mnu = SDB.UI.AddMenuItem(SDB.UI.Menu_View,0,0)
   SDB.Objects("TestPanelMenuItem") = Mnu
   SDB.Objects("TestPanelSeparator") = Sep
   Mnu.Caption = "testpanel"
   Mnu.Checked = testPanel.Common.Visible
   Script.RegisterEvent Mnu, "OnClick", "ShowPanel"
End Sub

Sub ShowPanel(Item)
   testPanel.Common.Visible = not testPanel.Common.Visible
   Mnu.Checked = testPanel.Common.Visible
End Sub
Posts: 401
Joined: Fri Mar 30, 2007 12:37 pm

Return to MediaMonkey 4 Addons developer forum

Who is online

Users browsing this forum: No registered users and 6 guests