Menu: Difference between revisions
Content added Content deleted
mNo edit summary |
(Initial FutureBasic task solution added) |
||
Line 1,316: | Line 1,316: | ||
print menu_select( menu() )</syntaxhighlight> |
print menu_select( menu() )</syntaxhighlight> |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
_window = 1 |
|||
begin enum 1 |
|||
_response |
|||
_popupBtn |
|||
end enum |
|||
void local fn BuildPopUpMenu |
|||
menu 101 |
|||
menu 101, 0,, @"Select numbered menu item from the Three Pigs" |
|||
menu 101, 1,, @"1. fee fie" |
|||
menu 101, 2,, @"2. huff and puff" |
|||
menu 101, 3,, @"3. mirror mirror" |
|||
menu 101, 4,, @"4. tick tock" |
|||
menu 101, 5,, @" ?????????" |
|||
end fn |
|||
void local fn BuildWindow |
|||
CGRect r = fn CGRectMake( 0, 0, 480, 360 ) |
|||
window _window, @"Rosetta Code Menu Task", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable |
|||
r = fn CGRectMake( 45, 240, 380, 34 ) |
|||
textlabel _response,, r, _window |
|||
ControlSetAlignment( _response, NSTextAlignmentCenter ) |
|||
r = fn CGRectMake( 65, 200, 340, 34 ) |
|||
popupbutton _popupBtn,,,, r, YES |
|||
PopUpButtonSetMenu( _popupBtn, 101 ) |
|||
end fn |
|||
void local fn DoMenu( menuID as long, itemID as long ) |
|||
select (menuID) |
|||
select (ItemID) |
|||
case 1 : ControlSetStringValue( _response, @"1. Sorry, wrong: From Jack the Giant Killer." ) |
|||
case 2 : ControlSetStringValue( _response, @"2. CORRECT!: From The Three Little Pigs." ) |
|||
case 3 : ControlSetStringValue( _response, @"3. Sorry, wrong: From Snow White and the Seven Dwarfs." ) |
|||
case 4 : ControlSetStringValue( _response, @"4. Sorry, wrong: From Tick Tock Goes the Clock Rhyme." ) |
|||
case 5 : ControlSetStringValue( _response, @"Surely you could just make a guess! Try again." ) |
|||
end select |
|||
end select |
|||
end fn |
|||
fn BuildPopUpMenu |
|||
fn BuildWindow |
|||
on menu fn DoMenu |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
[[file:Rosetta_Code_FutureBasic_Menu_Task.png]] |
|||
=={{header|Gambas}}== |
=={{header|Gambas}}== |