Silverfrost Forums

Welcome to our forums

Printing text in window

10 Apr 2019 11:43 #23472

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,

10 Apr 2019 1:15 #23474

You can use %cw.

10 Apr 2019 2:26 #23476

... or:

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)
12 Apr 2019 9:22 #23487

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?

12 Apr 2019 11:17 #23488

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.

12 Apr 2019 11:42 #23489

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).

13 Apr 2019 2:35 #23491

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?

16 Apr 2019 5:23 #23503

Thanks John. Very clear example.

I noticed indeed the minimized icon issue. Just made MDI window fixed size for now.

Please login to reply.