Advertisement
tankcr

MM Form

Nov 8th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function OnStartup
  2.     {
  3.  
  4.         $SDB = New-Object -ComObject SongsDB.SDBApplication
  5.         $UI = New-Object -ComObject SongsDB.SDBUI
  6.         $SDBSCRIPT = New-Object -ComObject SongsDB.SDBScriptControl
  7.  
  8.       #Create the window to be shown
  9.       $Form = $UI.NewForm
  10.       $Form.FormPosition = 4
  11.       $Form.Caption = "Test Change labels"
  12.  
  13.       $Lbl2 = $UI.NewLabel($Form)
  14.       $Lbl2.Common.ControlName = "Lbl2"
  15.       $Lbl2.Common.SetRect(10, 10, 100, 16)
  16.       $Lbl2.Caption = "Change This Label"
  17.  
  18.       $SDB.Objects("MyLbl2") = $Lbl2
  19.  
  20.       $Btn2 = $UI.NewButton($Form)
  21.       $Btn2.Common.ControlName = "Btn2"
  22.       $Btn2.Common.SetRect(10,40,80,25)
  23.       $Btn2.Caption = "Test"
  24.       $SDBSCRIPT.Script.RegisterEvent = $Btn2.OnClick("Btn2Click")
  25.       $Form.ShowModal()
  26.  }
  27.  
  28.     Function Btn2Click
  29.       {
  30.       $label2 = $SDB.Objects("MyLbl2")
  31.       $label2.Caption = "Label Changed"
  32.        $SDB.MessageBox("Clicked Button",2,(4))
  33.       # add code to change Caption of Lbl2
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement