_TITLE "inputBox$ tester.bas started 2018-10-26 need an input box for WS Editor" ' 2019-07-32 assimulate scnState(restoreTF) used to save and restore screen settings
' so sub can do it's thing and restore settings, Thanks Steve McNeill for starter code and idea.
COLOR &HFFFFFF00, &HFF880000 PRINT "Here is some stuff on screen." well$ = inputBox$("Well?", "Test inputBox$", 20)
PRINT "inputBox$ returned: "; well$;
". Is this line printing exactly below last stuff sentence?" ' OK now with center fix too! INPUT "OK? enter for next test, use h or m keypress to invoke inputBox$...", enter$
'draw stuff, until h or m press, then show message box
well$ = inputBox$("Well?", "Test call inputBox", 36)
PRINT "inputBox$() returned: *"; well$;
"*" 'kh = 0 'should not need this to stop esc keypress in input box
'_DISPLAY '<< should not need this
PRINT "OK where is this print line going to end up, hopefully under the last inputBox returned." 'yes! Excellent! PRINT "InputBox$() last returned: "; well$;
", Goodbye!"
' You can grab this box by title and drag it around screen for full viewing while answering prompt.
' Only one line allowed for prompt$
' boxWidth is 4 more than the allowed length of input, it needs to be longer than title$ and prompt$ also
' Utilities > Input Box > Input Box 1 tester v 2019-07-31
'colors
ForeColor = &HFF000055 '< change as desired prompt text color, back color or type in area
BackColor = &HFF6080CC '< change as desired used fore color in type in area
White = &HFFFFFFFF
'items to restore at exit
scnState 0
'screen snapshot
'moving box around on screen
'draw message box
bxW = boxWidth * 8: bxH = 7 * 16
COLOR ForeColor
, BackColor
'convert to pixels the top left corner of box at moment
bxW = boxWidth * 8: bxH = 5 * 16
tlx = (sw - bxW) / 2: tly = (sh - bxH) / 2
lastx = tlx: lasty = tly
'now allow user to move it around or just read it
IF mx
>= tlx
AND mx
<= tlx
+ bxW
AND my
>= tly
AND my
<= tly
+ 16 THEN 'mouse down on title bar grabx = mx - tlx: graby = my - tly
IF mx
- grabx
>= 0 AND mx
- grabx
<= sw
- bxW
AND my
- graby
>= 0 AND my
- graby
<= sh
- bxH
THEN 'attempt to speed up with less updates
IF ((lastx
- (mx
- grabx
)) ^ 2 + (lasty
- (my
- graby
)) ^ 2) ^ .5 > 10 THEN tlx = mx - grabx: tly = my - graby
lastx = tlx: lasty = tly
SELECT CASE kh&
'whew not much for the main event!
'put things back
scnState 1 'need fg and bg colors set to cls
CLS '? is this needed YES!! scnState 1 'because we have to call _display, we have to call this again
finishBox:
COLOR BackColor
, ForeColor
'from mBox v 2019-07-31 update
' for saving and restoring screen settins
COLOR DefaultColor
, BackGroundColor