View Issue Details

IDProjectCategoryView StatusLast Update
0011441MMW v4Framework: Scripts/Extensionspublic2013-11-01 16:51
Reporterzvezdan Assigned To 
PrioritynoneSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0011441: ISDBUIDropDown::DeleteItem changes ItemIndex in skinned [MM3+]
DescriptionIf I set ItemIndex by script, after DeleteItem it will be changed to the last ItemIndex that was set manually. This didn't happen in MM2, nor it happens in non-skinned versions. Here is the test script:

Option Explicit

Dim cboTest

Sub OnStartUp()
    Dim oMenuItem

    Set oMenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    oMenuItem.Caption = "Dropdown.DeleteItem changes ItemIndex"
    oMenuItem.OnClickFunc = "Test"
    oMenuItem.UseScript = Script.ScriptPath
End Sub

Sub Test(oMenuItem)
    Dim oForm
    Dim btnClose
    Dim btnSet
    Dim i

    Set oForm = SDB.UI.NewForm
    oForm.Common.SetRect 100, 100, 337, 110
    oForm.BorderStyle = 3
    oForm.FormPosition = 4
    oForm.Caption = oMenuItem.Caption

    Set cboTest = SDB.UI.NewDropDown(oForm)
    cboTest.Common.SetRect 10, 10, 300, 21

    For i = 1 To 20
        cboTest.AddItem i
    Next
    cboTest.ItemIndex = 0

    Set btnSet = SDB.UI.NewButton(oForm)
    btnSet.Caption = SDB.Localize("&Delete")
    btnSet.Common.SetRect 90, 43, 77, 25
    Script.RegisterEvent btnSet, "OnClick", "btnSet_OnClick"

    Set btnClose = SDB.UI.NewButton(oForm)
    btnClose.Caption = SDB.Localize("&Close")
    btnClose.Common.SetRect 170, 43, 77, 25
    btnClose.Cancel = True
    btnClose.ModalResult = 2

    oForm.showModal
End Sub

Sub btnSet_OnClick()
    cboTest.ItemIndex = 0
    cboTest.DeleteItem cboTest.ItemCount - 1
End Sub
Steps To Reproduce- Copy script to Auto folder and restart the program;
- choose Edit \ Dropdown.DeleteItem changes ItemIndex;
- select some item in the list greater than 1, e.g. 5;
- click on the Delete button -> the previously selected row will stay selected.

- Start non-skinned version of the program;
- choose Edit \ Dropdown.DeleteItem changes ItemIndex;
- select some item in the list greater than 1, e.g. 5;
- click on the Delete button -> the first row will be selected as it should.
TagsNo tags attached.
Fixed in build

Activities

There are no notes attached to this issue.