Code: Select all
Option Explicit
Dim rdbTest1
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 rdbTest2
Dim chkTest
Dim btnClose
Dim i
Set oForm = SDB.UI.NewForm
oForm.Common.SetRect 100, 100, 300, 200
oForm.BorderStyle = 3
oForm.FormPosition = 4
oForm.Caption = "Zvezdan's Test"
Set rdbTest1 = SDB.UI.NewRadioButton(oForm)
rdbTest1.Common.SetRect 10, 10, 100, 21
rdbTest1.Caption = "Normal"
Script.RegisterEvent rdbTest1.Common, "OnClick", "rdbTest1_OnClick"
Set rdbTest2 = SDB.UI.NewRadioButton(oForm)
rdbTest2.Common.SetRect 10, 40, 100, 21
rdbTest2.Caption = "With ProcessMessages"
Script.RegisterEvent rdbTest2.Common, "OnClick", "rdbTest2_OnClick"
Set chkTest = SDB.UI.NewCheckBox(oForm)
chkTest.Common.SetRect 140, 40, 100, 21
chkTest.Caption = "With ProcessMessages"
Script.RegisterEvent chkTest.Common, "OnClick", "chkTest_OnClick"
Set btnClose = SDB.UI.NewButton(oForm)
btnClose.Caption = "Close"
btnClose.Common.SetRect 120, 120, 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 oSongIter
oItem.Common.Enabled = False
rdbTest1.Common.Enabled = False
Set oSongIter = SDB.Database.QuerySongs("ID > 0")
Do While Not oSongIter.EOF
oSongIter.Next
SDB.ProcessMessages
Loop
Set oSongIter = Nothing
oItem.Common.Enabled = True
rdbTest1.Common.Enabled = True
End Sub
Sub chkTest_OnClick(oItem)
Dim oSongIter
oItem.Common.Enabled = False
Set oSongIter = SDB.Database.QuerySongs("ID > 0")
Do While Not oSongIter.EOF
oSongIter.Next
SDB.ProcessMessages
Loop
Set oSongIter = Nothing
oItem.Common.Enabled = True
End Sub