Silverfrost Forums

Welcome to our forums

How to scroll to end of string in edit box automatically?

5 May 2011 8:10 #8181

While both of you were replying, I was editing my post to show the version of Plato and the actual code I ran. This forum took out my spaces, but in fact there are six spaces before every line except the two continuation lines, which have five spaces in front of each.

I was able to find the version of Plato (Version 4.10), as you see. How do I find the version of Fortran?

I started using Silverfrost Fortran several years ago, and have never manually updated it. Does any updating happen automatically? I note that the Plato banner shows a date of 2011, though I have never done any updating in several years.

5 May 2011 8:16 #8182

Perhaps I should simply go to the website, find out how to do updates, and update manually to see if anything changes. Sound like a plan?

5 May 2011 8:18 #8183

Hi Little-Acorn, just now I tested the following code in Fortran 95 without any leading blanks:

WINAPP 
OPTIONS(INTL) 

PROGRAM TEST 

IMPLICIT NONE 
INCLUDE <WINDOWS.INS> 

integer*4      j,handle 

handle = -1 

j = winio@('%lw%ww[no_border]%sy[3d_thin]%fn[ARIAL]%ts%120.40cw[local_font]',handle,1.D0,6) 
write(6,'(A)')'hello' 

call sleep@(3.) 
write(6,'(A)')'... back again after some work' 

call sleep@(3.) 
write(6,'(A)')'window will be closed soon' 

call sleep@(3.) 
handle = 0 
call window_update@(handle) 

end

Neither the compiler nor the other parts of the development environment are updated automatically. As far as I can see, my version is 5.50.

Regards - Wilfried

5 May 2011 8:44 #8184

I just updated my Fortran Personal Edition. Now the Plato banner says that Plato is at version 4.40 (an hour ago it was at 4.10).

And your test program now works! The contents of the window are in ARIAL font, and not boldfaced!

Thank you Wilfried and Eddie! I deeply appreciate all your help.

....

Now back to my main program, with the status window. Even after this update, the status window still contains text that remains stubbornly in System font.

The code that sets it up is: [color=blue:5c32760482] CALL set_default_proportional_font@() IStatWinHandle=create_window@('Status',70,720,700,240) CALL OPEN_TO_WINDOW@(6,IStatWinHandle) [/color:5c32760482] And later I write to it with a statement like: [color=blue:5c32760482] .... CALL WRITSTAT('What font will this text be in?') ..... SUBROUTINE WRITSTAT(newstat) include <windows.ins> CHARACTER*(*) newstat WRITE(6,'(A)') newstat RETURN END [/color:5c32760482] I can dig in and start trying new ways to get this to produce Arial font too. But can you give me any tips off the top of your head?

BTW, what does that [color=blue:5c32760482]'(A)'[/color:5c32760482] mean in the WRITE statement?

6 May 2011 4:48 #8185

????

Forget our first idea using open_to_window@ and take the code with %cw[local_font]!

'(A)' means character string, equivalent to * for numerical values.

6 May 2011 11:48 #8186

Hi Little Acorn,

I forget when it was changed, probably when Fortran-77 came out, but it stopped being necessary to have a format statement unless you really wanted one. So, you can slip the formatting information into the WRITE statement, keep it in a numbered FORMAT statement, or use 'unformatted' output. Slipping it into the WRITE statement means putting the formatting information in as a character constant, or variable. Hence, you could equally well write:

      WRITE (6, 100) I, A, CHAR
 100  FORMAT(I3, F10.2, A5)

or

      WRITE (6, '(I3, F10.2, A5)') I, A, CHAR

or

      WRITE (6, *) I, A, CHAR

although the last of these three will be laid out as FTN95 sees fit. I've assumed that CHAR is CHARACTER*(5), and simply A would have been enough.

To get your code fragments laid out nicely in the forum, highlight them and click the 'code' button. (You could precede your code with the word code in square brackets and follow it with \code in square brackets, but that is more work). You can do bold, italic, underline etc through this method.

