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 

64 bit ClearWin+
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Tue Jul 23, 2013 7:13 pm    Post subject: Re: Problems get_mouse_info@,get_mouse_info$ Reply with quote

DietmarSiepmann wrote:

We have a modification of that scenario: we implemented one more function, say F_TIM, which will be executed, if the user hits a push button (format code "%bt"). F_TIM contains a while loop which retrieves and prints out the mouse position. The while loop may be left by depressing the right button of the mouse.

Why use while loop for getting the mouse info? It will effectively block the rest of the program as the loop runs.

You could process the mouse input directly in the %gr callback:
Code:

module data
  implicit none
  include <WINDOWS.INS>

  logical :: button_state = .FALSE.


  contains
    function F_GR()
      integer :: F_GR
      integer :: mx, my
      character (len=20) :: reason


      mx = clearwin_info@('graphics_mouse_x')
      my = clearwin_info@('graphics_mouse_y')
     
      if (button_state) write(*,*) 'mouse x:', mx, ' mouse y:', my

      reason = CLEARWIN_STRING@('CALLBACK_REASON')

      if (reason == 'MOUSE_LEFT_CLICK') then
        button_state = .TRUE.
      else if (reason == 'MOUSE_RIGHT_CLICK') then
        button_state = .FALSE.
      end if
     
      F_GR = 1

    end function F_GR


    function F_BT()
      integer :: F_BT

      if (button_state) then
        button_state = .FALSE.
      else
        button_state = .TRUE.
      end if

      F_BT = 2
     
    end function F_BT


end module data


program test
  use data
  implicit none

  integer*4 i,control,hwnd
 
  i=winio@('%ww[no_border,independent]&')
  i=winio@('%hw&',hwnd)
  i=winio@('%^gr[rgb_colours,black,full_mouse_input]&', 300,300,F_GR)
  i=winio@('%ff%^bt[Test]&',F_BT)
  i=winio@('%lw',control)           
  !call stop_when_windows_close@()       
end
Back to top
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Wed Jul 24, 2013 8:37 am    Post subject: Reply with quote

We are aware of being able to process mouse button events in %gr callback and we have tried to state that this works (for 32 bit and 64 bit) in our previous post.

However, we try to port a big existing application from 32 bit to 64 bit. This application has been designed using the scenario with function F_TIM described in the previous post and which does not behave in the same way for 64 bit as under 32 bit. We would try to change as less as possible in the port and that's why we tried to use the F_TIM scenario which works under Salford (32 bit) to our satisfaction.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Wed Jul 24, 2013 11:45 am    Post subject: Reply with quote

I'm astonished that the function works anywhere outside of a %gr or %dw area, because when I read FTN95.CHM it clearly states "To obtain the position of the mouse, the mouse buttons, and the keyboard shift keys at the time when the last owner-draw (%^dw) or graphics region (%^gr) call-back function was called." and "This routine should be called immediately on entry to the call-back function. It does not make sense to call this function in other contexts. "

There is a certain obviousness that the function is tied to a %gr or %dw by the origin of coordinates, and any %bt is certainly external to a graphics area.

Hence Jalih's suggestion relates to the way that Clearwin+ seems to be intended to work.

No doubt the button could be triggered by a key press while the mouse pointer remains in the %gr area, but whether triggered by a key press or a mouse click, the %gr has lost the focus. While you are in the callback for the button, the %gr region cannot reclaim the focus. As a result, I repeat that I am surprised that your approach works in 32 bit FTN95 mode

If I was programming your application, I might put a popup menu in the %gr region with options for "start mouse tracking" and "stop mouse tracking", and keep GET_MOUSE_INFO@ entirely within the graphics callback.

Eddie
Back to top
View user's profile Send private message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Wed Jul 24, 2013 1:56 pm    Post subject: Re: Reply with quote

DietmarSiepmann wrote:

However, we try to port a big existing application from 32 bit to 64 bit. This application has been designed using the scenario with function F_TIM described in the previous post and which does not behave in the same way for 64 bit as under 32 bit. We would try to change as less as possible in the port and that's why we tried to use the F_TIM scenario which works under Salford (32 bit) to our satisfaction.


I previously mentioned, that your do while loop is taking up the cpu and blocking the handling of window messages in the application.

Add a call to TEMPORARY_YIELD@() function at the bottom of the do while loop and it should probably work.
Back to top
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Wed Jul 24, 2013 3:59 pm    Post subject: Reply with quote

