Interested in a training?
Contact us for a trainings and events or meet us at Real World in Orlando, Florida.
Contact us for a trainings and events or meet us at Real World in Orlando, Florida.
MBS Real Studio Plugin Tutorial Videos
NSColorPanel Source
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class
Class Window1
Inherits Window
// Controls
ControlInstance
Sub Action() Handles Event
panel=new MyColorPanel
panel.setContinuous true
panel.ColorValue=BackColor
panel.show
we=new MyWindowsEvents
we.ListenOnWindowsHandle panel.WindowHandle
t=new MyDragTracker
call t.AttachWindow self
r=new MyDragReceiver
call r.AttachWindow self
me.Enabled=false
panel.SetTitle "Please choose a color"
End Sub
End ControlInstance
ControlInstance
End ControlInstance
// Properties
Dim panel As MyColorPanel
Dim we As MyWindowsEvents
Dim t As MyDragTracker
Dim r As MyDragReceiver
End Class
Class MyColorPanel
Inherits NSColorPanelMBS
// Event implementations
Sub Changed()
window1.BackColor=me.ColorValue
window1.Refresh
window1.UpdateNow
End Sub
End Class
Class MyWindowsEvents
Inherits CarbonWindowsEventsMBS
// Event implementations
Sub WindowHidden()
window1.PushButton1.Enabled=true
End Sub
End Class
Class MyDragTracker
Inherits DragTrackerMBS
// Event implementations
Function Dragging(message as integer, drag as DragItemMBS) As boolean
dim r,g,b,a as single
if window1.panel.GetColorFromDrag(r,g,b,a) then
Return true // it is a color
end if
End Function
End Class
Class MyDragReceiver
Inherits DragReceiverMBS
// Event implementations
Function Received(drag as DragItemMBS) As boolean
dim r,g,b,a as single
if window1.panel.GetColorFromDrag(r,g,b,a) then
window1.StaticText1.TextColor=rgb(r*255,g*255,b*255)
Return true
else
beep
Return false
end if
End Function
End Class
Loading
Links
MBS REAL studio tutorial videos - Nachhilfe in Andernach