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 

Obtaining edit_info type for an edit box in gFortran 64 bit
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
Ryan



Joined: 25 Feb 2016
Posts: 46

PostPosted: Wed May 16, 2018 11:21 am    Post subject: Obtaining edit_info type for an edit box in gFortran 64 bit Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed May 16, 2018 12:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ryan



Joined: 25 Feb 2016
Posts: 46

PostPosted: Wed May 16, 2018 12:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed May 16, 2018 3:48 pm    Post subject: Reply with quote

Ryan

Try this one...

https://www.dropbox.com/s/k6s5wdrd9983uv1/ryan.zip?dl=0
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed May 16, 2018 4:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ryan



Joined: 25 Feb 2016
Posts: 46

PostPosted: Wed May 16, 2018 4:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ryan



Joined: 25 Feb 2016
Posts: 46

PostPosted: Wed May 16, 2018 4:13 pm    Post subject: Reply with quote

Forgot to say, thank you very much Paul.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed May 16, 2018 6:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 802

PostPosted: Wed May 16, 2018 8:17 pm    Post subject: Reply with quote

Quote:
As it is things go wrong when you minimise and restore the child window.


Paul, could this be related in some way to the recently discussed problems with mdi child windows ?
_________________
"This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul"
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed May 16, 2018 8:32 pm    Post subject: Reply with quote

Probably.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu May 17, 2018 8:05 am    Post subject: Reply with quote

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
View user's profile Send private message
Ryan



Joined: 25 Feb 2016
Posts: 46

PostPosted: Thu May 17, 2018 12:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 802

PostPosted: Sat May 19, 2018 8:15 pm    Post subject: Reply with quote

Sid,
about the 1sr error described in your original post - just define the variable as plain INTEGER
i.e. try:-
Code:
integer, dimension (48) :: info_int


(see the example after the description of the data structure here:-
https://silverfrost.com/ftn95-help/clearwinp/d6eb/_n_meb_options_.aspx)
_________________
"This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul"
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 802

PostPosted: Sat May 19, 2018 8:22 pm    Post subject: Reply with quote

Paul,
this new dll - can we try it with the ftn95 beta169 release, or is it uniquely for gfortran64 use and it will it just cause more errors/confusion if we do ?
(I'm not sure if the ftn95 & gfortran dlls are updated in parallel or if they're completely independent and maybe the gfortran ones 'lag behind' as it were with updates or use the same dlls)
_________________
"This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul"
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun May 20, 2018 7:27 am    Post subject: Reply with quote

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