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 

Handling of I/O-Window
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
FK_GER



Joined: 26 Oct 2017
Posts: 35
Location: University of Kassel,Germany

PostPosted: Sat Dec 02, 2017 5:45 pm    Post subject: Handling of I/O-Window Reply with quote

To handle my I/O-window I need some more informations:
- get the width of the used font (the heigth is get over clearwin_info@('system_font_height') and why not the width in the same way??)
- get and set the cursor position
- possibility to scroll the text, so that the cursor remains approximately at the middle of the I/O-window, independent from input and output.
Has anybody proposals or results?

Here my test-program:
WINAPP
PROGRAM EA_FENSTER
INCLUDE <windows.ins>
INTEGER win,xsize,ysize,xpos,ypos,xscreen,yscreen,font_h,font_w
INTEGER rand_o,rand_l
INTEGER KRW
CHARACTER*40 NAMEFS /'KIPEIN Eingabe-Ausgabe-Kontrollfenster '/
KRW=5
leiste_u=16
rand_o=5
rand_l=5
NROW = 81
xscreen=clearwin_info@('screen_width')
yscreen=clearwin_info@('screen_depth')
font_h=clearwin_info@('system_font_height')
font_w=font_h*6/10
xsize=NROW*font_w
ysize=yscreen-(2*leiste_u+rand_o)
xpos=xscreen-xsize-rand_l
ypos=rand_o
LINES=ysize/font_h
win=create_window@(NAMEFS,xpos,ypos,xsize,ysize)
CALL set_default_window@(win)
CALL open_to_window@(KRW,win)
WRITE(KRW,'("xscreen=",I10)')xscreen
WRITE(KRW,'("yscreen=",I10)')yscreen
WRITE(KRW,'("xsize=",I10)')xsize
WRITE(KRW,'("ysize=",I10)')ysize
WRITE(KRW,'("xposi=",I10)')xpos
WRITE(KRW,'("yposi=",I10)')ypos
WRITE(KRW,'("fonth=",I10)')font_h
WRITE(KRW,'("fontw=",I10)')font_w
WRITE(KRW,'("LINES=",I10)')LINES
WRITE(KRW,'(8("1234567890"))')
END
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Dec 02, 2017 7:15 pm    Post subject: Reply with quote

Routines like create_window@ and set_default_window@ date back to the early days of ClearWin before ClearWin+ (the + relates to winio@ and everything that goes with it).

You should avoid writing new code based on these routines.

Have a look at winio@. If you can't work out how to use it then report back with an outline of what you want to do.

You can get a equivalent result to your code by using %cw in a call to winio@ but this may not be the simplest way to get what you want.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Sat Dec 02, 2017 10:18 pm    Post subject: Reply with quote

I suggest you read the confusingly-named 'ClearWin windows' under the section 'ClearWin+' in FTN95.CHM.

A year or so ago there was an extensive discussion around these, setting fonts in text windows, etc.

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



Joined: 26 Oct 2017
Posts: 35
Location: University of Kassel,Germany

PostPosted: Mon Dec 04, 2017 5:44 pm    Post subject: Reply with quote

At first it will be helpfull to tell a little bit about my fortran knowledge. I have efficient know-how in Fortran4, but more or less few in F77 and F90, and I'm not versed in FTN95.
During my active job at the University I have developed several fortran-programs, which are very helpfull to calculate special problems in the field of constuction engineering. I have migrated the programs from the punchcards to VAX-Systems at first and to Windows-PCs later on. In this process the I/O was changed to the windows procedure and upgraded with a graphic part to visualize the results. For this purpose I have used fortran compilers from DEQ, Watcom, HP and at least Compaq. The operating systems are Win98, W2k, NT and XP. Unfortunately the Compaq compiler is not available for Win7 and the subsequent operating systems.
Because these programs are still used until today from students and civil engineers (at present with a virtual XP-System at Win7 or Win8), it is necessary to migrate the program system to a newer operating system, e.g. WIN7 at first.
In the Compaq-Manual some paradigm are given, how to manage the windows on the screen. I only have modified these examples for my purposes. Dependent on the dimensions of the screen, which were asked with a special F90-fortran function (called 'initialsettings') from the operation system, a frame-window is opened at first. In this frame-window the scrollable I/O-window is placed, which fits exactly into the inner border of the frame. In doing so the full heigth of the screen is used, and the width is restricted to 80 visible characters. This is the standard for all my programs.
For those programs with graphic output the frame-window is widened for two I/O-windows, on the right the text, on the left the diagrams. One special-program uses for the graphic the Compaq 'Array Viewer', which creates own windows directly besides the text-window.
This is a general survey what to do. I hope that I get assistance from you.[/b]
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Dec 05, 2017 6:29 am    Post subject: Reply with quote

