forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to scroll to end of string in edit box automatically?
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Thu May 05, 2011 9:40 am    Post subject: Reply with quote

OK, please test the following:

Code:
WINAPP
OPTIONS(INTL)

PROGRAM TEST

IMPLICIT NONE
INCLUDE <WINDOWS.INS>

integer*4      j,handle

handle = -1

j = winio@('%lw%sy[3d_thin]%fn[ARIAL]%ts%120.40cw[local_font]',handle,1.5D0,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

"sleep" just simulates some work of the programme. May be that this is more like what you are looking for?

Regards - Wilfried
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Thu May 05, 2011 9:58 am    Post subject: Reply with quote

Sorry, I forgot two things:

(a) add %ww[no_border] after j = winio@('%lw
(b) set the text size to 1.D0

This looks better Wink
Regards - Wilfried
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Thu May 05, 2011 8:49 pm    Post subject: Reply with quote

Tried it.

I got a run-time exception saying "local_font is an invalid CLEARWIN option".

I then replaced the words local_font with the word vscroll . Now the program ran, a window came up, and the messages you put here, appeared one after the other every few seconds... but they were in System font, not Arial.

Hmmm....

BTW, I converted the program to fixed-format, and had to put in a continuation line in the longest statement. I don't believe the continuation line affected the program. Is it possible that going to fixed-format, did affect the program somehow?

I am also using Plato with Silverfrost FORTRAN. When I click on "Help" and then "About Plato", I get a small banner saying "Plato Version 4.10 - Copyright c Silverfrost Ltd 2011" across the top.

My version of this program:

WINAPP
OPTIONS(INTL)

PROGRAM TEST

IMPLICIT NONE
INCLUDE <WINDOWS.INS>

integer*4 j,handle

handle = -1

j = winio@
1('%lw%ww[no_border]%sy[3d_thin]%fn[ARIAL]%ts%120.40cw[local_font]'
2 ,handle,1.0D0,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


Last edited by Little-Acorn on Thu May 05, 2011 9:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu May 05, 2011 8:54 pm    Post subject: Reply with quote

Hi Little Acorn,

Then you had better tell us what version you are using: some of the updates to %cw are comparatively recent, and require the appropriate version of FTN95. This is less of a problem if you are using the Personal Edition than if you are the proud possessor of a licence: in the former case, updating to the latest version is free, in the latter, it isn't!

Eddie
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Thu May 05, 2011 9:01 pm    Post subject: Reply with quote

Hmmm... really funny. I've written and tested exactly that code today. Are you sure that you have an actual version of FTN95/ClearWin?
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Thu May 05, 2011 9:10 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Thu May 05, 2011 9:16 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Thu May 05, 2011 9:18 pm    Post subject: Reply with quote

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

Code:
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
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Thu May 05, 2011 9:44 pm    Post subject: Reply with quote

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:

CALL set_default_proportional_font@()
IStatWinHandle=create_window@('Status',70,720,700,240)
CALL OPEN_TO_WINDOW@(6,IStatWinHandle)

And later I write to it with a statement like:

....
CALL WRITSTAT("What font will this text be in?")
.....
SUBROUTINE WRITSTAT(newstat)
include <windows.ins>
CHARACTER*(*) newstat
WRITE(6,'(A)') newstat
RETURN
END

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 '(A)' mean in the WRITE statement?
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Fri May 06, 2011 5:48 am    Post subject: Reply with quote

????

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.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri May 06, 2011 12:48 pm    Post subject: Reply with quote

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:

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


or

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


or

Code:
      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
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Tue Nov 15, 2011 1:38 am    Post subject: Re: Reply with quote

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

Code:
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

i=winio@('%fn[Arial]&')

followed later by

i=winio@('%sf&')

....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?
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Thu Nov 17, 2011 9:15 am    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Nov 17, 2011 3:01 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Tue Nov 22, 2011 7:06 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group