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: Wed Aug 01, 2012 6:31 am    Post subject: Reply with quote

John

Again, I am not in a position to investigate this at the moment. However, if you can get hold of a copy of the Microsoft Spyxx.exe, or something similar, then this is often a useful tool in this context.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Thu Aug 02, 2012 12:53 pm    Post subject: Reply with quote

John,
Startup is a big problem. Your app(s) certainly need to do as much as they can before you display the main window, as the procedures are time-consuming. Mine are all (to my initial surprise!) virtually instant. Users (and that includes the programmer) are used to Windows programs taking time on startup, and they are therefore a bit forgiving. I use a transparency routine I got from this forum to make my startup logo ‘splash’ fade away. I discovered that an overall time of 2 sec and 255 steps gave me a very smooth result.
If you start by clicking on a data file, then you can load that file before displaying the main window, and you can lose the time it takes in that general startup delay time. However, when you have the main window open and start a datafile with File|Open then you are stuck with the wait. If I were programming anything time-consuming, then I definitely wouldn’t put any initialisation in a %sc callback, I would definitely do it before the main window %ca. What your pre-main window logo / splash has to do is simply to convince the user that something is happening.
Delays when the program is fully up and running bring us into the arena of egg-timer animated cursors, bars that fill with colour, estimates of completion time, etc. If the main window client area has a graphic, and that graphic is building itself, then you don’t need the visual clues that something is going on.
RESIZE events don’t bother me, as my response to them is to fill the current area with background colour and redraw the image, but only if there is one to draw. If no file is open, then there isn’t anything to redraw, and the background rectangle redraws so quickly there isn’t even a flash.
Eddie
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Mon Oct 22, 2012 7:22 am    Post subject: Reply with quote

Paul,

In case you missed this earlier, wouldn't it be great if there was a mode 4 for SET_GRAPHICS_SELECTION@ in which nothing was drawn, but the start and finish coordinates of a "click and drag" operation were reported, to facilitate panning of the sort usually done with a 'grabber hand' cursor', or other drag and drop operations in a graphics area (without full_mouse_interrupts)?

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


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

PostPosted: Mon Oct 22, 2012 7:45 am    Post subject: Reply with quote

I have this on my "to do" list.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Mon Oct 22, 2012 6:18 pm    Post subject: Reply with quote

Paul,

Many thanks. I appreciate that you have enough on your plate already, what with Microsoft changing Windows and Visual Studio and breaking things. The list of fixes per release always impresses me!

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


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

PostPosted: Wed Mar 13, 2013 9:24 pm    Post subject: Reply with quote

I have added mode 4 to SET_GRAPHICS_SELECTION@ but unfortunately the change will not be in time for the next release.

The following sample program previously used [box_selection] and mode 1.
Now we will have [free_selection] and mode 4 as an alternative.
In the first case (which you can demonstrate at the moment) you get a rubber banded box. In the new mode, no line or box will be displayed.

Code:
!FTN95$WINAPP
!------------------------------------------------------------------
    module gr7data
      character*32 cstat
      integer mstat
    end module gr7data
!---------------------------------------------------------------
    program gr7
      use clrwin
      use gr7data
      integer i
      integer,external::gr_func

      cstat=' '
      mstat=0

      i=winio@('%ww[no_border]&')
      i=winio@('%ca[Box Selection]&')
      i=winio@('%mn[E&xit]&','EXIT')
      i=winio@('%ob&')
      i=winio@('%^gr[black,free_selection,full_mouse_input]&',300,300,gr_func)
      i=winio@('%cb&')
      i=winio@('%ob[status]%20st%cb',cstat)

    end
!-----------------------------------------------------------
    integer function gr_func()
      use clrwin
      use gr7data
      integer x1,y1,x2,y2,nstat,a,b
      integer::MK_LBUTTON=1
      integer::MK_SHIFT=4
      integer::MK_CONTROL=8

      call get_mouse_info@(x1,y1,nstat)
      write(cstat(1:30),'(3I7)') x1,y1,nstat
      call window_update@(cstat)

      if(iand(nstat,MK_LBUTTON)==0.and.iand(mstat,MK_LBUTTON)/=0)then
        call get_graphics_selected_area@(x1,y1,x2,y2)
        call set_graphics_selection@(0)
        if(iand(nstat,MK_SHIFT)==MK_SHIFT) then
          call draw_rectangle@(x1,y1,x2,y2,12)
        else if(iand(nstat,MK_CONTROL)==MK_CONTROL) then
          a=0.5*(x2-x1)
          b=0.5*(y2-y1)
          call draw_ellipse@(x1+a,y1+b,a,b,12)
        else
          call draw_line_between@(x1,y1,x2,y2,12)
        endif
        call set_graphics_selection@(4)
      endif
      mstat=nstat
      gr_func=1
    end
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Wed Mar 13, 2013 10:32 pm    Post subject: Reply with quote

Excellent news: so when is the release after next? Very Happy Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 14, 2013 8:32 am    Post subject: Reply with quote

I will see if I can make a new DLL available for separate download immediately after the next release.

