to add some behaviour to the original NSButton class I thought subclassing would be a could idea. So I come up with UKButton.NSButton with the following code:
- Code: Select all
Private Dim myDuration As Integer
Public Sub setTimer(theDuration As Integer)
myDuration = theDuration
Alert("What to do?")
Log("setTimer")
Log(myDuration)
End Sub
Public Function getTimer() As Integer
Log("GetTimer")
Log(myDuration)
Return myDuration
End Function
Now I have two method accessible from the outside and try to use them within my windows class UKWindow.NSWindow which is derived from NSWindow.
- Code: Select all
IBOutlet myButton As UKButton
Event Init()
Alert("UKWindow init")
End Event
IBAction ukButtonPressed(sender As id)
Alert("Button Pressed!")
myButton.setTimer(30)
End IBAction
The code compiles and runs without throwing an exception. But the UKButton methods are not activated although the invocation pretends to work.
I attach the project for you to see the connection between UI and code. The button in question is the lower one. The other one changes color when pressed and plays a submarine ping sound (attributes set via IB).
Kind regards
Udo
BTW: Is there an UI monitor that shows messages flowing between UI elements?