Drag And Drop in TileList

Hi,
I want to drag and drop an item onto an item of the TileList
control. for example, i have a list of Category image in a TileList
and few items in another TileList, now i need to drag the items and
drop them onto a Category in the Category TileList. how can i do
this...?
Please help me..
Thanks in Advance

Got the answer from Joan Lafferty on the FlexCoders forum:
Use calculateDropIndex(event:DragEvent) that is a function
for a TileList. In will return the index where the item was
dropped.
And that works:
private function myDragDrop(e:DragEvent):void {
var dropIndex:int = tilelist1.calculateDropIndex(e);
Alert.show("dropIndex: " + dropIndex);
Thanks Joan!

Similar Messages

  • Drag and drop images using tilelist in flex

    i just want the working code for drag and drop images using
    tilelist in flex

    Try JDK 1.4 and call setDragEnabled(true)
    I will also post updated version of MediaChest soon using custom TransferHandler for DnD different types of Objects.

  • Drag and Drop and save changes

    I am attempting to make an application that gives users a vast selection of icons that they can drag and drop into their own area which act as links to sites once they are double clicked but when they are clicked a single time they bring up a panel which shows the name of the website, a video about the website, a link to the website and a description of the website.
    Similar to this example except whenever any of the icons are single clicked they will bring up an information panel or link to the relevant site if they are double clicked:-
    http://demo.quietlyscheming.com/DragTile/DragDrop.html
    The drag and drop part is easy but I'm basically wondering what would be the best way to achieve this so that all data required is stored 'within' each icon? i.e. how can you store information such as a title and description within an icon so that it only appears once it is clicked and what would be the best possible component to use for the overall icon 'grid' and the icons themselves?
    This may sound silly but I've only just started using Flex and I'm simply looking for suggestions.

    Thanks my friend that helped me a lot and works well.
    I have another question for you, if I want to allow the users to SAVE the positions of the links they add how would I go about this? What I mean is if a user drags and drops some icons from a tilelist on the right hand side to their own tilelist in their own profile area how will I allow these tiles to still be saved in the same position if the user closes then reopens the application? I want each user to be abler to create their own list of links and then save these for future uses.
    Is there a simple way of achieving this or would it require a vast amount of coding?

  • Drag and drop between two Datagrid

    I have to drag and drop data between two different datagrid but in drop side i have to modify the item.
    How Can I do it?
    Thanks
    A

    Instead of using a DataGrid, you could use a Tile or TileList component.
    DataGrid does not have your desired behavior.
    You could create a custom component that uses states to display data in a DataGrid or Tile/TileList and switch states as appropriate.
    If this post answers your question or helps, please mark it as such. Thanks!
    http://www.chikaradev.com
    Adobe Flex Development and Support Services

  • Drag and Drop, dropping to a parent component.

    I've been searching high and low for a solution to a problem without any success. I'm hoping someone here might have a suggestion.
    I have an application (written using Java 5.0) which allows dragging and dropping custom components between JPanels. My components themselves are JPanels with other components in them such as JTextFields. I've written custom TransferHandlers for my components and all works well. If I drag one of my components and drop it on the receiving panel, it works. If I drag and drop on an existing one of my components, the drop works since the components themselves don't support dropping (the drop is accepted by the parent JPanel).
    My problem occurs when I inadvertently do a drop onto a text component within one of my components. In this case the drop is rejected since the text component doesn't accept my Transferable. What I would like to happen is have the drop passed up to a containing panel that does accept the Transferable.
    I can't disable drop on the text components as I'd like them to still accept string drops.
    Is there another solution that will allow a parent (or more generally an ancestor) of a component to accept a drop rejected by a child component?

    "bmilesp" <[email protected]> wrote in
    message
    news:gnd5c7$jas$[email protected]..
    > hello,
    >
    > I've been searching on how to add drag and drop
    functionality to an hbox.
    > You're probably thinking "just use a tilelist", and
    that's what i'm
    > currently
    > using, but the tilelist cannot align items to the
    center, which is crucial
    > in
    > my application (if you need me to explain further i
    will, but i don't
    > think
    > it's relevant here).
    Sure it can.
    > So i need drag and drop on an Hbox. The repeater is
    necessary because the
    > hbox
    > may need to be populated with items initially, which can
    later be dragged
    > and
    > dropped either in itself (to re-arrange items) or into
    another hbox of
    > this
    > kind. For the past few hours I've been trying to find
    anything that can
    > even
    > hint at this type of functionality (i've been searching
    and experimenting
    > for
    > hours). If anyone can point me in the right direction,
    i'd appreciate it.
    > Thank
    > you very much. -b
    http://www.quilix.com/node/3

  • Tree Component Drag and Drop

    Hi, I've been playing around with a trail version of flex and
    was interested to know if anybody had tried to implement the drag
    and drop functionality of the Tree component to a TileList? After
    much messing about I noticed the format of the Tree data in the
    DragSource was different to that of other lists. I've tried
    overriding the addDragData method to see if I can change the format
    of the data although this seems to cause problems when the Drag
    complete event is triggered. Any ideas or help would be
    appreciated.

    Hey, Thanks for the reply. Yes this appears to work although
    it took a bit of messing around and I still had to override the
    dragCompleteHandler method of the Tree component to get the tree
    view to update. One issue I do have (This appears to be an issue
    with the tree component) is as you drag and drop files across from
    one tree to another, when you remove the last child node the parent
    node which has a folder icon changes to a document icon. Is there a
    way around this?

  • Flex 2:  Drag and Drop

    Hi,
    I need help or maybe I can get some advice. I have a TileList
    that gets populated by buttons. I am using HTTPService as my
    WebService. I have a component called Buttons.mxml, to use as
    itemRenderer for my TileListEx.mxml. Everything is good as far as
    displaying all my buttons onto my TileList. My problem is when
    doing Drag-and-Drop. Right now when I drag a button and drop it in
    to a different spot/location (inside my TileList), it moves the
    other buttons too at the same time. I cannot drop a single button
    onto an exact position without affecting the other buttons. Is
    there a way to when you do a drag and drop, it will drop the item
    onto exact position as to where you wanted to drop it in. I
    attached my sample code, maybe someone can help me and give me some
    advice onto how to fix my problem or maybe can tell me a better
    solution of doing this.
    Buttons.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    horizontalAlign="center" verticalGap="0" horizontalGap="0" >
    <mx:Button label="{data.name}" width="100" height="50"
    textAlign="center" />
    </mx:VBox>
    TileListEx.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns:local="*" layout="absolute" backgroundAlpha="0"
    creationComplete="itemRequest.send()">
    <mx:HTTPService id="itemRequest"
    url="C:/TestFlex/menuitem.xml" useProxy="false" />
    <mx:VBox x="10" y="41" width="1000" height="550">
    <mx:Panel width="575" height="550" layout="absolute"
    id="menuItm" title="Fruits">
    <mx:TileList direction="vertical"
    dataProvider="{itemRequest.lastResult.menuitem.items.item}"
    height="100%" width="100%"
    itemRenderer="Buttons" rowHeight="60" columnWidth="110"
    dragEnabled="true" dropEnabled="true" dragMoveEnabled="true"
    dragEnter="true"/>
    </mx:Panel>
    </mx:VBox>
    </mx:Application>
    My menuitem.mxml
    <?xml version="1.0" encoding="Utf-8" ?>
    <menuitem>
    <items><item><name>Combo Chz
    Burg</name></item>
    <item><name>Burger</name></item>
    <item><name>Cheese
    Burger</name></item>
    <item><name>Bac Chz
    Burger</name></item>
    <item><name>Lumberjack</name></item>
    <item><name>Boomer
    Burger</name></item>
    <item><name></name></item>
    <item><name></name></item>
    <item><name>Double
    Play</name></item>
    <item><name></name></item>
    <item><name>No Roll</name></item>
    <item><name></name></item>
    <item><name>Well Done</name></item>
    <item><name>Rare</name></item>
    <item><name></name></item>
    <item><name></name></item>
    <item><name>Sausage</name></item>
    <item><name>Pulled
    Pork</name></item>
    <item><name>Grilled
    Cheese</name></item>
    <item><name></name></item>
    <item><name>Chicken
    Little</name></item>
    <item><name>King of
    Klubs</name></item>
    <item><name></name></item>
    <item><name></name></item>
    <item><name>Do It To
    It</name></item>
    <item><name>Sub</name></item>
    <item><name></name></item>
    <item><name>Hot Drink</name></item>
    <item><name>Bottle
    Water</name></item>
    <item><name>Soda</name></item>
    <item><name></name></item>
    <item><name></name></item>
    <item><name>Open Food</name></item>
    <item><name>Eat In</name></item>
    <item><name>Take Out</name></item>
    <item><name>Phone
    Order</name></item>
    <item><name>Extra</name></item>
    <item><name>Orange</name></item>
    <item><name></name></item>
    <item><name></name></item></items>
    </menuitem>
    Thank you very much in advance.
    -alfie

    When working with drag and drop, troubleshoot starting with
    the most obvious: Where exactly is the Canvas you're dropping onto
    and how large is it. Give the Canvas a temporary red background
    (myCanvas.setStyle("backgroundColor", "#FF0000")) to see exactly
    where it is on the stage. If you can't see it after you've changed
    the background color, chances are you can't drop anything onto it
    either.
    Glancing over your code I see a couple things:
    1. In DesignCanvas, you don't define the dropTarget variable,
    which is supposed to be a reference to the DesignCanvas.
    private function doDragEnter(event:DragEvent):void
    var dropTarget:Canvas = this;
    DragManager.acceptDragDrop(dropTarget);
    2. Your override of updateDisplayList() doesn't include
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    I'd comment out your complete updateDisplayList() override
    and troubleshoot the drop target first, then you can start adding
    the other functionality and see if it works as you'd like.
    P.S. Just as a best practice, start your classes with
    uppercase and variables and functions lowercase, so DesignCanvas,
    not designCanvas.
    TS

  • Adding drag and drop functionality to a hbox with a repeater?

    hello,
    I've been searching on how to add drag and drop functionality
    to an hbox. You're probably thinking "just use a tilelist", and
    that's what i'm currently using, but the tilelist cannot align
    items to the center, which is crucial in my application (if you
    need me to explain further i will, but i don't think it's relevant
    here).
    So i need drag and drop on an Hbox. The repeater is necessary
    because the hbox may need to be populated with items initially,
    which can later be dragged and dropped either in itself (to
    re-arrange items) or into another hbox of this kind. For the past
    few hours I've been trying to find anything that can even hint at
    this type of functionality (i've been searching and experimenting
    for hours). If anyone can point me in the right direction, i'd
    appreciate it. Thank you very much. -b

    "bmilesp" <[email protected]> wrote in
    message
    news:gnd5c7$jas$[email protected]..
    > hello,
    >
    > I've been searching on how to add drag and drop
    functionality to an hbox.
    > You're probably thinking "just use a tilelist", and
    that's what i'm
    > currently
    > using, but the tilelist cannot align items to the
    center, which is crucial
    > in
    > my application (if you need me to explain further i
    will, but i don't
    > think
    > it's relevant here).
    Sure it can.
    > So i need drag and drop on an Hbox. The repeater is
    necessary because the
    > hbox
    > may need to be populated with items initially, which can
    later be dragged
    > and
    > dropped either in itself (to re-arrange items) or into
    another hbox of
    > this
    > kind. For the past few hours I've been trying to find
    anything that can
    > even
    > hint at this type of functionality (i've been searching
    and experimenting
    > for
    > hours). If anyone can point me in the right direction,
    i'd appreciate it.
    > Thank
    > you very much. -b
    http://www.quilix.com/node/3

  • I want to Sync my iPhone 4 to iTunes however I get an error message from iTunes each time I connect the phone to the PC saying that I should restore to factory settings. Frustrating because it's already annoying enough that I can't drag and drop mp3's!!!

    I have never been so frustrated before in my life with any phone. I find it obnoxious as it is that I cannot simply drag and drop files (especially MP3's) straight from my PC directly into my phone, which I have been used to doing up until now. Everyone who convinced me to get the iPhone has instructed me that my frustration can be fixed by downloading iTunes and syncing it all up via that program (which I have never used before). So, I downloaded the program successfully, however when I connect the iPhone 4 to the PC and iTunes is open, I get an error message that 'iTunes cannot read the content of the iPhone "iPhone" and that I should go to the Preferences tab of the iPhone and select 'restore' to restore this phone to factory settings. First of all, I don't understand why I need to do that. I have already downloaded apps and other important things in the 2 days that I have the phone. I am also scared that it will erase my contacts. This is such a headache. Music is very imporatant to me, but I am getting so frustrated that I don't have freedom over the phone which I thought was supposed to be one of the best out there. I would really appreciate help in this matter. I am sure the phone is great but I am on the verge of taking it back and getting something else.

    Hey joshuafromisr,
    If you resintall iTunes, it should fix the issue. The following document will go over how to remove iTunes fully and then reinstall. Depending on what version of Windows you're running you'll either follow the directions here:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    http://support.apple.com/kb/HT1925
    or here:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923
    Best,
    David

  • When I drag and drop an icon from the address bar to the desktop is does creat the shortcut but will not display the website icon, only the firefox icon, how can I display website icons?

    When I drag and drop a website icon from the Forefox address bar to the desk top, the short cut is created but the icon that appears is the firefox Icon. I want to disply the icon from the website that the short cut refers to. I have checked all I can think of in my computer to no avail.

    You have to assign the favicon yourself to the desktop shortcut (right-click the shortcut: Properties) after you have dragged the link to the desktop.
    You can usually find the favicon in Tools >Page Info > Media and save the icon there.
    Otherwise use the main domain of the website and add favicon.ico (e.g. mozilla.com/favicon.ico ) to display the favicon in a tab and save that image to a folder.

  • Is there any way of dragging and dropping an iCal event showing in week view across to a date in the left sidebar monthly calendar?

    Hi, Im not a frequent forum poster, as most of my questions can be found already answered on them!
    This is a question Ive had for a long time and it amazes me that no-one else seems to ask it. I check at each OS upgrade but its never there...
    Is there any way of dragging and dropping an iCal event showing in week view across to a date in the left sidebar monthly calendar?
    I was able to do this years ago in MS Outlook, and utilized it all the time when I needed to push things back, now I have to open the event and select an new date in the drop-down calendar for each & every event I want to move to a new month at the end of the month.
    If its definitely not possible, how to you ask apple to consider including it - it doesnt seem like a particularly difficult task.
    Thankyou
    Andrew.

    Andrew,
    Is there any way of dragging and dropping an iCal event showing in week view across to a date in the left sidebar monthly calendar?
    No, but you can use cut/paste. Cut (⌘X) the event, then click on the week where you want to move the event, and Paste (⌘V).
    If you have a suggestion for Apple to change that method use: Apple - Mac OS X - Feedback.

  • Why does not drag and drop work?!

    Hello,
    I am trying to implent a drag and drop from a table to an icon representing a trash.
    The drop handler fails in converting the selected rows to a list:
    com.sun.el.MethodExpressionImpl@87d9c00d javax.el.ELException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    Could you help me to understand why? Below are the details.
    This is the af:table:
    <af:table var="row" rowBandingInterval="0" id="t1"
    value="#{bindings.MyView1.collectionModel}"
    rowSelection="multiple"
    columnStretching="last"
    horizontalGridVisible="false"
    verticalGridVisible="false" fetchSize="-1"
    autoHeightRows="6" width="190"
    disableColumnReordering="true">
    <af:column sortable="true" headerText="Entry" id="c1"
    align="start">
    <af:outputText value="#{row.Description}" id="ot1"/>
    </af:column>
    <af:dragSource actions="MOVE" defaultAction="MOVE"
    discriminant="delete"/>
    </af:table>
    This is the drop area:
    <af:image source="Images/empty_trash_32.png" id="i2">
    <af:dropTarget dropListener="#{backingBeanScope.DropHandlerBean.dropHandler}"
    actions="MOVE">
    <af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet"
    discriminant="delete"/>
    </af:dropTarget>
    </af:image>
    This is the failing listener listener (the failing point is bold):
    public DnDAction dropHandler(DropEvent dropEvent) {
    DnDAction dnda = DnDAction.NONE;
    if (dropEvent.getProposedAction() == DnDAction.MOVE) { // delete
    RichTable table = (RichTable)dropEvent.getDragComponent();
    //determine the rows that are dragged over
    Transferable t = dropEvent.getTransferable();
    //when looking for data, use the same discriminator as defined
    //on the drag source
    DataFlavor<RowKeySet> df =
    DataFlavor.getDataFlavor(RowKeySet.class, "delete");
    RowKeySet rks = t.getData(df);
    if (rks == null) {
    return DnDAction.NONE;
    Iterator iter = rks.iterator();
    while (iter.hasNext()) {
    //get next selected row key
    System.out.println(rks.toArray().length); // the number of selected rows is ok
    List key = (List)iter.next(); // here gives: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    //make row current so we can access it
    table.setRowKey(key);
    //the table model represents its row by the ADF binding class,
    //which is JUCtrlHierNodeBinding
    JUCtrlHierNodeBinding rowBinding =
    (JUCtrlHierNodeBinding)table.getRowData();
    Row row = (Row)rowBinding.getRow();
    //delete row;
    row.remove();
    //activate animation
    dnda = DnDAction.MOVE;
    return dnda;
    thanks.

    I did try, I obtained this:
    java.lang.NullPointerException
    Why NullPointerException?
    I don't know if this helps, but consider that the collection model comes from a ViewObject built on three EOs with many fields, although the table only shows one column.
    This is the Iterator in my pageDef:
    <table IterBinding="MyView1Iterator" id="MyView1">
    <AttrNames>
    <Item Value="Cod1"/>
    <Item Value="Cod2"/>
    <Item Value="Cod3"/>
    <Item Value="Cod4"/>
    <Item Value="Description"/>
    <Item Value="Cod5"/>
    </AttrNames>
    </table>
    Any idea?
    I will see the Key content with the debugger.

  • Did my first back up today using external hard drive and time machine now i can't drag and drop

    Hi, i did my first back up today using time machine it all went onto my external hard drive fine. Now i cant drag and drop anyhting. I assume ive cahnged some settings in time machine but cant figure it out what to do can some one help ?
    thanks

    Brandbasher wrote:
    Thanks Pondini but i have closed time machine, removed external hard drive.
    Did you eject it first?
    Now i cant drag and drop anything on my desk top, or mail or any other application. Ive tried moving folders, documents none of it works. Even moving around documents within a folder, it wont let me chnage the position of files.
    That shouldn't be related to Time Machine (especially if the backups aren't mounted).
    What happens when you try those things?  Do you get any messages?  Anything you can post a screenshot of?
    Have you tried a Restart?
    Does it happen in another user account?  (If you don't have one, create one via System Prefs > Users & Groups.)

  • Drag and Drop (re-order) Thumbnails in Organizer

    I am using Photoshop Elements version 5.0.2
    I would like to re-order pictures in an order that will make sense for me in my business. I suppose I can go through each pix and change the time on them, so I can then sort by time stamp.
    Is there an easier way to do this? I was hopeful that I could drag and drop them in Thumbnail view - but I cannot.
    Thank you,
    Jamie

    >Is there anyway to delete the photos in the main well, without losing them from my collection?
    As I understand the design, the main well is intended to be all the photos that you are managing with Photoshop Elements.
    Collections are used to display a specific group of those photos in your chosen sequence for any given activity.
    I suspect that since you are using a consumer product such as Photoshop Elements for your business purpose, you may need to make some compromises like having a default (the main photo well) display sequence which you see first when starting PSE that is not what you would choose.
    This is not bad if PSE does what you want - just additional steps to switch to the Collection view and also to maintain (drag and drop) the sequencing of the collection when you add additional photo files to a Collection.

  • Problems with ListViews Drag and Drop

    I'm surprised that there isn't an Active X control that can do this more
    easily? Would
    be curious to find out if there is - although we aren't really embracing the
    use of
    them within Forte because it locks you into the Microsoft arena.
    ---------------------- Forwarded by Peggy Lynn Adrian/AM/LLY on 02/03/98 01:33
    PM ---------------------------
    "Stokesbary, Michael" <[email protected]> on 02/03/98 12:19:52 PM
    Please respond to "Stokesbary, Michael" <[email protected]>
    To: "'[email protected]'" <[email protected]>
    cc:
    Subject: Problems with ListViews Drag and Drop
    I am just curious as to other people's experiences with the ListView
    widget when elements in it are set to be draggable. In particular, I am
    currently trying to design an interface that looks a lot like Windows
    Explorer where a TreeView resides on the left side of the window and a
    ListView resides on the right side. Upon double clicking on the
    ListView, if the current node that was clicked on was a folder, then the
    TreeView expands this folder and the contents are then displayed in the
    ListView, otherwise, it was a file and it is brought up in Microsoft
    Word. All this works great if I don't have the elements in the ListView
    widget set to be draggable. If they are set to be draggable, then I am
    finding that the DoubleClick event seems to get registered twice along
    with the ObjectDrop event. This is not good because if I double click
    and the current node is a folder, then it will expand this folder in the
    TreeView, display the contents in the ListView, grab the node that is
    now displayed where that node used to be displayed and run the events
    for that as well. What this means, is that if this is a file, then Word
    is just launched and no big deal. Unfortunately, if this happens to be
    another directory, then the previous directory is dropped into this
    current directory and a recursive copy gets performed, giving me one
    heck of a deep directory tree for that folder.
    Has anybody else seen this, or am I the only lucky one to experience.
    If need be, I do have this exported in a .pex file if anybody needs to
    look at it more closely.
    Thanks in advance.
    Michael Stokesbary
    Software Engineer
    GTE Government Systems Corporation
    tel: (650) 966-2975
    e-mail: [email protected]

    here is the required code....
    private static class TreeDragGestureListener implements DragGestureListener {
         public void dragGestureRecognized(DragGestureEvent dragGestureEvent) {
         // Can only drag leafs
         JTree tree = (JTree) dragGestureEvent.getComponent();
         TreePath path = tree.getSelectionPath();
         if (path == null) {
              // Nothing selected, nothing to drag
              System.out.println("Nothing selected - beep");
              tree.getToolkit().beep();
         } else {
              DefaultMutableTreeNode selection = (DefaultMutableTreeNode) path
                   .getLastPathComponent();
              if (selection.isLeaf()) {
              TransferableTreeNode node = new TransferableTreeNode(
                   selection);
              dragGestureEvent.startDrag(DragSource.DefaultCopyDrop,
                   node, new MyDragSourceListener());
              } else {
              System.out.println("Not a leaf - beep");
              tree.getToolkit().beep();
    }

Maybe you are looking for