View Issue Details

IDProjectCategoryView StatusLast Update
0011846MMW v4Framework: Scripts/Extensionspublic2014-02-08 12:10
ReporterBex Assigned To 
PrioritynoneSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformWindowsOS7OS Version-
Summary0011846: Focus lost when closing a form created from a DropDown control
DescriptionMM fails to set the focus correctly when closing a form that has been created by the DropDown event OnSelectFunc. Forms created by other events don't have this issue.
Steps To ReproducePut this script in the Auto folder. Right click in the main window, select "Open Form 1" and then "Open Form 2".

'-----------------------------------------------------------------
' MediaMonkey Script
'
' NAME: Focus Form Bug, open up from OnSelect event


Option Explicit

Sub OnStartup
  ' Add a menu entry to the Pop track menu in main window
  Dim Mnu : Set Mnu = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList, 1, 1)
  Mnu.Caption = "Open Form 1"
  Mnu.OnClickFunc = "OpenForm1"
  Mnu.UseScript=Script.ScriptPath
End Sub

Sub OpenForm1(Mnu)
  Dim Form,Btn,Drd
  Set Form = SDB.UI.NewForm
  Form.Common.SetRect 0,0,300,300
  Form.FormPosition = 4
  Form.BorderStyle = 3
  Form.Caption = "My Form"

  Call CreateBtn(Form,20,50,80,20,"Open Form 2","Button","OpenForm2","","")
  
  Set Drd = SDB.UI.NewDropDown(Form)
  Drd.Common.SetRect 110,50,150,20
  Drd.UseScript = Script.ScriptPath
  Drd.OnSelectFunc = "OpenForm2"
  Drd.Common.ControlName="DropDown"
  Drd.Style = 2
  Drd.AddItem("Select Open Form 2")
  Drd.AddItem("Open Form 2")
  Drd.ItemIndex=0
  
  Call CreateBtn(Form, 80,220,60,20,"OK","","",1,"Default")
  Call CreateBtn(Form,150,220,60,20,"Cancel","","",2,"Cancel")
  
  Form.ShowModal
End Sub

Sub OpenForm2(Ctrl)
  If Ctrl.Common.ControlName="Drd" Then
    If Ctrl.ItemIndex=0 Then Exit Sub
  End If
  Dim Form,Lbl
  Set Form = SDB.UI.NewForm
  Form.Common.SetRect 0,0,430,200
  Form.FormPosition = 4
  Form.BorderStyle = 3
  Form.Caption = "My Form"

  Set Lbl=SDB.UI.NewLabel(Form)
  Lbl.Common.SetRect 20,20,150,50
  Lbl.Autosize=True
  Lbl.Caption="Close this form (Opened from "& Ctrl.Common.ControlName &")"& vbNewline &_
              "- If Opened from Button. Focus is correctly set to the previous from."& vbNewline &_
              "- If Opened from DropDown. Focus is NOT set to the previous from."& vbNewline & vbNewline &_
              "Closing this and next form by pressing ESC twice, clearly demonstrates the bug."
  
  Call CreateBtn(Form,145,120,60,20,"OK","","",1,"Default")
  Call CreateBtn(Form,215,120,60,20,"Cancel","","",2,"Cancel")
  
  Form.ShowModal
End Sub

Function CreateBtn(Owner,X,Y,W,H,Caption,ControlName,OnClickFunc,ModalResult,DefaultCancel)
  Set CreateBtn=SDB.UI.NewButton(Owner)
  CreateBtn.Common.SetRect X,Y,W,H
  CreateBtn.Caption=Caption
  CreateBtn.Common.ControlName=ControlName
  CreateBtn.UseScript=Script.ScriptPath
  If OnClickFunc<>"" Then Script.RegisterEvent CreateBtn.Common, "OnClick", OnClickFunc
  If ModalResult<>"" Then CreateBtn.ModalResult=ModalResult
  If DefaultCancel<>"" Then
    If DefaultCancel="Default" Then CreateBtn.Default=True
    If DefaultCancel="Cancel" Then CreateBtn.Cancel =True
  End If
End Function
'---------------------------------------------------------------------
TagsNo tags attached.
Fixed in build

Activities

There are no notes attached to this issue.