Thanks to all who helped in this topic, especially to Jalih. Jalih's information to call TEMPORARY_YIELD@() function at the end of the while loop was right and made our test application also work for 64 bit as we expected (and this for ifort and gFortran).

Although our proceeding might not be the correct one, we would use it since it seems to work and thus we do not have to do so many code changes.

Dietmar
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Jul 25, 2013 10:53 am    Post subject: Reply with quote

Also besides call temporary_yield@ look at simultaneous use of PERMIT_ANOTHER_callback, might be very helpful for complex GUI.
You can call it many times, i do not know the limit, never had any problems with that
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Jul 27, 2013 7:47 am    Post subject: Reply with quote

I have have now looked at this issue and the correspondence above has correctly resolved the problem.
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Mon Jul 29, 2013 2:47 pm    Post subject: GET_WKEY1 Reply with quote

One of our SALDORD applications to be ported from 32 to 64 bit makes use of call "GET_WKEY1@". I could not find GET_WKEY1 in clearwin64.dll/clearwin64.a . Is it planned to add it to the dll?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jul 29, 2013 3:01 pm    Post subject: Reply with quote

I can add this and any similar routines on request.
There are a few routines like this that will work but I have assumed that they are redundant.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Mon Jul 29, 2013 3:26 pm    Post subject: Reply with quote

I have now added this function to the beta download (ClearWin64.exe).
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Tue Aug 06, 2013 1:05 pm    Post subject: Clearwin Mouse Functinality Reply with quote

I am trying to port a 32 bit Fortran application to 64 bit which makes use of e.g.

INITIALISE_MOUSE@
SET_MOUSE_BOUNDS@

. I am using the Intel 64 bit Fortran compile environment (compiler: ifort). When linking, both symbols INITIALISE_MOUSE$ and SET_MOUSE_BOUNDS$ remain unresolved although I am linking against Silverfost's libraries clearwin64f.a/clearwin64.a. Looking at Silverfrost's web site

Silverfrost > Documentation > FTN95 Help > ClearWin+ User's Guide > Mouse

I could find both INITIALISE_MOUSE@ and SET_MOUSE_BOUNDS@. Now I wonder how I could resolve these symbols. I could not find these symbols in the clearwin64 dlls/libs as of 26th March 2013.

How would all the other symbols mentioned on the web site be resolved?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Aug 06, 2013 2:37 pm    Post subject: Reply with quote

These two functions are old DBOS functions that were ported to Win32 but have no effect under Win32. You can either delete them or write your own dummy routines.

Just to re-assure you, here is the ClearWin+ code for INITIASE_MOUSE@.


STUB("INITIALISE_MOUSE@",__initialise_mouse)

void __initialise_mouse(void)
{
//noth
}

In other words, INITIALISE_MOUSE@ is translated to __initialise_mouse which is a dummy routine.

SET_MOUSE_BOUNDS@ is the same.

I have tried to port everything to 64 bit ClearWin+ that can be ported and may be needed. If there are other missing functions then please let me know.
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Thu Aug 15, 2013 5:07 pm    Post subject: Format code problems with %hw , %lw Reply with quote

A Fortran/Clearwin application ported from 32 bit to 64 bit makes use of the calls

A=WINIO@('%hw&',IHDLW1)
A=WINIO@('%lw',LHDLW1)

(in sequence). The output value for IHDLW1 is 0 for both the 32 and the 64 bit application (where the names WINIO@ have been mapped to WINIO$ for the 64 bit version). However, the output value for LHDLW1 is -1 for the 32 bit application and 0 for the 64 bit application. IHDLW1 and LHDLW1 are of type integer*4. The winio@ calls mentioned above are preceded by other winio@ calls of the form

A=WINIO@(<format code ending with &>,...)

The 64 bit application has been built with the Intel Fortran Compile environment (compiler ifort.exe) and is linked against the ClearWin+ 64 bit dll.

I wonder why the results for LHDLW1 are different.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Aug 15, 2013 6:57 pm    Post subject: Reply with quote

LHDLW1 needs to be a 64 bit integer for 64 bit apps.

Use the integer kind CW_HANDLE as described in the documentation.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Thu Aug 15, 2013 8:09 pm    Post subject: Reply with quote

Correction. It is IHDLW1 that needs to be INTEGER*8 not LHDLW1.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 3 of 7

 
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