Can you post pictures from your screen (via Postimage etc)? This will fill more reality into the words.
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Tue Dec 05, 2017 12:22 pm    Post subject: Reply with quote

I have a feeling that you are trying to create a text-only interface for your programs in Windows, and frankly, not only is that rather difficult, it also impairs the rapid learning curve that many Windows users experience if software conforms to the user experience they are familiar with.

If you want to get on a plane to London Heathrow and spend the day with me, then I'd willingly offer the time to explain using Clearwin+ to create a proper Windows graphical user interface. I see that flights from Germany are only around €100 return.

Teaching yourself Clearwin+ takes time, and the documentation is not a self-instruction text. When someone shows you how simple it is, it shortens the learning process.

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



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Tue Dec 05, 2017 2:40 pm    Post subject: Re: Reply with quote

FK_GER wrote:
Unfortunately the Compaq compiler is not available for Win7 and the subsequent operating systems.

That is only half true. You can install from the CVF CD if you run the 32-bit Setup.exe. Alternatively, you can move a Compaq Visual Fortran installation to Win7, Win8 or Win10 and get it working there, provided you have a working installation of CVF on Windows XP. I have CVF working fine on Win10-64.

For your situation, I think that converting all your applications from QuickWin to ClearWin++ is going to be a bigger hurdle than using FTN95 instead of CVF. If that is the case, it would be most useful to have both CVF6.6 and FTN95 working on your present computer, so that you can do the graphics conversion at your own comfortable pace.
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Tue Dec 05, 2017 2:40 pm    Post subject: Re: Reply with quote

FK_GER wrote:
Unfortunately the Compaq compiler is not available for Win7 and the subsequent operating systems.

That is only half true. You can install from the CVF CD if you run the 32-bit Setup.exe. Alternatively, you can move a Compaq Visual Fortran installation to Win7, Win8 or Win10 and get it working there, provided you have a working installation of CVF on Windows XP. I have CVF working fine on Win10-64.

For your situation, I think that converting all your applications from QuickWin to ClearWin++ is going to be a bigger hurdle than using FTN95 instead of CVF. If that is the case, it would be most useful to have both CVF6.6 and FTN95 working on your present computer, so that you can do the graphics conversion at your own comfortable pace.

If you decide to stay with QuickWin graphics, it is worth considering using a current Intel compiler (compiler runs only on 64-bit Windows, but can produce 32-bit objects).
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Wed Dec 06, 2017 4:25 pm    Post subject: Reply with quote

Quote:
That is only half true.


it's not true at all is it if you can install from 32 bit setup.exe ?
Back to top
View user's profile Send private message
FK_GER



Joined: 26 Oct 2017
Posts: 35
Location: University of Kassel,Germany

PostPosted: Tue Jan 23, 2018 4:40 pm    Post subject: Reply with quote

Hello, here I'm again.
Here some remarks to your replies of my described problems. Since our last contact I've studied "clearwin+" to get an overview how to manage the text-windows and the graphics needed for my purpose.

At the calculation part of my programs the I/O in the text-windows is running with some small restrictions with these 'calls':.

C Controlwindow for Input-Output-Text of program
CALL INISET(0) !!calculates data for position and size of window
win=create_window@(NAMEFS,xpos,ypos,xsize,ysize)
CALL set_max_lines@(win,1000)
CALL set_default_window@(win)
CALL open_to_window@(KRW,win)

Sorry, if I'm using out-dated routines, but these are running without any problems. The program are able to open an input-data-file and read from it, to open an output-data-file and write the results on it and intermediate results are shown as text-lines in the window.
I've tried to transfer the preceeding 'calls' into %xx-expressions, but I'm failed. I've done the following:

