Where's the Ncurses Cursor?

Post

Posted
Rating:
#1 (In Topic #199)
Avatar
Regular
stevedee is in the usergroup ‘Regular’
I'm just curious (so don't waste any time, unless you too are curious) about how to display a cursor on an gb.Ncurses window.

A simple program like this:-

Code (gambas)

  1. Public Sub Main()
  2.  
  3.     .Border = Border.ACS        
  4.     .CursorX = 1 + index
  5.     .CursorY = 1 + index
  6.     .Print("cursor x,y: " & .CursorX & ", " & .CursorY)
  7.   Screen.Cursor = Cursor.VeryVisible
  8.  

…proves that the cursor is moving, but there is no sign of the actual cursor.

Remembering that there may be a problem with 'lite' terminals, I also tested on xterm.

Thinking that the cursor may dissapear when the program completes, I tried again with this code:-

Code (gambas)

  1. Public Sub Main()
  2.  
  3.   For index = 0 To 10
  4.     With Window
  5.       .Border = Border.ACS        
  6.       .CursorX = 1 + index
  7.       .CursorY = 1 + index
  8.       .Print("cursor x,y: " & .CursorX & ", " & .CursorY)
  9.     End With
  10.     Screen.Cursor = Cursor.VeryVisible
  11.     Wait 1
  12.   Next
  13.  

…still no cursor within my window.

EDIT: I think the problem is that "Screen.Cursor" does not refer to the Ncurses cursor. I need to use Cursor in gb.ncurses.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
sjsepan is in the usergroup ‘Regular’
tried this also
cursor only appears on upper-left border corner
with Ask() i can see my input echoed there, but the PrintCenter() goes in the center (if i type one of the 'abc').

Code (gambas)

  1. ' Gambas module file
  2.  
  3. Public Sub Main()
  4.  
  5.     Dim sResponse As String
  6.  
  7.     ' With Window
  8.     Screen.Cursor = Cursor.VeryVisible
  9.     Screen.Resize(25, 80)
  10.     Window.Border = Border.ACS
  11.     For index = 0 To 3
  12.         ' Window.Border = Border.ACS
  13.         Window.CursorX = 1 + index
  14.         Window.CursorY = 1 + index
  15.         Window.Print("cursor x,y: " & Window.CursorX & ", " & Window.CursorY)
  16.         ' Screen.Cursor = Cursor.VeryVisible
  17.         Wait 0.1
  18.     Next
  19.     Window.Locate(Window.CursorX, Window.CursorY)
  20.     sResponse = Window.Ask("ABC", 2)
  21.     Window.PrintCenter(sResponse)
  22.     ' End With
  23.  
  24.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
sjsepan is in the usergroup ‘Regular’
OK, I also ran across the topic on your blog.
Captain Bodgit: Gambas cli programming: ncurses text based user interface
Its from a week later, so I'll have to see what else you came up with in that time…
Steve
Online now: No Back to the top
1 guest and 0 members have just viewed this.