Post by Nicky Peter Hollyoake on Jan 30, 2008 16:17:05 GMT -5
Ok, I made this input (which I made a function about it in the demo board). But I wanna add one more feature to it, I made it just a normal code (not in function).
I want it so when it reaches the end of the screen, you only see part of the text. EXAMPLE:
Now I know your gonna think if I can do it there I can do it with my other code, but it ain't as easy with a cursor (the cursor keeps messin' up on me).
Anyone show me how I would accomplish this? Would reallt help on the program i'm doing.
[glow=red,2,300]Nicky[/glow]
Dim Text$
Dim Cursor
Dim Key AS String
TextMode(TEXT_BUFFERED)
SetTextScroll(FALSE)
While TRUE: CLS
'Controls
if ScanKeyDown (VK_BACK) Then
'See if theres text, if so backspace 1 character, from where the "Cursor" varible is, then move the cursor back 1.
if Len(Text$) > 0 Then
Text$ = Left$(Text$, Cursor - 1) + Right$(Text$, Len(Text$) - Cursor)
Cursor = (Cursor - 1)
Endif
Clearkeys() 'Clear all keys been pressed
Elseif ScanKeyDown (VK_LEFT) Then
if Cursor > 0 Then
Cursor = (Cursor - 1)
Endif
Elseif ScanKeyDown (VK_RIGHT) Then
if Cursor < Len(Text$) Then
Cursor = (Cursor + 1)
Endif
Else
Key = Inkey$() 'Get key press
if Key <> "" AND ASC(Key) <> VK_RETURN AND ASC(Key) <> VK_ESCAPE AND ASC(Key) <> VK_BACK Then
Text$ = Left$(Text$, Cursor) + Key + Right$(Text$, Len(Text$) - Cursor)
Cursor = (Cursor + 1)
Endif
Endif
Locate 0, 0: Print Left$(Text$, Cursor) + "|" + Right$(Text$, Len(Text$) - Cursor)
DrawText()
Wend
I want it so when it reaches the end of the screen, you only see part of the text. EXAMPLE:
Dim Text$
TextMode(TEXT_BUFFERED)
While TRUE
if ScanKeyDown (VK_BACK) Then
Text$ = Left$(Text$, Len(Text$) - 1)
Clearkeys()
Else Text$ = Text$ + inkey$()
Endif
Locate 0, 0: Print Right$(Text$, 10)
DrawText()
Wend
Now I know your gonna think if I can do it there I can do it with my other code, but it ain't as easy with a cursor (the cursor keeps messin' up on me).
Anyone show me how I would accomplish this? Would reallt help on the program i'm doing.
[glow=red,2,300]Nicky[/glow]