Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

OnDrop returning wrong value for ItemParent

Code for OnDrop

OnDrop:
Transfer Param1 to SourceCtrl
Transfer Param2 to DragItems
Transfer Param3 to DestItem
Transfer Param4 to Action
Transfer Param5 to Shift
Transfer Param6 to Ctrl

DragKey=DragItems<1,1>
ParentKey=Get_Property(SourceCtrl,"OLE.ItemParent[":DragKey:"]")
debug
etc

Variable DragKey = c*WIN-061-WAML^1*CIV-0351D

Variable ParentKey =
c*GEN-100-CCDE*PP

It should be = c*WIN-061-WAML^1*CIV

Seems the drop key parent is being returned.
I am dragging/dropping within the same control.

Please advise if you get the same and if so, possible fix.

Colin

Comments

  • Colin,

    Are you using the AutoProp property or are you using a method to actually facilitate the adding/moving of the item?
  • I am using a mixture, AutoDrop is set to 1, which performs OK.

    Call Set_Property(CurrCtrl,"OLE.AutoDrop",1)
    Call Set_Property(CurrCtrl,"OLE.DragEnabled",1)
    Call Set_Property(CurrCtrl,"OLE.DropCondition","")
    Call Set_Property(CurrCtrl,"OLE.DropBehavior","A")
    Call Set_Property(CurrCtrl,"OLE.DropSources",StandCtrl:@FM:FromCtrl:@FM:CurrCtrl)

    I then need to check if it has been dropped on the same level as its parent, or one higher, as both are allowed by the condition.
    I am then adding a child to the parent and move the item to this.
    But... not getting that far as the Parent was wrong.
    Hope that helps, let me know if anything further needed.

    Colin
  • Colin,

    I don't quite understand what you are expecting the Parent Key to be. I mean, I see the literal Parent Key you typed in, but that is meaningless to me. What I need to know is this: are you expecting the ItemParent property to return the original Parent Key for the item being dropped or the new Parent Key after the item has been moved?
  • Don

    I will send an EMail with screen shots.
    Basically getting the ParentKey from the same ItemKey on the OnDragStart is different to what it is in the OnDrop.

    Colin
  • Colin,

    We had a short work week due to the holidays and we had some staff traveling on holiday, so there hasn't been much opportunity to look into this further. I have your email and sent a quick response. It is likely you won't get a definitive response until tomorrow or later as it is still the weekend for us and I'm usually the only one who checks on things like this after hours.
  • Guys

    Seems I made a boo boo.
    I had it in my mind that the Parent was the 'original' parent of the item being dragged, not the new parent of the item where it was being dropped.

    Apologies to all.
    Rule #1 ; check your code and brain first!!

    I still need to get the Parent of the original item, but I will grab this during OnDragStart, stick it in common, and use it in the OnDrop.


    Colin
Sign In or Register to comment.