Jump to content

Search the Community

Showing results for tags 'artifact'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I'm trying to put together a gui to be able to drag an item from one listview into another. I've found some very nice examples on the forum. However, I'm having a bit of an issue. When I drag an item from either of the listview controls to the other, artifacts appear from the child gui that appears when dragging. The funny thing is that the artifacts only appear when dragging upward! There's got to be something I'm missing here. I've been looking at the code from both of these links to try to figure something out. For the example of what I'm talking about, the code from JonnyThunder from the top link with the fancy drag gui from ReFran in the bottom link is below. They did some really great work and my combining the code is just lacking something that I can't figure out. I've attached a pic of what I'm witnessing. How can I eliminate these artifacts? Here's the code that I'm working with: ; Includes first! Must must must! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> ; Switch on the 'onEvent' notifications Opt("GUIOnEventMode", 1) Opt("PixelCoordMode", 2) ; Generate the GUI! Ahoy there. Global $gw = 16 Global $gh = 16 Global $Startx, $Starty, $Endx, $Endy, $aM_Mask, $aMask, $nc Global $MainForm, $list_source, $list_target, $drag_gui $MainForm = GUICreate(" TEST! ", 517, 178) ; Source list box $list_source = GUICtrlCreateListView("Title|Details", 13, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Target list box $list_target = GUICtrlCreateListView("Title|Details", 261, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Populate box with some test stuff For $x = 1 To 6 GUICtrlCreateListViewItem( _makeJunkName() & "|" & _makeJunkName(), $list_source) Next GUISetState(@SW_SHOW, $MainForm) ; Handle GUI events GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_dragHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "_formEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_formEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "_formEvents") $position = WinGetPos($MainForm) $client = WinGetClientSize($MainForm) $light_border = ($position[2] - $client[0]) / 2 $thick_border = $position[3] - $client[1] - $light_border $x_coord = $position[0] + $light_border $y_coord = $position[1] + $thick_border $drag_gui = GUICreate("Drag", $gw, $gh, $x_coord, $y_coord, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $MainForm) $cursor_icon = GUICtrlCreateIcon("Shell32.dll", -147, 0, 0, 16, 16) GUISetState(@SW_SHOW, $drag_gui) setTrans() GUISetState(@SW_HIDE, $drag_gui) ; Main program loop While 1 ; Don't really do much in here at all... Sleep(10) WEnd ; Create a junk name for testing Func _makeJunkName() Local $labelout = '' For $i = 1 To 10 $labelout &= Chr(Random(65, 90, 1)) Next Return $labelout EndFunc ;==>_makeJunkName ; Function to handle drag and drop Func _dragHandler() ; Define some stuff Local $source, $desc Local $cinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) Local $direction = 0 ; Check we are dragging from one or the other boxes If $cinfo[4] = $list_source Or $cinfo[4] = $list_target Then ; Are we moving from source to destination If $cinfo[4] = $list_source Then $direction = 1 EndIf ; Or are we moving from destination to source If $cinfo[4] = $list_target Then $direction = 2 EndIf ; Doublecheck we're pressing mouse button If _IsPressed(1) Then If $direction = 1 Then $selecteditems = _GUICtrlListView_GetSelectedCount($list_source) $idx = _GUICtrlListView_GetSelectedIndices($list_source, False) $item_txt = _GUICtrlListView_GetItemText($list_source, Int($idx)) Else $selecteditems = _GUICtrlListView_GetSelectedCount($list_target) $idx = _GUICtrlListView_GetSelectedIndices($list_target, False) $item_txt = _GUICtrlListView_GetItemText($list_target, Int($idx)) EndIf ; Check we actually have selected an item If $selecteditems >= 1 Then ; Wait for keypress! _WinAPI_ShowCursor(False) GUISetState(@SW_SHOW, $drag_gui) While _IsPressed(1) chase($item_txt) WEnd GUISetState(@SW_HIDE, $drag_gui) _WinAPI_ShowCursor(True) ToolTip("") ; Get new position Local $newcinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) ; If we were moving from source to destination and we ARE in the destination box If $direction = 1 And $newcinfo[4] = $list_target Then ConsoleWrite("Moved " & $selecteditems & " items from source to destination" & @CRLF) _GUICtrlListView_CopyItems(GUICtrlGetHandle($list_source), $list_target, 1) EndIf ; If we are moving from destination to source and we ARE in source box If $direction = 2 And $newcinfo[4] = $list_source Then ConsoleWrite("Moved " & $selecteditems & " items from destination to source" & @CRLF) _GUICtrlListView_CopyItems(GUICtrlGetHandle($list_target), $list_source, 1) EndIf EndIf EndIf EndIf EndFunc ;==>_dragHandler ; Function to handle other form events Func _formEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc ;==>_formEvents Func chase($moving_txt) $mp = MouseGetPos() WinMove($drag_gui, "", $mp[0] + 1, $mp[1] + 0) ToolTip($moving_txt, $mp[0] + 18, $mp[1]) EndFunc ;==>chase Func setTrans() $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0]) $TestCol = PixelGetColor(0, 0) $Startx = -1 $Starty = -1 $Endx = 0 $Endy = 0 For $i = 0 To $gw For $j = 0 To $gh If PixelGetColor($i, $j) = $TestCol And $j < $gh Then If $Startx = -1 Then $Startx = $i $Starty = $j $Endx = $i $Endy = $j Else $Endx = $i $Endy = $j EndIf Else If $Startx <> -1 Then addRegion() $Startx = -1 $Starty = -1 EndIf Next Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $drag_gui, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion() $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $Startx, "long", $Starty, "long", $Endx + 1, "long", $Endy + 1) $nc += 1 DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegionArtifacts.bmp
×
×
  • Create New...