- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I'm letting the user display characters to a Quickwin child window with return = fputc(unit, character). How can I get the cursor to move back when user hits the BACKSPACE key?
I've tried using an escape sequnce return = fputc(unit, ""C)[] without success.
I've tried using an escape sequnce return = fputc(unit, ""C)[] without success.
- Marcas:
- Intel® Fortran Compiler
Link copiado
4 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Haven't used Quickwin but suspect sending a backspace character to a graphics window just adds an escape character symbol to your display, but will not delete the previous character as it would on a console.
You could trap the character (as you are apparently doing now) and rather than sending to the Quickwin window, call the appropriate routines to erase the previous row/column character and place the cursor back in that position, or send a delete key to the window.
James
You could trap the character (as you are apparently doing now) and rather than sending to the Quickwin window, call the appropriate routines to erase the previous row/column character and place the cursor back in that position, or send a delete key to the window.
James
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
James,
I've thought of testing character = getcharqq() for (ichar(character) == 8) to detect the user pressing the BACKSPACE key before sending the character to the fputc function. However, I'm not sure how to back the cursor up to the previous position. Any suggestions?
Thanks,
Richard
I've thought of testing character = getcharqq() for (ichar(character) == 8) to detect the user pressing the BACKSPACE key before sending the character to the fputc function. However, I'm not sure how to back the cursor up to the previous position. Any suggestions?
Thanks,
Richard
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Perhaps something like GETTEXTPOSITION, calculate previous character row/col position, SETTEXTPOSITION, output a space, SETTEXTPOSITION again.
James
James
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I have developed a solution along the lines that James suggests, and have used it successfully for several months. I also wanted to halt the program using ESC, so my function for reading in a string and returning with the string and its length (the function value) is:
Alan
function ReadVarStr(VarStr) ! Reads in string Varstr entered from the keyboard and returns length of VarStr as value of function. use dflib, only: FocusQQ, GetActiveQQ, GetCharQQ, GetTextPosition, OutText, & rccoord, SetActiveQQ, SetTextPosition character*(*), intent(inout) :: VarStr integer*4 acw, i, l, ReadVarStr character*1 key TYPE (rccoord) textpos acw = GetActiveQQ() i = SetActiveQQ(0) i = 1 do call GetTextPosition(textpos) key = GetCharQQ() l = ICHAR(key) if (l == 27) then ! ESC. STOP else if (l == 13) then ! Return. call SetTextPosition(textpos.row+1,1,textpos) EXIT else if (l == 8) then ! Backspace. if (i > 1) then i = i-1 VarStr(i:i) = ' ' call SetTextPosition(textpos.row,textpos.col-1,textpos) call OutText(' ') call SetTextPosition(textpos.row,textpos.col-1,textpos) end if else if (l < 32 .OR. l > 126) then CYCLE else call OutText(key) VarStr(i:i) = key i = i+1 end if end do ReadVarStr = i-1 acw = FocusQQ(acw) return end function ReadVarStr
Alan

Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora