Keyboard input/Obtain a Y or N response: Difference between revisions

No edit summary
Line 920:
 
=={{header|FutureBasic}}==
<lang futurebasic>void local fn DoDialog( ev as long )
CFStringRef key
local fn DoDialog
dim as long ev, id
select case( ev )
case _windowKeyDown
cls
key = fn EventCharacters
select id( key )
case @"Y", @"y",@"N",@"n"
printf @"You pressed the \"%@\" key",key
DialogEventSetBool(YES)// we handled the event
end select
end select
end fn
 
subclass
ev = dialog(0)
window 1, @"Press \"Y\" or \"N\" keys", (0,0,550,400)
id = dialog(ev)
 
select case( ev )
case _wndClose : end
case _evKey
select id
// Trap upper and lower case Y and N
case 78, 110 : cls : print "No "
case 89, 121 : cls : print "Yes"
end select
end select
end fn
 
on dialog fn DoDialog
 
HandleEvents</lang>
window 1, @"Yes-No", (0,0)-(150,80), _docNoGrow
text _applFont, 14, _boldBit%
 
RunApplicationEventLoop()
</lang>
 
=={{header|GlovePIE}}==
416

edits