ans=winio@("%ca['Name of Controlwindow with 40 characters']&")
ans=winio@("%sp&",xpos,ypos)
ans=winio@("%sz&",xsize,ysize)
ans=winio@("%ww[topmost]")
ans=winio@('%lw[owned]',ctrl)
ans=winio@('%hw',krw) !! return handle for current window

In fact the window is opened, but the program are not able to write into it. The following error appears:
Run-time Error
*** Error 94, Unit has neither been OPENed nor preconnected

In the manual FTN95.CHM (sorry,I have no better possibilty) I find no %xx-term to open a file. At this point I need help!


In the meantime I've created some screenshots to show the process of the running XP-programs. These are saved as several jpg-files (size 250-650KB). But I don't know how to post them to the forum. Please tell what's to do.

Now to the subject of debate 'CVF with WIN7 or WIN10':
It's not my aim to port CVF on WIN7. My PC is configured with 3 physical storage units, on which are installed a XP-System, a WIN7-System and a WIN10-System. At boot-process I can choose the suitable system.

My current work is learning to generate plots with SIMPLEPLOT like shown in FTN95.CHM. I retrace the shown samples to get an entry into the matter. My problems, which will be arise surely, will be another post in the future.

Actually I wanted to show you the code of the subroutine INISET above. But there is no place enough, the code will be truncated. If you are interested, I could do that in another post.
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Wed Jan 24, 2018 10:56 am    Post subject: Reply with quote

