View previous topic :: View next topic |
Author |
Message |
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Wed May 16, 2018 11:21 am Post subject: Obtaining edit_info type for an edit box in gFortran 64 bit |
|
|
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 integer*4,integer*8 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.
Code: | 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
|
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Wed May 16, 2018 12:22 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Wed May 16, 2018 12:40 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Wed May 16, 2018 4:10 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Wed May 16, 2018 4:12 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Wed May 16, 2018 4:13 pm Post subject: |
|
|
Forgot to say, thank you very much Paul. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Wed May 16, 2018 6:11 pm Post subject: |
|
|
I have an idea about how to fix the remaining issue with %fr. If I get time I will look at it tomorrow. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Wed May 16, 2018 8:32 pm Post subject: |
|
|
Probably. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Thu May 17, 2018 8:05 am Post subject: |
|
|
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...
Code: | !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
|
|
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Thu May 17, 2018 12:54 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Sun May 20, 2018 7:27 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|