Lisp HUG Maillist Archive

RE: Query Ctrl or Shift keys only?

-----Original Message-----
From: Andreas Thiele [mailto:andreas@atp-media.de] 
Sent: Tuesday, November 18, 2008 10:04 AM
To: 'Martin Simmons'
Subject: RE: Query Ctrl or Shift keys only?




> -----Original Message-----
> From: owner-lisp-hug@lispworks.com
> [mailto:owner-lisp-hug@lispworks.com] On Behalf Of Martin Simmons
> Sent: Monday, November 17, 2008 3:15 PM
> To: lisp-hug@lispworks.com
> Subject: Re: Query Ctrl or Shift keys only?
> 
> 
> 
> >>>>> On Thu, 13 Nov 2008 12:07:58 +0100, Andreas Thiele said:
> > 
> > Hi All,
> > 
> > after playing with gesture-specs I do not succeed to query
> the control
> > or shift keys unless another meaningful key is pressed.
> > 
> > Is it possible to know if the shift or control key is down
> (or up) in
> > LispWorks?
> > 
> > Any hint or hack welcome.
> 
> The win32 API approach will work, though it uses undocumented
> APIs in LispWorks so is closer to hack than hint :-)
> 
> In what situations do you need to find the state of control or shift?
> 
> --
> Martin Simmons
> LispWorks Ltd
> http://www.lispworks.com/
> 

Hi Martin,

thanks, I need it when drag and drop just startet to decise whether the user wants a copy or move operation.


Andreas


Re: Query Ctrl or Shift keys only?



The win32 API approach will work, though it uses undocumented
APIs in LispWorks so is closer to hack than hint :-)

In what situations do you need to find the state of control or shift?

--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/

    

Hi Martin,

thanks, I need it when drag and drop just startet to decise whether the user wants a copy or move operation.


Andreas
  

Can't you use input-model callbacks like ((:motion :shift) shift-motion-callback) and ((:motion :control) control-motion-callback) for that?

Mitch

RE: Query Ctrl or Shift keys only?

Nachricht
 
-----Original Message-----
From: Mitch Berkson [mailto:mitch@bermita.com]
Sent: Tuesday, November 18, 2008 2:19 PM
To: Andreas Thiele
Cc: lisp-hug@lispworks.com
Subject: Re: Query Ctrl or Shift keys only?



The win32 API approach will work, though it uses undocumented
APIs in LispWorks so is closer to hack than hint :-)

In what situations do you need to find the state of control or shift?

--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/

    

Hi Martin,

thanks, I need it when drag and drop just startet to decise whether the user wants a copy or move operation.


Andreas
  

Can't you use input-model callbacks like ((:motion :shift) shift-motion-callback) and ((:motion :control) control-motion-callback) for that?

Mitch  
 
IIRC the input-model callbacks don't work if you are in a drag-and-drop callback. I tried it an solved the issue with the win32 call.
 
Andreas
 

Re: Query Ctrl or Shift keys only?

>> I need it when drag and drop just startet to decise whether the  
>> user wants a copy or move operation

Maybe you can do that in the drop-callback of a capi::simple-pane,  
using capi:drop-object-allows-drop-effect-p and capi:drop-object-drop- 
effect.
This will behave and update the cursor accordingly to the OS on which  
you are running LW.


(defun my-drop-callback (self drop-object stage)
   (flet ((set-effect-for-operation (drop-object)
            (dolist (effect '(:move :copy :link :generic))
              (when (capi:drop-object-allows-drop-effect-p drop-object  
effect)
                (setf (capi:drop-object-drop-effect drop-object) effect)
                (return t)))))
       ;;; set-effect-for-operation makes (capi:drop-object-drop- 
effect drop-object) correspond to the type of action (copy, move, etc.)
       ;;; it is called in the various stages of a d&d process :
       (case stage
         (:formats
          ; set d&d formats
          (capi:set-drop-object-supported-formats drop-object  
'(:string :value :my-object :filename-list)))
         (:enter
          (set-effect-for-operation drop-object)
          ; (... do something when drag enters a pane ...)
	)
         (:leave
          (set-effect-for-operation drop-object)
         ; (... do something when drag leaves a pane ...)
	)
         (:drag
          (set-effect-for-operation drop-object))
        (:drop
              (set-effect-for-operation drop-object)
              (if (equal (capi:drop-object-drop-effect drop- 
object) :copy) (print "copy") (print "move"))
              (setf (capi:drop-object-drop-effect drop-object) nil))
        )))




Updated at: 2020-12-10 08:41 UTC