I have had another look at the sample code above and now realise that [full_mouse_input] is not needed for the basic functionality. In the following adaptation I have restored the [box_selection] and mode 1 and removed the [full_mouse_input]. You get a line drawn by default, a circle if the CTRL key is held down and a box if the SHIFT key is held down.

Code:
!FTN95$WINAPP
!------------------------------------------------------------------
    module gr7data
      character*32 cstat
    end module gr7data
!---------------------------------------------------------------
    program gr7
      use gr7data
      integer i,winio@
      integer,external::gr_func
      cstat=' '
      i=winio@('%ww[no_border]&')
      i=winio@('%ca[Box Selection]&')
      i=winio@('%mn[E&xit]&','EXIT')
      i=winio@('%ob&')
      i=winio@('%^gr[black,box_selection]&',300,300,gr_func)
      i=winio@('%cb&')
      i=winio@('%ob[status]%20st%cb',cstat)
    end
!-----------------------------------------------------------
    integer function gr_func()
      use clrwin
      use gr7data
      integer x1,y1,x2,y2,nstat,a,b
      integer::MK_SHIFT=4
      integer::MK_CONTROL=8
      call get_mouse_info@(x1,y1,nstat)
      write(cstat(1:30),'(3I7)') x1,y1,nstat
      call window_update@(cstat)
      if(clearwin_string@('CALLBACK_REASON') == 'MOUSE_LEFT_CLICK')then
        call get_graphics_selected_area@(x1,y1,x2,y2)
        call set_graphics_selection@(0)
        if(iand(nstat,MK_SHIFT)==MK_SHIFT) then
          call draw_rectangle@(x1,y1,x2,y2,12)
        else if(iand(nstat,MK_CONTROL)==MK_CONTROL) then
          a=0.5*(x2-x1)
          b=0.5*(y2-y1)
          call draw_ellipse@(x1+a,y1+b,a,b,12)
        else
          call draw_line_between@(x1,y1,x2,y2,12)
        endif
        call set_graphics_selection@(1)
      endif
      gr_func=1
    end
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Thu Mar 14, 2013 3:48 pm    Post subject: Reply with quote

LOL....I've reread the whole thread n-th time again and did not understand what it is about, what did not work, what needed to work, what problem was with full_mouse_input (i know one with right mouse menu in older versions but it is fixed long ago), what is FMI and what was fixed. I am truly amazed with the efforts though Smile
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 14, 2013 4:48 pm    Post subject: Reply with quote

FMI is presumably short for [full_mouse_input], an option with %gr.

Nothing has been fixed but I have added an new option [free_selection] for %gr and a new mode (4) for set_graphics_selection@.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Thu Mar 14, 2013 10:23 pm    Post subject: Reply with quote

Dan,

FMI is as Paul stated above. If you use this option, you get overwhelmed by mouse position-and-state callbacks. If you don't use this option, then some mouse actions cannot be discerned, and some Clearwin+ options are not available. Add in to this mix that some things did not work as documented, and you get one of those frustrating situations that you often cite.

Paul,

Without FMI, call set_graphics_selection@(0) has no effect, and one is doomed to draw boxes forever! Thus, even though in the absence of FMI, a basic subset of box_select exists, it isn't much use on its own.

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



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

PostPosted: Fri Mar 15, 2013 4:55 am    Post subject: Reply with quote

I use full mouse_input for 15 years. Surprisingly, despite there was a lot of stability problems with FTN95 back then the only problem i had here i already mentioned. Of latest few years addtions I zoom particular part of x-y plot with the whatever mouse rubberband selection option or use mouse scroll button for the same purpose without slightest problems. It's not easy to extract a small code snippet from that large code but i can post a movie.

Hopefully you ensure that previous call to callback is completed before mouse will automatically generate a dozen new ones and cause conflict - that was the only trick i used.


Last edited by DanRRight on Fri Mar 15, 2013 4:21 pm; edited 3 times in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Mar 15, 2013 7:07 am    Post subject: Reply with quote

Eddie

Can you run my last sample above and confirm what you say about "boxes forever". It runs OK for me.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Fri Mar 15, 2013 10:16 pm    Post subject: Reply with quote

Paul,

If I click-an-drag, I always get a box drawn. If I use SHIFT or CONTROL modifiers, I end up with a drawn box or circle, and with no modifier, I end up with a line. By 'doomed to draw boxes forever', I meant that the click-n-drag always draws a box initially. I tried using call set_graphics_selection@ with different parameters to make it draw (for example) an elastic line but I found that it had no effect, including not being able to turn off box select mode.

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



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

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

Eddie, you are fighting with the annoying rubber boxes while it solves very little. For one small specific problem (like showing for customers nice looking zoomable slope with buildings on it) you can get almost complete freedom with 2D array of RGB pixels (put in memory with get_dib_block@ / display_dib_block@ functions) where mathematically you can do whatever you want including your own elastic lines, rubber bands exploding in small pieces when you unclick, flashes, zooms, perspective change, your own set_graphics_selections@ with mode 100 which even Paul working hard to improve CWP will realize only in year 2030.

Another option to make great looking zoomable image is to use OpenGL


Last edited by DanRRight on Sat Mar 16, 2013 10:45 am; edited 9 times in total
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 2 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