replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - GET_MOUSE_POSITION@() alternative
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 

GET_MOUSE_POSITION@() alternative

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
steveDoyle



Joined: 04 Sep 2009
Posts: 117
Location: Manchester

PostPosted: Fri Aug 22, 2014 3:11 pm    Post subject: GET_MOUSE_POSITION@() alternative Reply with quote

I was wondering of anybody could help me..
I have a relative complicates flow-sheeting application that has GET_MOUSE_POSITION@() at the core to select/move edit graphics objects. currently the specific active function it terminated using the right mouse key press. I t has been request that the ESC key be used as an additional alternative. I have tried the key monitoring technique posted elsewhere on the forum without success.
I have seen that clearwin_info@() is recommended as a replacement but it does not seem to have the functionality i'm looking for.

here is my current function. it anybody could provide an alternative with additional keyboard scanning functionality it would be appreciated




SUBROUTINE GET_MOUSE_POS_ORG(IX1, IY1, IRIGHTB_STAT, ILEFTB_STAT)
c ========================

IMPLICIT NONE

INCLUDE 'PARAM_ED.INC'

INTEGER IX1, IY1, IRIGHTB_STAT, ILEFTB_STAT
INTEGER*2 IH, IV, BUTTON_STATUS, ILEFTB, IRIGHTB, IBITZ, IBITZ2,
+ INTS

ILEFTB = INTS(1)
IRIGHTB = INTS(2)



IRIGHTB_STAT = BUTTON_OFF
ILEFTB_STAT = BUTTON_OFF
CALL GET_MOUSE_POSITION@(IH, IV, BUTTON_STATUS)


c IBITZ = INTS(AND(BUTTON_STATUS, IRIGHTB))
IBITZ = AND(BUTTON_STATUS, IRIGHTB)
IF (IBITZ .NE. 0) THEN
IRIGHTB_STAT = BUTTON_ON
ENDIF

c IBITZ2 = INTS(AND(BUTTON_STATUS, ILEFTB))
IBITZ2 = AND(BUTTON_STATUS, ILEFTB)
IF (IBITZ2 .NE. 0) THEN
ILEFTB_STAT = BUTTON_ON
ENDIF

IX1 = IH
IY1 = IV


END
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Fri Aug 22, 2014 8:39 pm    Post subject: Reply with quote

Steve,

Is it worth using Esc as an accelerator key, either established with %ac or add_accelerator@ ? Then you'd have a whole callback available to terminate your process. It might be worth putting the response to right-click in a function on its own, then you could call it in response to right-click OR use it as the callback to the Esc key accelerator.

Assuming that your graphics operation (the 'specific active function') begins with something (maybe a left-click) then that's the point where I would call add_accelerator@, and after the exit command, call remove_accelerator@. You will need the graphics window handle.

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



Joined: 04 Sep 2009
Posts: 117
Location: Manchester

PostPosted: Sat Aug 30, 2014 3:59 pm    Post subject: Reply with quote

Eddie

worked like a dream. thanks for the help

steve
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Sat Aug 30, 2014 5:18 pm    Post subject: Reply with quote

It's nice to know that something I thought up as how I would attempt it works - it wasn't something I tested! presumably you went the add_accelerator@ ... remove_accelerator@ route.

You may also find it useful to change the cursor appearance at the beginning and end of the select-move-drop sequence (if you haven't already done so) as this looks very professional.

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



Joined: 04 Sep 2009
Posts: 117
Location: Manchester

PostPosted: Sat Aug 30, 2014 8:50 pm    Post subject: Reply with quote

HI Eddie

using the accelerator key method was simple to implement

just add accelerator key and set a flag
use the accelerator key callback to trip the flag
use to the flag to set the button push flag

pseudo code



call SET_ESC_KEY(1)

10 continue
CALL GET_MOUSE_POS(IXPOS, IYPOS, IRIGHTB, ILEFTB)

CALL GET_ESC_KEY(IRIGHTB)

IF (IRIGHTB .EQ. BUTTON_ON) GOTO 150


c
c
c



goto 10

.
150 call SET_ESC_KEY(0)

c
c all variable defined in include file and in common
c


SUBROUTINE SET_ESC_KEY(IMODE)
c ======================

IMPLICIT NONE

INCLUDE 'WINDOWSX.INC'
INCLUDE 'PARAM_ED.INC'
INCLUDE 'DNDWIN.INC'

INTEGER IMODE
EXTERNAL ESC_KEY_CB
INTEGER ESC_KEY_CB

IF (IMODE .EQ. 1) THEN
ESC_ACTIVE_FLG = ITRUE

CALL ADD_ACCELERATOR@(DND_MAIN_WIN_HANDLE, 'ESC', ESC_KEY_CB)
ELSE

CALL REMOVE_ACCELERATOR@(DND_MAIN_WIN_HANDLE, 'ESC')

ENDIF

END


SUBROUTINE GET_ESC_KEY(IRIGHTB)
c =================


IMPLICIT NONE

INCLUDE 'PARAM_ED.INC'
INCLUDE 'DNDWIN.INC'

INTEGER IRIGHTB

IF (ESC_ACTIVE_FLG .EQ. IFALSE) THEN
IRIGHTB = BUTTON_ON

ENDIF

END



INTEGER FUNCTIONESC_KEY_CB()
c =================


IMPLICIT NONE

INCLUDE 'PARAM_ED.INC'
INCLUDE 'DNDWIN.INC'

CALL EDIT_GET_LWO(ESC_KEY_CB)


ESC_ACTIVE_FLG = IFALSE

END
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Sun Aug 31, 2014 11:09 am    Post subject: Reply with quote

Hi Steve,

Don't ESC_ACTIVE_FLG and BUTTON_ON (or is it IMODE?) do more-or-less the same job?

My first excursion into Clearwin+ had lots of state flags until I realised that the grey-control code often did the same job. Some of the flags used the convention 1='permit_action' whereas others used the convention 1='forbid_action', and it took me a long time and lots of frustration before I became consistent with the grey-control convention (1='permit_action').

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



Joined: 04 Sep 2009
Posts: 117
Location: Manchester

PostPosted: Sun Aug 31, 2014 1:34 pm    Post subject: Reply with quote

I guess i could rationalise the code a little but experience has taught me to be paranoid about unwanted side effects. I will revisit he implementation to make it more generic so i can use it elsewhere.

i to use to get very confused with 0/1 settings so i have parametrised everything button_on/button_off grey_on/grey_off etc. it help to avoid mistakes and i think make the code a little easier to read
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 -> Support All times are GMT + 1 Hour
Page 1 of 1

 
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