FTN95 installs a program called the Salford Diagnostic Tool. If you run this, it finds all the installed copies of particular programs, and more importantly, reports their version numbers. I recommend looking at the page on the Silverfrost website where it reports upgrades and bug fixes to see how things are coming along.

Eddie

15 Nov 2011 12:38 #9220

Quoted from Little-Acorn

Quoted from Wilfried Linder Hi, here is just an alternative but very easy way for what you want to do - I use this method in several applications:

handle = create_window@('Info',100,100,700,500)
call open_to_window@(6,handle)
.
.
.
write(6,'(A)')'message text'
.
.
.
call destroy_window@(handle)  ! at the end of the programme

Regards - Wilfried

Aw, that's SO sweet.... does everything I've been trying to do for months with that window.

Text in this window comes out in System font. Is there a way to make it Arial font? I tried [color=blue:c3d1dff5d6] i=winio@('%fn[Arial]&') [/color:c3d1dff5d6] followed later by [color=blue:c3d1dff5d6] i=winio@('%sf&') [/color:c3d1dff5d6] ....but no luck, it's still in System font. I tried this both before and after the 'create_window@ - open_to_window@' group, and also before and after the actual WRITE statement. Neither changed the font successfully.

But boy, is it nice to have a workable Status window! Thank you!

I've been using this method to implement a Status box for several months now, and it has worked beautifully.

Except in the last few weeks, it has suddenly stopped working.

Recently I've added some %lw and %ww statements, which have been working fine to do what I wanted in the appropriate areas. But before long, I started to notice that my nice status box, doesn't seem to be around any more. To my knowledge, I haven't changed the statements that create, or write to, the status box.

Is there something magical about the %lw and/or %ww statements, that have some effect on the

'handle = create_window@('Info',100,100,700,500)' and 'call open_to_window@(6,handle)' and 'write(6,'(A)')'message text''

statements?

17 Nov 2011 8:15 #9241

I don't think that magic is the reason. I suggest that you should try a very simple example (take my first one - previous page, 2nd post). If even this doesn't work anymore, then try to remember what is changed on your PC since then: Hardware, operating system, FTN95 version?

Good luck...

17 Nov 2011 2:01 #9242

My guess is that you re-used or over-wrote the handle. This is always a peril if it is not uniquely named, i.e. 'handle' is not a good name. If you called it, for example, iHandle_for_Status_Box, then you aren't likely to use that for anything else. Also, keep it in COMMON (or use MODULES) to make sure that it doesn't disappear when exiting a subprogram in which it is defined.

Fortran's rules on type are such that handle might not be of integer type when it should be, and (just guessing here!) it hasn't mattered up till now. That's my second guess.

My third guess is that you used logical unit 6 for something else, perhaps redefining it in some way. Again, as Fortran used to very commonly have 6 for output to a printer, this could crop up in old code, or you could have programmed it by force of old habit. You wouldn't mix them up if you used a name like Logical_Unit_for_Status_Box and set this to maybe 199!

While FTN95 sometimes appears to operate by magic, this is only an application of Arthur C. Clarke's Third Law: 'Any sufficiently advanced technology is indistinguishable from magic'!

Eddie

22 Nov 2011 6:06 #9258

Eddie and Wilfried, it is indeed possible that I may have overwritten the handle. But while looking, I finally figured out (to my surprise) a way to make the edit box (%eb) Work as I had wanted, scrolling to the end of the filled part of the buffer!

So now I have stopped using File 6 as a default status box, since the %eb lets me use proportional fints, and even edit facilities.

Thank you for your help in this long chase, though... it has finally reached an exemplary conclusion!

24 Nov 2011 6:24 #9284

It may not be what you want, but I simply use 'write (,) message' This provides me with an OUTPUT window which provides all the messaging info I need. You can drag it to a second screen and watch what you need. It is probably a lazy approach but can work easily. You can also control the maximim buffer size for OUTPUT if necessary.

John

Please login to reply.