FutureBasic Logo

<<    Index    >> FutureBasic

superview   statement



Syntax
superview <container view> tag, ...
...A widget list (buttons, textlabels, etc.) will be embedded in the superview defined by the superview keyword.
...The widgets become subviews of the superview.
...A superviewend keyword designates the end of the widget list to be embedded in the superview.
superviewend

Description
When the superview keyword appears immediately before a containerView statement, it marks that view as a superview, and the beginning of a superview...superviewend block. Any widget statements appearing inside the block are embedded in the superview. superview blocks can be nested. Supported superviews are currently box, visualeffectview and view

Example
superview box _soundsBox,, (213,-10,270,200)
button _backgroundMusicCheck,, NSControlStateValueOn, @"Background music", (18,138,134,18), NSButtonTypeSwitch
button _soundEffectsCheck,,, @"Sound effects", (18,104,107,18), NSButtonTypeSwitch
button _notificationsCheck,, NSControlStateValueOn, @"Notification sounds", (18,70,140,18), NSButtonTypeSwitch
textlabel _volumeLabel, @"Volume", (18,36,49,16)
slider _volumeSlider,, 50, (71,34,175,19)
superviewend


Without the superview and superviewend keywords, multiple ViewAddSubview statements are needed. For comparison, the following shows the ViewAddSubview (still valid) approach.

box _soundsBox,, (213,-10,270,200)

button _backgroundMusicCheck,, NSControlStateValueOn, @"Background music", (18,138,134,18), NSButtonTypeSwitch
ViewAddSubview( _soundsBox, _backgroundMusicCheck )

button _soundEffectsCheck,,, @"Sound effects", (18,104,107,18), NSButtonTypeSwitch
ViewAddSubview( _soundsBox, _soundEffectsCheck )

button _notificationsCheck,, NSControlStateValueOn, @"Notification sounds", (18,70,140,18), NSButtonTypeSwitch
ViewAddSubview( _soundsBox, _notificationsCheck )

textlabel _volumeLabel, @"Volume", (18,36,49,16)
ViewAddSubview( _soundsBox, _volumeLabel )

slider _volumeSlider,, 50, (71,34,175,19)
ViewAddSubview( _soundsBox, _volumeSlider )