Folks,
Thanks very much for the prompt reply to my question. Passing the frame 
DynDocument to enableDragEvents() as well as the layer enables layer 
dragging in frames as advertised.

Now, the reason I was pursuing this was because I need 
dynapi.gui.scrollpane to work in a frame. In the current version under CVS 
Scrollpane does not work in a frame in either NS 4.73 or IE 5.0 because the 
dynapi.gui.scrollbar doesn't work because frame dragging doesn't work.

By passing the frame DynDocument to the dynapi.gui.scrollbar constructor I 
was able to add the DynDocument to enableDragEvents()  in the constructor 
and to get ScrollBar to work. I suspect the extra constructor parameter is 
a hack (I'm a pretty much a JavaScript newbie) and there is probably a more 
elegant way to extend the current widgets so that they work in frames.

With my hack, the ScrollPane widget works in a frame in NS 4.73 with the 
new ScrollBar constructor and in IE as well as long as you don't touch the 
buttons on either end of the ScrollBar. However, generating an onmousedown 
event on one of those buttons in IE 5.0 in a framed widget with the new 
frame-enabled ScrollBar kills IE.

What appears to be happening is the event bubbles through successive 
invocations of MouseEvent.bubbleEvent() which does DynLayer.invokeEvent() 
until it calls DragEvent.lyrListener.onmousedown() and dies as described 
below...

DragEvent.lyrListener.onmousedown=function(e) {
         e.cancelBrowserEvent();
         if (DynAPI.document.dragevent) return;
         var lyr=e.getSource();
         lyr.dragevent=new DragEvent("dragstart",lyr);
         DynAPI.document.dragevent=lyr.dragevent;
         DynAPI.document.dragobject=lyr;
         var de=lyr.dragevent;
         de.isDragging=false;
         de.x=e.getPageX()-e.getSource().getPageX();
         de.y=e.getPageY()-e.getSource().getPageY();
         de.pageX=e.getPageX();
         de.pageY=e.getPageY();
         de.parentPageX=lyr.parent.getPageX();  <---- here there is no 
lyr.parent
         de.parentPageY=lyr.parent.getPageY();
     e.setBubble(true);
};

So my framed ScrollPane buttons and sliders now work fine in NS 4.73 with 
the change to enableDragEvents() and on IE5.0 the sliders work fine but it 
dies a horrible death when I click on a button.

I think DynAPI is a terrific toolkit and is going to be widely used once it 
settles down a bit and people learn about it. I'm glad to be part of the 
bleeding edge.
Thanks for any assistance you might be able to offer on this issue.

Peter Dvorsky


At 04:25 PM 12/19/2000 +0100, you wrote:
>I added support for dragging in other frames. Simply pass the dyndocument 
>where
>the layer is dragged as first parameter of the enableDragEvents method.
>
>d = new dyndocument(parent.blah)
>a = new DynLayer()
>d.addChild(a)
>DragEvent.enableDragEvents(d,a)
>
>
>Cya
>
>...
>
>Which brings up again the need for proper API documentation.
>
>
>
>Richard Bennett wrote:
>
> > hi,
> > I haven't used frames with DynAPI myself yet, so my solution might not be
> > 100% orthodox.
> > It seems you have to assign a drag event to the frame in question 
> before you
> > can target the layer,
> > but then you get errors when you click on the target frame, if you disable
> > drag events for the
> > target frame again, the reference seems to remain, without errors:
> >
> >        myLayer=new DynLayer(null,100,100,100,100,'#c0c0c0')
> >        tdoc = new DynDocument(parent.treeFrame);
> >        tdoc.addChild(myLayer);
> >        DragEvent.setDragBoundary(myLayer, 0, 300, 300, 0)
> >        DragEvent.enableDragEvents(myLayer)
> >        DragEvent.enableDragEvents(tdoc)
> >        DragEvent.disableDragEvents(tdoc)
> >
> > I put up the working example here:
> > http://www.resass.f2s.com/dynapi/php/index.php
> > look under Peter_Dvorsky_Examples in the tree.
> >
> > If someone would care to post the proper solution I'll update the files.
> >
> > I included DynAPIDiagnose in your file, it's my new diagnostic tool, to 
> find
> > which functions/properties etc
> > are available for an object on the page. it's still very much alpha version
> > with lot's of known bugs, and a temporary
> > interface.
> > You simply type the name of some object on the page, for instance tdoc, or
> > myLayer, into the text box, and click "Get all".
> > This will initially give you all(?) the DynAPI properties/functions etc
> > available for this object, if you then click on, for instance,
> > "+ css has 126 properties" (for myLayer) it will show you browser native
> > properties available to myLayer.css.
> >
> > Cheers,
> > Richard :o
> > [EMAIL PROTECTED]
> > >
> > > I can drag a layer but not when it's in a frame. I don't know if I've
> > > uncovered a DynAPI bug or if I'm doing something wrong.
> > > I tried simple dragging of layers as in part 3 of the online 
> tutorial. The
> > > tutorial works as described.
> > > However, dragging appears not to work if the draggable layer is in a
> > frame.
> > >
> > > Here's my code. The layer shows up perfectly well but it cannot be
> > dragged.
> > > Nothing happens.
> > >
> > > My frameset doc:
> > >
> > > <HTML>
> > > <HEAD>
> > > <TITLE>My frameset</TITLE>
> > >
> > > <SCRIPT LANGUAGE="JavaScript">
> > >
> > > function blank()
> > > {
> > >      return( "<HTML></HTML>" );
> > > }
> > >
> > > </SCRIPT>
> > > </HEAD>
> > >
> > > <FRAMESET ROWS="*,5" FRAMEBORDER=1>
> > >      <FRAME SRC=javascript:parent.blank() NAME="treeFrame">
> > >      <FRAME SRC="dragdoc.htm" NAME="bufferFrame">
> > > </FRAMESET>
> > >
> > > </HTML>
> > >
> > > And here's dragdoc.htm, which only has a small change from the 
> tutorial to
> > > load the draggable layer into treeFrame:
> > >
> > > <html>
> > > <head><title>DynAPI2 tutor - dragging</title>
> > > <script language="JavaScript" src="../src/dynapi.js"></script>
> > > <Script language="Javascript">
> > >
> > > DynAPI.setLibraryPath('../src/lib/');
> > > DynAPI.include('dynapi.api.*')
> > >
> > > DynAPI.onLoad=function() {
> > >      myLayer=new DynLayer(null,100,100,100,100,'#c0c0c0')
> > >
> > >      DragEvent.setDragBoundary(myLayer, 0, 300, 300, 0)
> > >      DragEvent.enableDragEvents(myLayer)
> > >
> > >      tdoc = new DynDocument(parent.treeFrame);
> > >      tdoc.addChild(myLayer);
> > > }
> > >
> > > </script>
> > > </head>
> > > <body>
> > > </body>
> > > </html>
> > >
> > >
> > > Is this a low-level bug or am I missing something?
> > >
> > > Thanks very much for any assistance,
> > >
> > > Peter Dvorsky


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/dynapi-help

Reply via email to