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 

Printing text in window

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
jcherw



Joined: 27 Sep 2018
Posts: 49
Location: Australia

PostPosted: Wed Apr 10, 2019 12:43 pm    Post subject: Printing text in window Reply with quote

I am writing a program which generates quite some logging info which I like to write into a dedicated window using a unit pointing to that window via

call OPEN_TO_WINDOW@(7,5)

The main program window is opened as a frame

iAns=winio@('%pv%fr&',1400L,800L)

And I have managed to open graphics windows and route graphics output into those windows, using the following code

! Open window for logging text
iHndLog = 5
iAns=winio@('%ca[Log output]%bg[grey]&')
ians=winio@('%pv%aw&',iCtrl)
ians=winio@('%`gr[white]', 800, 600, iHndLog)

Could someone please enlighten me how to open a text window which than can be written into via unit 7 using the above call OPEN_TO_WINDOW@(7,5)

Cheers,
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Apr 10, 2019 2:15 pm    Post subject: Reply with quote

You can use %cw.
Back to top
View user's profile Send private message
Wilfried Linder



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

PostPosted: Wed Apr 10, 2019 3:26 pm    Post subject: Reply with quote

... or:

Code:
integer*4  textwin

textwin = create_window@('Info',100,100,700,500)
call open_to_window@(7,textwin)
write(7,'(A)')' for example this message '
...
...
call destroy_window@(textwin)
Back to top
View user's profile Send private message
jcherw



Joined: 27 Sep 2018
Posts: 49
Location: Australia

PostPosted: Fri Apr 12, 2019 10:22 am    Post subject: Reply with quote

Thanks for these replies.

I tried %cw and got that to work.

I am relatively new to clearwin and sofar i have been using winio@ and the format codes following examples from the manual.

The function "create_window@" seems quite convenient. Can I use that function in conjunction with some winio@ calls to add further attributes to the created window?
Back to top
View user's profile Send private message
Wilfried Linder



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

PostPosted: Fri Apr 12, 2019 12:17 pm    Post subject: Reply with quote

There are two types of windows: “ClearWin” windows and “Format” windows. For more details about the first ones see here: https://www.silverfrost.com/ftn95-help/clearwinp/clearwin/introduction.aspx

I use ClearWin windows only for simple textual output. There are some functions available, see here: https://www.silverfrost.com/ftn95-help/clearwinp/overview/clearwinwindowfunctions.aspx

The huge amount of possibilities with winio@ can only be used with format windows, as far as I know.
Back to top
View user's profile Send private message
Wilfried Linder



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

PostPosted: Fri Apr 12, 2019 12:42 pm    Post subject: Reply with quote

For output of text you may also use winio@ together with functions and options for editing.

If you like, you can download a complete text editor using ClearWin from here: https://drive.google.com/file/d/1zP1B6Cyfz6ee4TexNNeTuxrbzU0jqhYG/view?usp=sharing

(Source code in FTN77 style, together with standard icons. Use the make.bat file for compiling and linking).
Back to top
View user's profile Send private message
jcherw



Joined: 27 Sep 2018
Posts: 49
Location: Australia

PostPosted: Sat Apr 13, 2019 3:35 am    Post subject: Reply with quote

Thanks for alla dvise.

I am opening window now with following statement:

iLarWin =
1 create_window@
1 ('PostProc - Timestep and saved arrays',120,120,700,500)
call open_to_window@(20,iLarWin)

and made the write and read statements all to/from unit 20

for the write statements all works fine, but for the read the program still opens a generic 'output' window

what am I missing?

Also, is there any way to make a clearwin window created with create_window@ a child window of another window?
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Sat Apr 13, 2019 6:45 pm    Post subject: Reply with quote

as mentioned in ..

https://silverfrost.com/ftn95-help/clearwinp/formats/_cw.aspx

"If a caption, etc. is required (for example to make the window movable) the %cw format should be embedded in a child window which is itself embedded in the main window."

So just use %cw in the format code of a seperately defined child window.
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Sun Apr 14, 2019 3:44 am    Post subject: Reply with quote

jcherw, here's an example.

It's based on the MDI example here:-
https://silverfrost.com/ftn95-help/clearwinp/d8attrib/attachwindow__aw.aspx
which creates a simple multi-pad editor.

Note that after copying-pasting the code from the manual the code didn't run ! I first I had to tweak the continuation card on the menus setup lines ... removing the + on the continuation card, replacing it with a & and also one on the previous line added.
(the example in the on-line manual is an F77 code but the leading spacing isn't all present. It was easier to change to a f95 code than to insert all the missing leading fixed-format spaces..

I've then simply added the definition of a new child window directly after the main window creation with the mods between the '!***' lines in 2 places as shown below .
Code:
! Program ftn95-MPE_Ex1-1b.f95

  WINAPP
  INTEGER ctrl,winio@
  EXTERNAL open_func
  CHARACTER*128 fname
  COMMON ctrl

!*** added variables for new CW window
   INTEGER fortran_unit
   INTEGER(7) cwhandle [/color]
!***

  fname='*.for'
  i=winio@('%ww[no_border]&')
  i=winio@('%mn[&File[&Open]]&',   &
&   'FILE_OPENR[Open]',fname,'+',open_func,'EDIT_FILE',fname)
  i=winio@('%mn[[E&xit]]&','EXIT')
  i=winio@('%pv%fr&',400L,300L)
  i=winio@('%lw',ctrl)

!*** SetUp of Clearwin Output Window within child window attached to main window 'ctrl'
fortran_unit=20
  i=winio@('%pv%aw&',ctrl)
  i=winio@('%`80.20cw[hscroll, vscroll]', fortran_unit, cwhandle)
write (20,*) 'THIS IS A TEST CLEARWIN Output Window within a child window'[/color]
!***

  END


  INTEGER FUNCTION open_func()
  COMMON ctrl
  INTEGER ctrl,winio@
  i=winio@('%pv%aw&',ctrl)
  i=winio@('%20.8eb[no_border]','*',0L)
  open_func=1
  END


The CLEARWIN output window size I chose is arbitrary and it shows that as sit is et up you have to first increase the main window size (by draging corners and/or sides) first so the scroll bars become visible.

There is still some work to do to set up the main window with scroll bars so that if you minimise the child windows they remain visible on the screen, but the example shows the concept.

It's a multi-document multi-child window setup and it should be noted that there were some issues previously reported with strange goings-on with reduced window icons locations etc....
Try it by playing around with resizing/reducing both main window and the internal child windows and you'll see what I mean.
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
jcherw



Joined: 27 Sep 2018
Posts: 49
Location: Australia

PostPosted: Tue Apr 16, 2019 6:23 am    Post subject: Reply with quote

Thanks John. Very clear example.

I noticed indeed the minimized icon issue. Just made MDI window fixed size for now.
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
Page 1 of 1

 
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