View Issue Details

IDProjectCategoryView StatusLast Update
0011423MMW v4Framework: Scripts/Extensionspublic2013-10-29 10:13
Reporterzvezdan Assigned To 
PrioritynoneSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0011423: ProcessMessages has a bug when used in RadioButtons event handler
DescriptionThis is a very old bug that I reported in Forum without any response (http://www.mediamonkey.com/forum/viewtopic.php?f=6&t=41807). I though it is related to QuerySongs that I have used in radio button's event handler, but actually this happens with every time-consuming code.

If I use ProcessMessages in the time-consuming radio button's event handler, none control is responsible, even the dialog box could not be moved, until the first click anywhere on that dialog box - after that click everything works fine. CheckBoxes don't have such problem. Here is the test script, you could find it under the Edit menu, (the first radio button works normally because it is without problematic code, the check box also works normally even with same problematic time-consuming code):

Option Explicit

Sub OnStartUp()
    Dim mnuTest

    Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    mnuTest.Caption = "Zvezdan's Test"
    mnuTest.OnClickFunc = "TestForm"
    mnuTest.UseScript = Script.ScriptPath
End Sub

Sub TestForm(Item)
    Dim oForm
    Dim rdbTest1
    Dim rdbTest2
    Dim chkTest
    Dim btnClose
    Dim i

    Set oForm = SDB.UI.NewForm
    oForm.Common.SetRect 100, 100, 330, 150
    oForm.BorderStyle = 3
    oForm.FormPosition = 4
    oForm.Caption = "Zvezdan's Test"

    Set rdbTest1 = SDB.UI.NewRadioButton(oForm)
    rdbTest1.Common.SetRect 10, 10, 150, 21
    rdbTest1.Caption = "Normal"
    Script.RegisterEvent rdbTest1.Common, "OnClick", "rdbTest1_OnClick"

    Set rdbTest2 = SDB.UI.NewRadioButton(oForm)
    rdbTest2.Common.SetRect 10, 40, 150, 21
    rdbTest2.Caption = "With ProcessMessages"
    Script.RegisterEvent rdbTest2.Common, "OnClick", "rdbTest2_OnClick"

    Set chkTest = SDB.UI.NewCheckBox(oForm)
    chkTest.Common.SetRect 160, 40, 150, 21
    chkTest.Caption = "With ProcessMessages"
    Script.RegisterEvent chkTest.Common, "OnClick", "chkTest_OnClick"

    Set btnClose = SDB.UI.NewButton(oForm)
    btnClose.Caption = "Close"
    btnClose.Common.SetRect 110, 80, 80, 22
    btnClose.Cancel = True
    btnClose.ModalResult = 2

    oForm.showModal
End Sub

Sub rdbTest1_OnClick(oItem)
    SDB.ProcessMessages
End Sub

Sub rdbTest2_OnClick(oItem)
    Dim i

    For i = 0 To 100000
        SDB.ProcessMessages
    Next
End Sub

Sub chkTest_OnClick(oItem)
    Dim i

    For i = 0 To 100000
        SDB.ProcessMessages
    Next
End Sub
Additional Informationhttp://www.mediamonkey.com/forum/viewtopic.php?f=6&t=41807
TagsNo tags attached.
Fixed in build

Activities

There are no notes attached to this issue.