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 

rambling enquiry about full_mouse_input and callback_reason
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


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

PostPosted: Sat Mar 16, 2013 10:30 am    Post subject: Reply with quote

OK. The new options [free_selection] and mode 4 will provide what you want when the new DLL is available for download.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Sat Mar 16, 2013 12:49 pm    Post subject: Reply with quote

Hi Dan,

No doubt you are right, and if programming was my only, or even main, activity, then I would probably have the knowledge and time to commit to find an alternative approach working from first principles.

What Paul is describing looks like a very welcome addition to me.

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



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

PostPosted: Sun Mar 17, 2013 10:59 am    Post subject: Reply with quote

What specifically this option and mode 4 will be doing?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun Mar 17, 2013 11:40 am    Post subject: Reply with quote

If you run my last sample program above then the result will be the same but the rubber-banded box will not be shown.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Sun Mar 17, 2013 12:11 pm    Post subject: Reply with quote

That 's needed option, thanks. And thanks Eddie for swearing too
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Sun Mar 09, 2014 12:09 pm    Post subject: RESIZE Reply with quote

I'm returning to this thread because it seems to address a closely related set of problems.

I am trying to implement user resizing (i.e. the user dragging a window corner). This generates multiple RESIZE interrupts. However, there is too much data to be able to redraw the %gr window after each one of these, and there seems no way to determine which is the LAST resize interrupt of a series, when it is safe and required to redraw.

While the user is dragging the window corner, the left mouse button is held down. After finishing the drag the left mouse button is released. That should be the signal to redraw. However, this mouse-button-up event does not seem to be reflected in the flags returned by GET_MOUSE_INFO@ which are 256 in both conditions. Probably this is because the mouse is not actually within the window but on its border?

Is there any function which will return the current mouse state irrespective of where it is on the screen?

Otherwise it seems I have no way of determining whether the user has finished the resize and wants a redraw. It is messy to require the resize to be followed by a click within the window, which I could detect.

- Steve
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



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

PostPosted: Sun Mar 09, 2014 6:04 pm    Post subject: Reply with quote

Steve,

I was surprised when this old post re-appeared. Those mouse functions only work if one is within a graphics control, and your surmise that you had the mouse on the border seems to me to be correct. There must be a function that gets the mouse position relative to the whole screen, but if it exists in Clearwin+ it isn't documented. The one in MSDN is GetCursorPos, or probably better, GetPhysicalCursorPos.

You could experiment with strictly Clearwin+ code by looking at the parameters returned by GET_WINDOW_LOCATION@, and if the X,Y, WIDTH or HEIGHT values haven't changed by more than a certain number of pixels since the previous RESIZE event, don't bother to redraw. That should wipe out some redraws. (In later Windows, you can resize with all four borders. This changes X and Y, whereas older Windows versions only resized with right and bottom borders, thus changing only WIDTH and HEIGHT).

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



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Sun Mar 09, 2014 6:47 pm    Post subject: Reply with quote

Hi Eddie -
good thinking, and thanks for the quick response!

In fact it doesn't matter which corner because the mouse button is held down during the resize, and released when the user is happy with the new size. It's not possible to switch to using a different corner during the resize operation.

There are really two problems - one is the multiple redraws, and you answer that one very well - it's the same technique I use in rubberboxing. The other problem is the more serious one - of identifying the last resize interrupt so that the final redraw is correct (and of course if it's possible to identify this one, I can suppress all the preceding redraws). There's a whole series of RESIZE interrupts as you drag the window corner - and then they stop, so you need to detect an absence of interrupts! The only thing that has changed is that the mouse button has been released, and that event is not picked up in the standard Clearwin+ functions. I'll look at the Microsoft options, but I'm not really interested in the x,y position at this stage (I get this from the Clearwin resize handling), only the mouse button state, up or down: if down then the resize operation isn't finished, if up then it is.

- Steve



- Stephen
Back to top
View user's profile Send private message Visit poster's website
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Sun Mar 09, 2014 8:42 pm    Post subject: Re: Reply with quote

silicondale wrote:
... only the mouse button state, up or down: if down then the resize operation isn't finished, if up then it is.

You can poll the mouse button state using GetAsyncKeyState() or handle the WM_MOUSEMOVE window message.

