🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
3 messages
3 total messages Started by Robert D. Nicholson Mon, 17 Aug 1992 10:44
Drag and Drop in < NS3.0
#1191
Author: Robert D. Nicholson
Date: Mon, 17 Aug 1992 10:44
11 lines
859 bytes
I have to implement Drag and Drop behaviour in NS2.1, but I would also like
to know wether NS3.0 can do it properly. (Look forward to reading the
article on it simson)

OK, I would like to know wether drag and drop can be implemented such that
the application can determine specifically which window is under the cursor.

ie. if there are overlapping windows, I must be able to tell which is at the
top. ie. above all the rest

Anybody done this?
Re: Drag and Drop in < NS3.0
#1204
Author: KIENENBERGER MIKE L
Date: Tue, 18 Aug 1992 11:33
63 lines
3035 bytes
In article <1992Aug17.104453.11070@monu6.cc.monash.edu.au>, ede978e@monu6.cc.monash.edu.au (Robert D. Nicholson) writes...
>I have to implement Drag and Drop behaviour in NS2.1, but I would also like
>to know wether NS3.0 can do it properly. (Look forward to reading the
>article on it simson)
> 
>OK, I would like to know wether drag and drop can be implemented such that
>the application can determine specifically which window is under the cursor.
> 
>ie. if there are overlapping windows, I must be able to tell which is at the
>top. ie. above all the rest
> 
>Anybody done this?

Yes! (Finally.)
The key is the little-known postscript operator "findwindow."

	<x> <y> <place> <otherwindow> findwindow <x'> <y'> <window> <bool>

(If you're planning on writing your own routine, note that <otherwindow>
 is a local window, while <window> is a global window! If it seems inconsistant
 to you, you are not alone!)

Here's how I implemented it.  "currentPoint" is in screen coords.  "dragWindow"
is the id of the window holding the image being dragged. (I want a window UNDER
what is being dragged.)  "acceptViewList" is a list of accepting views.
The id of the first accepting view under the point is returned.  If no
accepting view is found, nil is returned.

Many thanks to John Immordino at NeXTedge Developer Support who pointed out
findwindow to me when I really needed it!

26-line routine follows. 
=============================================================================
-Mike Kienenberger                       SXMLK@ALASKA           (BITNet)
 University of Alaska Computer Network   SXMLK@acad3.alaska.edu (Internet)
 University of Alaska-Fairbanks
=============================================================================

- checkForAcceptView:(NXPoint *)currentPoint under:dragWindow
{
    int count = 0;
    id currentView;
    unsigned int localWindowNumber;
    float dummy;
    int pwinFound;
    int pdidFind;

    PSfindwindow(currentPoint->x, currentPoint->y,
		 NX_BELOW, [dragWindow windowNum],
		 &dummy, &dummy, &pwinFound, &pdidFind);
    if (0 == pdidFind)  return nil;

    NXConvertGlobalToWinNum(pwinFound, &localWindowNumber);

    while (count < [acceptViewList count])
    {
        currentView = [acceptViewList objectAt:count];
        if ([[currentView window] windowNum] == localWindowNumber)
	    return currentView;
	++count;
    }
    return nil;
}
Re: Drag and Drop in < NS3.0
#1213
Author: KIENENBERGER MIKE L
Date: Wed, 19 Aug 1992 02:36
30 lines
2342 bytes
In article <18AUG199203332039@acad3.alaska.edu>, sxmlk@acad3.alaska.edu (KIENENBERGER MIKE L) writes...
>In article <1992Aug17.104453.11070@monu6.cc.monash.edu.au>, ede978e@monu6.cc.monash.edu.au (Robert D. Nicholson) writes...
>>I have to implement Drag and Drop behaviour in NS2.1, but I would also like
>>to know wether NS3.0 can do it properly. (Look forward to reading the
>>article on it simson)
>> 
>>OK, I would like to know wether drag and drop can be implemented such that
>>the application can determine specifically which window is under the cursor.
>>ie. if there are overlapping windows, I must be able to tell which is at the
>>top. ie. above all the rest
>> 
>>Anybody done this?
> 
>Yes! (Finally.)
>The key is the little-known postscript operator "findwindow."
>	<x> <y> <place> <otherwindow> findwindow <x'> <y'> <window> <bool>
>(If you're planning on writing your own routine, note that <otherwindow>
> is a local window, while <window> is a global window! If it seems inconsistant
> to you, you are not alone!)
[example deleted]

For those who are wondering why this is necessary (since when using built-in
NeXT icon-dragging routines, the proper window is identified), the real issue
being discussed is dragging/dropping inner-app objects (palette objects, for
example).  This is the missing code for the AppkitDragView class used
in WhatADrag and other NextDeveloper examples. 
=============================================================================
-Mike Kienenberger                       SXMLK@ALASKA           (BITNet)
 University of Alaska Computer Network   SXMLK@acad3.alaska.edu (Internet)
 University of Alaska-Fairbanks
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads