Atlas: Starting to grasp control development...

[out of date post... this deals with MS Atlas CTP... which has been change drastically and is now MS Ajax Extensions]

This is the type of post you don’t really want to write.  You always want to speak from great knowledge from on high to the masses.  Unfortunately, I did something stupid tonight.  I decided that I could extend the DragOverlayExtender in about an hour and could easily start to add some features like grabbing the position of the element (mind you I have really only given this aspect of Atlas a cursory look before tonight).  In the process I learned quite a bit, but not quite what I wanted to know.

So let’s start with the extenders.  Atlas has these really cool “extenders” that when dropped on a web form will extend additional functionality to every control on the form.  For instance, the new rounded corners extender (part of the Atlas Control Toolkit) lets you round the edges of your panels to have a more rounded look as opposed to the standard box with sharp corners.

The DragOverlayExtender let’s you make panels movable and can store this information back to a user profile (which is part of the whole new membership security model… I know a lot more about that than I have written)

So my goal tonight was relatively simple (or so I thought).  I wanted to create a drag-able region and:

  • Detect the position of the element on the server via the new TimerControl’s tick event
  • Update a label with this information
  • (optionally) detect when this movable region was on top of another region

Ultimately, while I think drag is cool, what I really want is drag/drop.  So I need to be able to detect if the dragged region is now on top of another drop zone panel. 

So the first attempt ended up with nothing but a form that ticks back to the server and let’s me drag the “Move Me” panel all over the screen.  But, I can’t detect the position.  There’s no place to detect it on the server.

So my next thought was to inherit the DragOverlayExtender.  I was looking for some hidden property; I even went so far as to run it through Reflector to take a look at the source code… It was at this point that I realized the fundamental nature of Atlas components.  Ready?  I know this will come as a big revelation to you.  The server side component of Atlas controls is minimal.  Much of the work is on the client side… Duhhh!

This has lead me to a place where I now think I understand how to really develop an Atlas control.  Play around in the client side first; get your idea working there.  Learn how to build the client side behaviour and then build your server side control to take advantage of these behaviours.  You will save yourself a lot of headaches…

BTW, my investigation has shown me that that while there is currently only a DragOverlayExtender the float behavior (which is what the DragOverlayExtender is built on top of) is most certainly capable of Drag and Drop (complete with Drop Zones!)

When I work out the code (if MS doesn’t beat me first) I’ll post it here.

[tags: Atlas, ASP.Net, Ajax]

Print | posted on Sunday, May 21, 2006 2:43 AM

Feedback

# re: Atlas: Starting to grasp control development...

left by at 8/11/2006 12:46 PM Gravatar

Hi Jay,

Thanks for your insight on the DragOverlayExtender control. I have a quick question. I want to disable a DragOverlayProperties child control programmatically from JavaScript. I assumed that if I am able to get a handle on the DragOverlayExtender object (called DragOverlayExtender1) in JavaScript, then I maybe able to manipulate it's child DragOverlayProperties using the Controls field. So I was trying something like:

<script type="text/javascript">

             function OnClientResizePanel(sender, eventArgs) {

               var doe = $object('DragOverlayExtender1');

               var doe_controls = doe.get_Controls;

               var do_properties = doe_controls[1];

               do_properties.set_Enabled(false);

           }

</script>

This doesn't seem to work. I am stuck mainly because I don't know the Object Model for DragOverlayExtender and which fields it exposes. Can you suggest a way to do this? Will I be better off using FloatingBehavior programmatically as you have shown in another post?

Thanks.

# re: Atlas: Starting to grasp control development...

left by at 8/11/2006 2:20 PM Gravatar

This isn't an extremely quick question, but here's something I think you can potentially do.  The handle you get back is the raw DOM control.  There's a couple ways thatI can think of around this.

1)

var doe_webControl = new sys.ui.control(do_properties);

doe_webControl.set_Enabled(false);

2) create a global reference to your control and just set the global one.

I didn't test either scenario... these are just ideas off the top of my head.

# re: Atlas: Starting to grasp control development...

left by at 8/14/2006 7:56 AM Gravatar

Thanks for your ideas Jay; I'll try them out and let you know what happens.

# re: Atlas: Starting to grasp control development...

left by at 8/18/2006 4:03 AM Gravatar

I found your site whilst looking for a nice drag n drop in Ajax too..

I also found this - http://www.pageflakes.com - The way you can drag / add stuff is fantastic! If only they'd share source.. :/

Title  
Name
Email (never displayed)
Url
Comments   
Please add 7 and 7 and type the answer here: