Silverfrost Forums

Welcome to our forums

Obtaining edit_info type for an edit box in gFortran 64 bit

16 May 2018 10:21 #22127

I am attempting to use ClearWin+ from gFortran to create an edit box and obtain a handle to the edit_info data for the box created. The edit_info parameter is not accepted by ClearWin+.

I have tried passing it in as an array of integer4,integer8 or an edit_info type. All of them yield the error below. Removing the ` grave element from the format string and the parameter creates the box fine but then I don't have access to the edit_info data.

PROGRAM main
use clrwin$
implicit none
integer(kind=CW_HANDLE) win
integer(kind=CW_HANDLE) winctrl
integer i
TYPE(edit_info) info
integer*4, dimension (48) :: info_int
EQUIVALENCE (info, info_int)

! Main window.
i=winio$('%ww[no_border]&')
i=winio$('%pv%fr&',400,300)
i=winio$('%lw&',winctrl)
i=winio$('%hw',win)

! Attach a sub window with an edit box.
i=winio$('%ww[no_border,no_maxbox]&')
i=winio$('%ca[Editor]&')
i=winio$('%aw&',winctrl)

! The following  does not work in gFortran 64 bit.
! It results in 'Argument number 4 of WINIO@ (continuation 3) should be an integer array'

! Create an edit box and retrieve a reference to the edit_info type for updating it later.
i=winio$('%pv%40.10`eb[read_only]','*',0,info_int)
! Replace the above with this line and it works.
i=winio$('%pv%40.10eb[read_only]','*',0)

call window_update$(info_int)

END
16 May 2018 11:22 #22128

Ryan

I think that I can see the fault in ClearWin+ but it don't have the means to test the fix at the moment. Here is a link to the new DLL for gFortran that you can try.

https://www.dropbox.com/s/nd9c58ndzsikxg1/ryan.zip?dl=0

In your program you should use a 32 bit integer with %lw.

16 May 2018 11:40 #22129

Thank you, unfortunately there is a different error on an unrelated format string now.

The line; i=winio$('%pv%fr&',400,300)

Results in an error 'Too few arguments to satisfy WINIO@ format (continuation 1).

Happy to test more updates or wait if you need time to test.

16 May 2018 2:48 #22130

Ryan

Try this one...

https://www.dropbox.com/s/k6s5wdrd9983uv1/ryan.zip?dl=0

16 May 2018 3:10 #22131

Ryan

Your code now starts running for me but there are other bugs that need fixing.

It might be OK if you provide your own menu. As it is things go wrong when you minimise and restore the child window.

I will make a note that this needs fixing.

16 May 2018 3:12 #22132

Yes, it does seem to work for me now.

It was only a hacked together proof of concept, but those issues might exist in the larger codebase.

This might also fix the issue I was having with OpenGL and the grave character in the format string there.

16 May 2018 3:13 #22133

Forgot to say, thank you very much Paul.

16 May 2018 5:11 #22134

I have an idea about how to fix the remaining issue with %fr. If I get time I will look at it tomorrow.

16 May 2018 7:32 #22135

Probably.

17 May 2018 7:05 #22136

Ryan

The remaining issue turns out to be a problem with the Fortran source code. On the way I did discover another ClearWin+/gFortran bug relating to %`cw which is now fixed in...

https://www.dropbox.com/s/10bs9zp9k5hexez/ryan.zip?dl=0

Here is some old, rough and ready code that I have used for testing...

!FTN95$WINAPP 'manifest.rc'
!--------------------------------------------------------------
    program aw 
      use clrwin$
      integer i,c0,c1,c2
      integer(CW_HANDLE)::h1,h2,cwh1
      common h1,h2
      integer,external::child_func

      i=winio$('%pv%fr&',400,400)
      i=winio$('%ww[no_border]%ca[MDI frame]&')
      i=winio$('%mn[&Child]&',child_func)
      i=winio$('%lw',c0)

      i=winio$('%aw&',c0)
      i=winio$('%ww[no_border]%ca[First Child]&')
      i=winio$('%pv%30.3`cw[hscroll,vscroll]&',10,cwh1)
      i=winio$('%lw&',c1)
      i=winio$('%hw',h1)

      call set_max_lines$(cwh1,50)
      call cw_write$(10,'Hello there!')

      i=winio$('%aw&',c0)
      i=winio$('%ww[no_border]%ca[Second Child]&')
      i=winio$('%pv%gr[black,metafile_resize]&',200,200)
      i=winio$('%lw&',c2)
      i=winio$('%hw',h2)

      call draw_ellipse$(100,100,50,50,255)
    end

!--------------------------------------------
    integer function child_func()
      use clrwin$
      integer i
      integer(CW_HANDLE)::h,h1,h2
      integer hh
      common h1,h2
      h=clearwin_info$('FOCUS_WINDOW')
      hh=0
      if(h.eq.h1) hh=1
      if(h.eq.h2) hh=2
      if(hh.gt.0) then
        i=winio$('Window %wd is active %2nl%cn%`7bt[OK]',hh)
      endif
      child_func=1
    end
17 May 2018 11:54 #22137

Your sample code works well for me.

The original code I posted almost works but exits when interacting with the child window. This may have been due to the bug you said was in my code. if you want that version, let me know and I'll post it.

Thanks again Paul.

20 May 2018 6:27 #22152

I don't think there have been any significant changes since bet169 other than those specifically for Ryan and gFortran users. It's the same DLL but there is no point in your using it in preference to the beta169.

Please login to reply.