View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005220 | MMW v4 | Framework: Scripts/Extensions | public | 2009-01-19 21:44 | 2009-06-05 15:14 |
Reporter | Assigned To | ||||
Priority | immediate | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 3.1 | ||||
Fixed in Version | 3.1 | ||||
Summary | 0005220: Node.Caption Fails to update immediately | ||||
Description | When attempting to dynamically set the caption for a user node, the text does not update until something causes the window to refresh (mouse over or app window active/inactive). see code example, caption should update onplay, but does not unless window gets refreshed. option explicit dim tree : set tree = sdb.maintree dim testnode : set testnode = tree.createnode Sub OnStartup() testnode.caption = "test node" testnode.Visible = True tree.addnode tree.node_library, testnode, 1 script.registerevent sdb, "OnPlay", "UpdateCaption" End Sub Sub UpdateCaption() testnode.Caption = "test node " &_ " (" & SDB.Player.CurrentSong.ArtistName &_ " - " & SDB.Player.CurrentSong.Title & " )" End Sub | ||||
Additional Information | http://www.mediamonkey.com/forum/viewtopic.php?f=6&t=36123 | ||||
Tags | No tags attached. | ||||
Fixed in build | 1222 | ||||
|
Fixed in build 1216. - Added SDBTree::Refresh method. |
|
Confirmed working, thanks! |
|
Hi Jiri, I have created a small script to update the built in "Now Playing" node to include the player current song artist-title, however the sdb.maintree.refresh does not seem to be working for it (although it works for my other user added node). edit: Hmmm, now it seems to be working correctly. I don't think I changed anything other than restarted again. edit2: actually, it isn't working when I toggle it off/on. code example Sub OnStartup Do While Not SDB.IsRunning SDB.Tools.Sleep 100 SDB.ProcessMessages Loop Dim mnu : Set mnu = SDB.UI.AddMenuItem(SDB.UI.Menu_View,1,-1) mnu.Caption = "Now Playing Node caption" mnu.Hint = "Show/Hide current artist - title on now playing node" mnu.UseScript = Script.ScriptPath mnu.OnClickFunc = "ToggleCaption" ' mnu.Shortcut = "" If SDB.IniFile.BoolValue("NowPlayingCaption","Enabled") Then mnu.Checked = True Script.RegisterEvent SDB, "OnPlay", "UpdateCaption" End If End Sub Sub ToggleCaption(obj) Dim Node If obj.Checked = True Then obj.Checked = False SDB.IniFile.BoolValue("NowPlayingCaption","Enabled") = False Set Node = SDB.MainTree.Node_NowPlaying Node.Caption = "Now Playing" SDB.MainTree.Refresh Script.UnregisterAllEvents Set Node = Nothing Else obj.Checked = True SDB.IniFile.BoolValue("NowPlayingCaption","Enabled") = True Script.RegisterEvent SDB, "OnPlay", "UpdateCaption" UpdateCaption End If End Sub Sub UpdateCaption() ' msgbox("update caption") Dim Node : Set Node = SDB.MainTree.Node_NowPlaying Node.Caption = "Now Playing (" &_ SDB.Player.CurrentSong.ArtistName & " - " &_ SDB.Player.CurrentSong.Title & ")" SDB.MainTree.Refresh End Sub |
|
actually, I think see what is happening.. if the standard now playing is the CURRENT node (meaning highlighted), the hightlight does not update the length of the newly updated string. but if the now playing node is NOT selected, the text updates correctly. to reproduce (with the above autoscript) - select now playing node - click view > toggle now playing caption - note that the highlighted now playing text did not change, but if you mouse over it will then update Now select a different node and repeat above, now playing caption updates correctly. This happens also on custom user nodes, I just never noticed before now. edit: probably related to the above caption not resizing, the horizontal scroll bars also do not update correctly when caption text changes length. |
|
Fixed in build 1222. |
|
Verified 1250 |