Some observations on what you are doing.
1. If you use the routines from the early days of Clearwin, then they were (probably) invented to transfer a text mode DOS/mainframe application into a Windows context, and if that is all you want to do, they (probably) still work.
2. Proper Windows applications include menus, toolbars, a proper graphics interface etc., so only go there if you want to do the programming necessary.
3. %sp allows you to position a window anywhere on the screen. If it is omitted, CW+ puts it in the centre of the screen. Use %sp if you want to explicitly put the window in a particular place - for example, when you want it to pop up next to a particular control, or where you last moved it to. In any case, if the window appears centre screen it can always be moved by the mouse if it has a caption bar.
3. Setting a window to a particular size may over-constrain CW+, which likes to lay out your controls according to its own rules and end up with an appropriately sized window in which everything fits.
4. %ww[topmost] is redundant, because the last window created is always on top to begin with. topmost makes it stay on top.
5. CW+ doesn't usually open files, as that is the responsibility of Fortran. CW+ allows you to select file names that you can use in OPEN statements. There are two routes to this:
(a) through a subroutine call such as GET_FILTERED_FILE@
(b) through a CW+ format code with a standard callback such as 'FILE_OPENR' (see in the list of 'Standard callback functions'.

As an example of using GET_FILTERED_FILE@, examine the following routine:
Code:

      INTEGER FUNCTION OPEN_FN()
C     --------------------------
      CHARACTER*(256) SEEP_FILE,
     &                SEEP_PATH,
     &                SEEP_RES,
     &                SEEP_AXD,
     &                SEEP_SVG
      CHARACTER*(20)  SEEP_FILTERS(4),
     &                SEEP_SPECS(4)
      COMMON /SVGFIL/ SEEP_SVG
      COMMON / MENU_GREY/ iGREY(10,10)
      INCLUDE <WINDOWS.INS>
      SEEP_PATH = 'C:\SEEPAGE\'
      SEEP_FILE = '*.*'
      SEEP_FILTERS(1) = '*.DAT'
      SEEP_SPECS(1)   = 'DATA FILES'
      SEEP_FILTERS(2) = '*.*'
      SEEP_SPECS(2)   = 'ALL FILES'
      CALL GET_FILTERED_FILE@ ('Open Seepage file', SEEP_FILE, 
     &     SEEP_PATH, SEEP_FILTERS, SEEP_SPECS, 2,1)
       OPEN(20,FORM='UNFORMATTED')
       OPEN(30,FORM='UNFORMATTED')
       OPEN(40,FORM='UNFORMATTED')
       OPEN(50,FILE=SEEP_FILE,STATUS='OLD')
       NL = LEN_TRIM (SEEP_FILE)
       SEEP_RES = SEEP_FILE(1:NL-4)//'.RES'
       SEEP_AXD = SEEP_FILE(1:NL-4)//'.AXD'
       SEEP_SVG = SEEP_FILE(1:NL-4)//'.SVG'
       OPEN(60,FILE=SEEP_RES,STATUS='UNKNOWN')
       OPEN(19,FILE=SEEP_AXD,STATUS='UNKNOWN')
      CALL ANALYSE
      CALL SCALE
      CALL DRAW
      iGREY(2,1) = 1                                ! The PLOT menu grey
      OPEN_FN = 2
      END


Last edited by LitusSaxonicum on Wed Jan 24, 2018 4:00 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: Wed Jan 24, 2018 11:12 am    Post subject: Reply with quote

In this case, where I am converting a DOS/mainframe file to a Windows application, File units 20,30 and 40 are 'scratch files', 50 and 60 are input and output (were 2,3,4, 5 and 6 originally). Also, the SVG file is only opened if necessary, so its name is remembered until later.

The analysis runs (CALL ANALYSE) when the file is opened, then scaled to fit the screen (CALL SCALE) and then a standard drawing of the results is produced (CALL DRAW).

The INTEGER FUNCTION OPEN_FN() is a callback from a program that contains (as well as a lot of other stuff):

Code:
      IA = WINIO@ ('%ca[FE Isoparametric elements]&')
      IA = WINIO@ ('%mn[File[Open,|,Exit]]&',      Open_FN,     'EXIT')
      IA = WINIO@ ('%mn[Options]&',     OPTIONS_FN)
      IA = WINIO@ ('%mn[Help[About]]&', ABOUT_FN)
      IA = WINIO@ ('%gr[white]', IXRES, IYRES)


IXRES and IYRES are the dimensions of the graphics area in which the picture will be drawn (fixed at this point in development to a convenient 1200x800). OPTIONS_FN is another callback function with a window in which you select what else to draw, and ABOUT_FN is a callback that describes the program.

'EXIT' is a standard callback.

I'll spend some time on it and show you how to open a CW text window for Fortran output, but it may be a day or so.

The offer to meet you at London Heathrow and spend the day explaining Clearwin wasn't a joke.

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



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

PostPosted: Thu Jan 25, 2018 2:19 pm    Post subject: Reply with quote

... and as promised:

Code:
      IA=WINIO@( '%ca[Output in CW window]%2nl%pv'//
     &           '%70.40cw[vscroll,hscroll]%lw',
     &            99,   KONTROL)


      IA=WINIO@( '%ca[Output to text or graphics'//
     &           '%8^bt[Print Text] '//
     &           '%8^bt[Print Graphics]%lw',
     &           'PRINTER_OPEN', 99, PRINT_FN,
     &           'GPRINTER_OPEN',    DRAW_FN,
     &            KONTROL)


The first statement (with its continuations to make it clearer) opens a window containing a Clearwin window for Fortran output to logical unit number 99. Giving a pivot (%pv) makes the Clearwin window potentially resizable.

The Print text button in the second statement opens a printer for Fortran output via logical unit 99, and a callback (required because of the ^ qualifier on the button) that might do the output, and complete the task by closing unit 99 so that the printer ejects the last page. The Print graphics button opens a printer for graphical output, also invoking a callback that is available to use graphics primitives to draw something, and then using the appropriate command, finish drawing and eject the paper. Both PRINT_FN and DRAW_FN would need to be declared INTEGER and EXTERNAL.

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



Joined: 26 Oct 2017
Posts: 35
Location: University of Kassel,Germany

PostPosted: Thu Jan 25, 2018 2:26 pm    Post subject: Reply with quote

Thanks for the answer. I will study it and replay in the next days.
Because I've no experience with the forum-structure, still an answer: How an jpg-file (screenshot of an output) can be shown in the forum? This will be helpfull to demonstrate what kind of windows (plot + text) are buildt from my programs.
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Thu Jan 25, 2018 2:46 pm    Post subject: Reply with quote

The method of including an image is to find a photo or image repository website, put your image there, and include a link to it in the post in this forum.

Eddie
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 -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
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