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

Drag/Drop

I want to drag from an external source, intercept the data and deal with it.
I tried this with a basic OI editline control, and it works, but there is some grief that it is giving me.
I want to show some text and when the user moves the mouse over it, to clear the text.
This sort of works as long as the user is nice, but do silly things like wave about and hover and it dies.

Due to the issues, I am considering an SRP control.
Any thoughts as to which control would best suit this activity.

Thanks

Colin

Comments

  • edited March 2017
    What is the nature of the data coming from the external source? Is it pure text, a file, a structure? Is the text appearing in the OI edit line control the data being dragged/dropped or is it just data your code will generate?
  • It is pure text, multiple lines tab delimited.
    The text does appear in the edit line, but is captured immediately and cleared.
    I don't need to see it at all, as long as I can capture it
  • I don't think we have a way to support drag-n-drop of text data, at least from an external source.

    Maybe we can help resolve the grief issues you are getting. When you say "it dies", are you saying OI crashes? Can you elaborate more on what doesn't work?
  • Thanks for the info, I will pursue with OI then if an SRP control cant handle.. I just have more faith in SRP controls :)
    The editline control just seems to loop/stop and I have to kill OI off, I cant even get to the Oengine to debug.
    I can see the Oengine processing.
    I have added a Common, with an increment to a variable to debug on 100 and this kicks in after a few seconds of hovering and waving about in and out. Sometimes it works fine, sometimes it dies on a simple move and drop.

    I think my problem is not really knowing the best solution.
    I have a CHANGED event to trigger the pick up of the dropped data, and a clear on DRAGOVER.
    Maybe there is a better way, I will play, but any help most welcome.

    I might remove the text entirely and leave the control blank, and add a label above saying 'Drop stuff below' but it is not as professional. I actually want to drop on an edit table, but as its an extremely complex table, things like poschanged when you hover puts stuff in cells as you would if you were using arrow keys etc, so I opted for a control nearby. The data being dropped is nothing like the data going into the table, hence I have to interpret and call a dialog to associate the data in the drop text to real life info in my application.

    Colin
  • I'm still trying to understand when the problem occurs. It seems clear to me that you are trying to do two things: 1.) drop text into a control, and 2.) clear the text once the user moves the mouse.

    If you ignore the functionality of #2, does dropping the text into the control work all the time and without any grief? How are you trapping the "hovering and waving about"? Are you using the WINMSG event? Which WinAPI message did you qualify?
  • Perhaps use SRP Subclass control to put a prompt into the edit line? Prompts are separate from the control's text, so you wouldn't have to use the CHANGED event.
  • Serves me right for trying to read posts after midnight when I am tired. I see now that the text in the control is for instructional purposes. I kept thinking all along that the text you wanted to appear was the text you were dropping in. Now this makes more sense and I understand why you were trying to trap the mouse movement at the same time the user is dragging data into the control. I can see why this might have been a challenge.

    Kevin's suggestion of using the prompt property of the SRP Subclass control is excellent.
  • To piggy-back on Don and Kevin's responses, here is an image of the sub-class prompt in action (the word "File" in the editline):



    This also shows another neat way to provide additional help/information. Kevin used a combination of the SRP picture control (the small blue "i" circle), and the SRP popup control (the box with the text in it). Users float over the "i" and the additional information pops up - then disappears when the mouse floats off the circle.
  • Wondering if the new tree control that will accept drag n drop emails may also support text data?

    Is this still happening?
    Is it on the backburner?
    Has it been shelved?
    Am I being annoying yet?
  • The subclass prompt is good, and I will use that.
    It does not resolve the hanging, but it does make it easier.
    What seems to be the issue is that there is no event trigger like OnDrop or way to get the drop text, so I need to let it be picked up from the editline control.

    Even if the control is read only it still changes the content of the text inside the box
    Still experimenting with options.

  • Colin,
    I haven't used the drag n drop in OI so effectively speaking without knowing here but when does the "DRAGDROP" event fire? Does that happen when the text is dropped into the editline?

    I've too often found myself in loops when relying on the changed event and am wondering if the clearing of the control also triggers the changed event especially if you're then populating it with some other text?
    In other words I'm picturing a sequence like this:
    (before the prompt suggestion mind you)
    You have text in the control.
    The dragover clears the text, changing the control (changed event logic)
    The text gets dropped, changing the control (changed event logic)
    The user dragsover six times because their careless with the mouse and they're a user (clear the control, re-add your default text each time therefore firing the changed event)

    Is the DRAGDROP the OnDrop you're looking for thereby allowing you to trap the data and clear the control and removing any changed or dragover logic?

    As I'm typing this it is emphasising to me Kevin's suggestion of using the Prompt to avoid the changed event altogether.
  • YEs, this seems to be the case. I am now using the Subclass prompt event to put the prompt there, and this is all good, does not interact at all with the drop.

    The issue certainly seems to be the changed event, but I have added another check to say if the control text property contains data, deal with the dropped text and clear the text property. Then if the text property is null, do not clear the text property, which seems strange, but changing a property from null to null seems to trigger the changed event, so this seems to avoid this.

    But, still having an issue, so might be more complex.
    Arghh!
  • Consider using the BLOCK_EVENTS property to control the firing of errant and grief-producing CHANGED events.
  • Thanks for the help people, I think I have resolved.
    There may have been several issues here, some like when I drag past other controls on the way to my drop control, it triggers mouse events. I resolved this by just qualifying the events used in the code.
    Another possible influence was some code causing Gotfocus or lost focus on another control, which I disabled, as the hover for the drop causes the drop control to gain focus (ie trigger lostfocus on the other control).
Sign In or Register to comment.