Topic
  • 3 replies
  • Latest Post - ‏2013-05-27T11:50:20Z by kabr
kabr
kabr
115 Posts

Pinned topic DropEvent

‏2013-05-15T13:35:22Z |

Hi all,

could somebody please give a simple application example for DropEvent?

I cannot search the forum for well known reasons ...

Thanks in advance

Karl

Updated on 2013-05-15T13:35:48Z at 2013-05-15T13:35:48Z by kabr
  • Johnny_P
    Johnny_P
    25 Posts
    ACCEPTED ANSWER

    Re: DropEvent

    ‏2013-05-16T06:45:47Z  

    Hi,

    here is a really quick DropEvent example. Maybe this gets you started...

     

    void cbDropEvent1(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    void cbDropEvent2(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    string sTemp1[] = { "Item1", "Item2", "Item3" }
    string sTemp2[] = { "ItemA", "ItemB", "ItemC" }

    DB dbX = create("DropEvent")
    DBE dbeListView1 = listView(dbX, cbDropEvent1, 0, 250, 5, sTemp1)
    DBE dbeListView2 = listView(dbX, cbDropEvent2, 0, 250, 5, sTemp2)
        
    realize dbX
        
    insertColumn(dbeListView1, 0, "ListView1", 100, iconNone)
    insertColumn(dbeListView2, 0, "ListView2", 100, iconNone)
        
    show dbX

     

    Regards,

    Johnny

  • Johnny_P
    Johnny_P
    25 Posts

    Re: DropEvent

    ‏2013-05-16T06:45:47Z  

    Hi,

    here is a really quick DropEvent example. Maybe this gets you started...

     

    void cbDropEvent1(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    void cbDropEvent2(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    string sTemp1[] = { "Item1", "Item2", "Item3" }
    string sTemp2[] = { "ItemA", "ItemB", "ItemC" }

    DB dbX = create("DropEvent")
    DBE dbeListView1 = listView(dbX, cbDropEvent1, 0, 250, 5, sTemp1)
    DBE dbeListView2 = listView(dbX, cbDropEvent2, 0, 250, 5, sTemp2)
        
    realize dbX
        
    insertColumn(dbeListView1, 0, "ListView1", 100, iconNone)
    insertColumn(dbeListView2, 0, "ListView2", 100, iconNone)
        
    show dbX

     

    Regards,

    Johnny

  • DesHao
    DesHao
    2 Posts

    Re: DropEvent

    ‏2013-05-16T08:12:43Z  
    • Johnny_P
    • ‏2013-05-16T06:45:47Z

    Hi,

    here is a really quick DropEvent example. Maybe this gets you started...

     

    void cbDropEvent1(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    void cbDropEvent2(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    string sTemp1[] = { "Item1", "Item2", "Item3" }
    string sTemp2[] = { "ItemA", "ItemB", "ItemC" }

    DB dbX = create("DropEvent")
    DBE dbeListView1 = listView(dbX, cbDropEvent1, 0, 250, 5, sTemp1)
    DBE dbeListView2 = listView(dbX, cbDropEvent2, 0, 250, 5, sTemp2)
        
    realize dbX
        
    insertColumn(dbeListView1, 0, "ListView1", 100, iconNone)
    insertColumn(dbeListView2, 0, "ListView2", 100, iconNone)
        
    show dbX

     

    Regards,

    Johnny

    Hi Johnny,

    thank you very much for the example. i am also looking for the solution for this topic, i think it is very helpful :)

    Regards

    Hao

  • kabr
    kabr
    115 Posts

    Re: DropEvent

    ‏2013-05-27T11:50:20Z  
    • Johnny_P
    • ‏2013-05-16T06:45:47Z

    Hi,

    here is a really quick DropEvent example. Maybe this gets you started...

     

    void cbDropEvent1(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    void cbDropEvent2(DropEvent de)
    {
        int iSourceIndex = de.sourceIndex
        int iTargetIndex = de.targetIndex
        if (de.source == de.target) { print "Item moved inside the listview (From " iSourceIndex " to " iTargetIndex ")\n" }
        else { print "Item moved to other listview (From " iSourceIndex " to " iTargetIndex ")\n" }
    }

    string sTemp1[] = { "Item1", "Item2", "Item3" }
    string sTemp2[] = { "ItemA", "ItemB", "ItemC" }

    DB dbX = create("DropEvent")
    DBE dbeListView1 = listView(dbX, cbDropEvent1, 0, 250, 5, sTemp1)
    DBE dbeListView2 = listView(dbX, cbDropEvent2, 0, 250, 5, sTemp2)
        
    realize dbX
        
    insertColumn(dbeListView1, 0, "ListView1", 100, iconNone)
    insertColumn(dbeListView2, 0, "ListView2", 100, iconNone)
        
    show dbX

     

    Regards,

    Johnny

    Hi Johnny,

    thanks for the code example.

    that got me started, still with many guesses.

    Karl