qwert Posted March 11, 2018 Share Posted March 11, 2018 Based on methods outlined in these forums, a ListView item can be dragged to another control ... and seems to be the easiest way to drag and drop content. (Below is a working example.) But I've run upon two problems: 1. The orange arrow points to a "bar" character that is appended to the file name when I drag to a control on the same window. What is causing that? 2. Any other application window (even one of my own) rejects the drop of the ListView item (sounds a "ding"). Yet, my own (other) GUI can accept a file from a file manager, for example ... as can this example GUI. What determines a window's "drag enabled" status? (i.e., as a source of files) Thanks in advance to anyone who can point me to examples or explanations. #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $hGUI = GUICreate("Move Input Anywhere Example", 400, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $hInput = GUICtrlCreateInput("C:\Temp\RichNote.rtf", 10, 120, 320, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $ListView = GUICtrlCreateListView("", 20, 20, 360, 80) GUICtrlSetFont(-1, 11, 400, 0, "Tahoma") _GUICtrlListView_AddColumn($ListView, "File Link:", 340) GUICtrlCreateListViewItem("C:\Temp\RichNote.rtf", $ListView) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
corz Posted April 14, 2018 Share Posted April 14, 2018 That bar, it flashes and is called the "caret". It's everywhere you type text. Seriously? As for No. 2, no idea. Got an example? ;o) Cor nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
qwert Posted June 9, 2018 Author Share Posted June 9, 2018 Sorry for the late response. I've been working on quite a few other things. Regarding the bar: it's really a bar character, not a blinking caret cursor. If I Ctrl+C copy the contents, there's actually a bar character at the end. And my second question still stands, as well. Both of these issues are unexpected hurdles to smooth GUI operation. I don't mind adhering to rules, but what/where ARE the rules? Link to comment Share on other sites More sharing options...
Subz Posted June 13, 2018 Share Posted June 13, 2018 Is a pipe to separate the columns, so try the following this gets around the issue by replacing the text prior to being dropped: #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Move Input Anywhere Example", 400, 140, -1, -1, -1, $WS_EX_ACCEPTFILES) $idListView = GUICtrlCreateListView("FileLink:", 10, 10, 380, 80, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) GUICtrlCreateListViewItem("C:\Temp\RichNote.rtf", $idListView) _GUICtrlListView_SetColumnWidth($idListView, 0, $LVSCW_AUTOSIZE_USEHEADER) GUICtrlSetFont(-1, 11, 400, 0, "Tahoma") $idInput = GUICtrlCreateInput("", 10, 100, 380, 20) GUICtrlSetState($idInput, $GUI_DROPACCEPTED) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED If @GUI_DropId = $idInput Then GuiCtrlSetData($idInput, StringReplace(GUICtrlRead($idInput), "|", "") ) EndIf EndSwitch WEnd This has been discussed previously in other posts, its something to do with Handling OLE DragDrop Events (see link below). nb: You can actually drag and drop from RichEdit boxes externally. Link to comment Share on other sites More sharing options...
qwert Posted June 13, 2018 Author Share Posted June 13, 2018 @Subz, thanks for looking at this. That's a good solution ... and the UDF is something I'll explore. Rich edits open a large set of capabilities for a GUI. It's nice to get some of these secondary issues under control. I appreciate your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now