INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Fortran text cursor control

Fortran text cursor control

(OP)
I've just set up Code::Blocks with gfortran on my PC (Win 8.1, 64-bit). I'm trying to write a routine to position the text cursor. I've tried several variations on:

! Locate does the Windows-API-related work of moving the text cursor.
Subroutine Locate(Row, Col) ! bind(C, name='SetConsoleCursorPosition')
    use iso_c_binding
    integer, INTENT(IN) :: Row			! On screen, 0-24.
    integer, INTENT(IN) :: Col			! On screen, 0-79.

    integer :: Coord                	! Composite value of row and column.
    integer :: HandleForConsole     	! From GetStdHandle routine.

    integer(c_long) :: GetStdHandle
    integer(c_long) :: SetConsoleCursorPosition

    Row = Row - 1                       ! Convert from Fortran 1-based
    Col = Col - 1                       ! numbering to C 0-based.

    Coord = 65536 * Row + Col       	! Jam both values into 1 integer.
    HandleForConsole = GetStdHandle(STD_OUTPUT_HANDLE)

    Call SetConsoleCursorPosition(HandleForConsole, Coord)    ! Go!
End Subroutine Locate 

Nothing works. The program runs, but the subroutine is ineffective. I could use any suggestions.

RE: Fortran text cursor control

Cursor addressing only works when the scrollbar is absent. Set the screen buffer size height equal to that of the window size height.

RE: Fortran text cursor control

(OP)
I'm sorry, I don't think I was clear. I was writing a console routine, not a Win/GUI program.

RE: Fortran text cursor control

i have a problem about fortran software. in
27 write(10,*)iter,xr,xl,xu,fxr*fxl.ea
output tell me about this
C:\Users\SUKENDRO\Documents\Courses\latihan_fortran\latihan_false_position\latihan_falsePosition.F95(27) : error 1069 - Terminating decimal point for binary operator token expected but not found
C:\Users\SUKENDRO\Documents\Courses\latihan_fortran\latihan_false_position\latihan_falsePosition.F95(27) : error 52 - Compilation abandoned

what is there any suggestion for me?

RE: Fortran text cursor control

(OP)
sukendro,

This thread is about problems with text cursor control in console windows.

But the compiler is complaining about the item "fxr*fxl.ea" in your output list. If fxl is a derived type, the subfield isolation operator is ' % ' in fortran, not ' . '.

RE: Fortran text cursor control

1. On the console window, right click on the top left C:\ icon
2. A menu will appear - select properties
3. Select the layout tab
4. There are 3 group boxes: Screen buffer size, window size and window position
5. Set the height figure in the screen buffer size to be the same as that of the height of the window size.
6. Click OK - notice that there is no scrollbar on the console window.
7. Now run your program and the cursor addressing should work.


RE: Fortran text cursor control

sukendro - If you have a problem, start another thread instead of hijacking this one.

RE: Fortran text cursor control

(OP)
I'll try it, xwb. Thank you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close