View Issue Details

IDProjectCategoryView StatusLast Update
0007177MMW v4Framework: Scripts/Extensionspublic2011-02-08 00:22
Reporterzvezdan Assigned To 
PriorityimmediateSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version4.0 
Target Version4.0Fixed in Version4.0 
Summary0007177: SDB.SelectedSongList.Count is not correct after SDBForm.ShowModal [b1343]
DescriptionAfter opening some modal window (maybe even modeless, didn't tested that), SDB.SelectedSongList.Count returns 0 and SDB.SelectedSongList is unknown object even if there are one or more selected tracks.

This works fine with 4.0.0.1333 and before, but not with 4.0.0.1343.

This bug is very serious, causing errors and incorrect behavior in my scripts.
Additional InformationOption Explicit

Sub OnStartup()
    Dim oMenuItem

    Set oMenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    oMenuItem.Caption = SDB.Localize("Test SelectedSongList")
    oMenuItem.UseScript = Script.ScriptPath
    oMenuItem.OnClickFunc = "Test"
End Sub

Sub Test(oItem)
    Dim oForm
    Dim lblInfo
    Dim chkSelTracks
    Dim btnCancel
    Dim oCtrlTimer
    Dim iModalResult

    Set oForm = SDB.UI.NewForm
    oForm.Common.SetRect 100, 100, 300, 130
    oForm.Caption = SDB.Localize("Test")

    Set lblInfo = SDB.UI.NewLabel(oForm)
    lblInfo.Caption = "Selected tracks: " & SDB.SelectedSongList.Count
    lblInfo.Common.SetRect 10, 10, 300, 17

    Set chkSelTracks = SDB.UI.NewCheckBox(oForm)
    chkSelTracks.Common.SetRect 10, 30, 300, 20
    chkSelTracks.Caption = "Just click on me!"
    Script.RegisterEvent chkSelTracks.Common, "OnClick", "chkSelTracks_OnClick"

    Set btnCancel = SDB.UI.NewButton(oForm)
    btnCancel.Caption = SDB.Localize("&Close")
    btnCancel.Common.SetRect 200, 60, 70, 25
    btnCancel.Cancel = True
    btnCancel.ModalResult = 2

    Set oCtrlTimer = SDB.CreateTimer(5000)
    Script.RegisterEvent oCtrlTimer, "OnTimer", "oCtrlTimer_OnTimer"
    oCtrlTimer.Enabled = True

    iModalResult = oForm.ShowModal
End Sub

Sub chkSelTracks_OnClick(oCtrl)
    SDB.MessageBox "Selected tracks: " & SDB.SelectedSongList.Count, mtInformation, Array(mbOK)
End Sub

Sub oCtrlTimer_OnTimer(oTimer)
    oTimer.Enabled = False
    SDB.MessageBox "Selected tracks: " & SDB.SelectedSongList.Count, mtInformation, Array(mbOK)
End Sub
TagsNo tags attached.
Fixed in build1345

Activities

jiri

2011-01-17 10:05

administrator   ~0022369

Setting as Immediate, so that it doesn't break many scripts. An automated regression test for this and related issues might be useful.

petr

2011-01-17 12:39

developer   ~0022370

I can't reproduce in current build.

zvezdan

2011-01-17 15:41

updater   ~0022377

Steps to reproduce the problem:
1. Copy test script to Auto folder and restart the program (b1343);
2. select one or more tracks in the main tracklist;
3. choose Edit / Test SelectedSongList;
4. click on the checkbox or wait for 5 seconds -> you would get dialog box saying there is 0 selected tracks.

Do the same with b1333 or 3.x and you would get displayed the actual number of selected tracks.

petr

2011-01-17 17:54

developer   ~0022384

I've tried your script in development version and can't reproduce. Retest that in next build, please.

zvezdan

2011-01-20 00:02

updater   ~0022471

It is not resolved with 1344.

jiri

2011-01-20 10:12

administrator   ~0022486

Works fine for me as well... (build 1344) :-?

petr

2011-01-20 10:28

developer   ~0022487

Can you send me your screenshot ? is that clean installation ? Also debuglog would help.

zvezdan

2011-01-20 16:34

updater   ~0022497

http://img87.imageshack.us/img87/6781/mmselected.png

Sorry, but I found it is a bug with old versions (3.2) as well. Also, I found that it is happening only if I have undocked the Now Playing panel. SDB.SelectedSongList.Count before ShowModal displays number of selected tracks in the main tracklist (as it should since it is the last which had focus), and after ShowModal it displays number of selected tracks in the Now Playing panel. Since I had 0 selected tracks in NP, I got SDB.SelectedSongList.Count = 0.

petr

2011-01-21 21:40

developer   ~0022522

Fixed in 1345

peke

2011-02-08 00:22

developer   ~0022900

Verified 1346