Trouble with State Change
I'm trying to set up script code which will bring an object to the to of the Z-order upon pressing a hot key. Here's my code:
---------
'Called when the script is executed
Sub Object_OnScriptEnter
Set form=Desktopx.CreateForm
form.AddPreference("Hotkey")
form.Preference("Hotkey").Type="hotkey"
form.Preference("Hotkey").Caption="Hotkey:"
form.Preference("Hotkey").Value=h
If( form.Prompt ) Then
h=form.Preference("Hotkey").Value
MsgBox("Setting hotkey")
Object.RegisterHotkey 1, form.Preference("Hotkey").Value
End If
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
Object.UnregisterHotkey 1
End Sub
Sub Object_OnHotkey(id)
Object.State = Riseup
End Sub
Sub Object_OnStateChange(Riseup)
Object.OnTop
msgbox("Hit")
End Sub
------
The hot key works and I do get a message box which dispalys the word "Hit". But the object doesn't rise to the top. Any suggestions would be appreciated.
Thanks,
Tom S.