Probably, you could just handle the WM_SIZE window message that is sent to window after it's size is changed.
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Mon Mar 10, 2014 9:47 am    Post subject: Reply with quote

Many thanks for the suggestions, Jalih...
I've tried trapping the WM_SIZE and it seems this is what Clearwin+ already does in its RESIZE message - i.e. you get a whole stream of WM_SIZE messages while dragging the corner of the window, which stop when you release the mouse button. All I want to find is the LAST one of these messages, and I think I'll only get that by using GetAsyncKeyState () or similar - if the left mouse button is down, the callback does nothing, if it's up, the callback does a redraw.

... added09:30. Just tried GetAsyncKeyState. Doesn't seem to help, because it doesn't seem to be recording the button release. Maybe I need to put in a delay loop, but that could cause all sorts of mayhem if there is a stream of WM_SIZE messages coming through that are not being handled. Surely there has to be some way of finding when the user has finished the re-sizing. Windows can't expect the window to be getting repainted for every single WM_SIZE message, can it? It can't be that simple-minded, surely?
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Mon Mar 10, 2014 11:41 am    Post subject: Reply with quote

It might not be elegant, but my simple solution is that I just leave a grey screen. I have a menu option for redraw, which I use to repaint when the resize is complete.
There are a lot of interrupts when resizing. I have a text screen which reports a lot of size resets!
All I do is reset the screen size and aspect ratio. I'm not sure if I paint the screen grey, or if this is the default.
The problem, I haven't bothered fixing is that on redraw I reset the blow-up factor to 100%, so loose any magnification of the screen graphics.

I avoid the problem.

John
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Mon Mar 10, 2014 12:18 pm    Post subject: Reply with quote

John -

I think you're right. Life's too short to fight the deficiencies of Microsoft Windows.

Mine works fine without redrawing at all during the resize - all I do is record the new x,y size in a common block, and I let the user refresh from a menu option when happy with the new window size. I have provided two different options, both of which compute new scaling factors, one ('refresh') redraws the data that was visible before the resize, the other ('reset') sets the display to the original data area before any zooming and panning.

cheers

Steve
Back to top
View user's profile Send private message Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Mon Mar 10, 2014 12:31 pm    Post subject: Reply with quote

To redraw a graphics window only after releasing the left mouse button I do the following:

This is a small part of my code to display a BMP file in a new window:


Code:
      common  /H_WINTAB/ wthwnd,flag
c
c     ...
c
c     afile = name of BMP graphics
c
      call get_im_info@(afile,cols,rows,i,j,ext,rtcode)
      if (rtcode .eq. 0) then
        wthwnd = import_bmp@(afile,rtcode)
        if (rtcode .eq. 0) then
          j = winio@('%`ca@%ww[no_border,no_maxbox,topmost,toolwindow]'
     *        //'%lw%sp%pv%`^gr[user_resize]',
     *        afile,ctrl,pos_x,pos_y,cols,rows,4L,z_neu)
        end if
      end if
c
c     ...
c


and this is the function connected with user_resize:

Code:
      integer function z_neu()
 
      IMPLICIT NONE
      INCLUDE <WINDOWS.INS>
 
      integer*4     k,wthwnd,flag
 
      common  /H_WINTAB/ wthwnd,flag
 
      k = select_graphics_object@(4L)
      k = clearwin_info@('GRAPHICS_RESIZING')
      if (k .eq. 1) k = dib_paint@(0,0,wthwnd,0,0)
      k = select_graphics_object@(1L)
      z_neu = 1
      end


Regards - Wilfried
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Mar 10, 2014 1:26 pm    Post subject: Reply with quote

When using %gr[user_resize], the callback can access the current mouse state by calling clearwin_info@("GRAPHICS_MOUSE_FLAGS").

I have not tried this to see if it helps in this context.
Back to top
View user's profile Send private message AIM Address
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Mon Mar 10, 2014 1:27 pm    Post subject: Re: Reply with quote

silicondale wrote:
you get a whole stream of WM_SIZE messages while dragging the corner of the window, which stop when you release the mouse button. All I want to find is the LAST one of these messages...,

I think the window should get just one WM_SIZE window message after resize is complete, unless the dragging of full windows system option is set on. If the dragging of full windows is set on, you could probably monitor the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE window messages.
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 Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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