Code archives/User Input/Question$()
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
This allows you to have an input style command that you can place at any screen coords. also the typed response may be placed at any coords. | |||||
; ***************************************** ; * Question Function * By Nick Stacey * ; ***************************************** ; ; A more versatile version of the input command ; ; ;Format a$=Question(r,g,b,x,y,question,minlength,maxlength,r2,g2,b2,x2,y2) ; where rgb,x&y are colour and coords of question ; and r2,b2,g2,x2 & y2 are color and coords of typed response ; minlength and maxlength are then minimum/maximum length of returned string ; optional format of ; a$=Question(r,g,b,x,y,question$,0,0,0,0,0,0,0) ; which means the function will behave more like a normal input and typed ; response will appear straight after question. ; ; Feel free to use and/or modify this code as much as required ; Function Question$(r,g,b,x,y,question$,minlength,maxlength,r2,g2,b2,x2,y2) Frontbuff = FrontBuffer() : setbb =0 If GraphicsBuffer() <>FrontBuff Then SetBuffer FrontBuffer():setbb=1 oldr=ColorRed() :oldg=ColorGreen():oldb=ColorBlue() GetColor -1,-1 br= ColorRed(): bg=ColorGreen(): bb=ColorBlue() Color br,bg,bb : l=Len(question$) Rect x,y,(FontWidth()*l),FontHeight(),1 Color r,g,b Text x,y,question$ value = 0 : a$="" If r2=0 And b2=0 And g2=0 And x2=0 And y2=0 Then r2=r:g2=g:b2=b:y2=y: x2=x+(FontWidth()*Len(question$)) EndIf Color r2,g2,b2 l=Len(a$) While (Not KeyHit(28)) Or l |
Comments
None.
Code Archives Forum