Jump to content



Photo

Set Drag & Drop items for your ListBox'es


  • Please log in to reply
8 replies to this topic

#1 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,244 posts

Posted 05 October 2008 - 01:05 PM

Hi,

This script was inspired by the example of PaulIA here.

I made it easy to set dragable items for specific ListBox control, you can unset them to :idea:

Here is an example:

AutoIt         
#include <GuiConstantsEx.au3> #include <DragList_UDF.au3> $hGUI = GUICreate("_DragList_... Demo", 400, 200) $nList1 = GUICtrlCreateList("", 20, 10, 160, 140, $WS_BORDER+$WS_VSCROLL) GUICtrlSetData($nList1, "Hi,|How|Are|You?") $nList2 = GUICtrlCreateList("", 220, 10, 160, 140, $WS_BORDER+$WS_VSCROLL) GUICtrlSetData($nList2, "AutoIt|Is|The|Best!") $SetList1_CheckBox = GUICtrlCreateCheckBox("Set List 1", 60, 160, 70, 20) $SetList2_CheckBox = GUICtrlCreateCheckBox("Set List 2", 260, 160, 70, 20) GUISetState(@SW_SHOW) While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit         Case $SetList1_CheckBox             If GUICtrlRead($SetList1_CheckBox) = $GUI_CHECKED Then                 _DragList_SetList($nList1, $hGUI)             Else                 _DragList_SetList($nList1)             EndIf         Case $SetList2_CheckBox             If GUICtrlRead($SetList2_CheckBox) = $GUI_CHECKED Then                 _DragList_SetList($nList2, $hGUI)             Else                 _DragList_SetList($nList2)             EndIf     EndSwitch Wend


Just set the checkboxes, and try to drag the items :(.

This example + DragList_UDF.au3 (functions and the main handler) attached as zip file:
Attached File  _DragList_UDF.zip   2.22KB   553 downloads

Enjoy! :P

Edited by MrCreatoR, 05 October 2008 - 01:21 PM.

  • xeroTechnologiesLLC likes this
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team








#2 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,502 posts

Posted 05 October 2008 - 01:52 PM

Yeah, very good example. I like that arrow :P . Good work MrCreatoR.
When the words fail... music speaks

#3 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 05 October 2008 - 02:53 PM

Good job!!..
works fine.

#4 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 12 January 2009 - 07:15 AM

Exactly what I was looking for. As always thank you :)
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#5 ken82m

ken82m

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 623 posts

Posted 12 January 2009 - 07:27 AM

is it possible to select lets say a group of 5 items and move them all at once?
My ContributionsPC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs ScriptIT Help Desk and System Information ToolSet On Lid Close Power Option - Streaming Media Server & Website”I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains.”

#6 xeroTechnologiesLLC

xeroTechnologiesLLC

    Prodigy

  • Active Members
  • PipPipPip
  • 158 posts

Posted 11 April 2012 - 06:13 PM

Masterful - very well done.

#7 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 7,053 posts

Posted 11 April 2012 - 06:15 PM

You shouldn't be commenting on every ancient topic that helps you. Necroposting is a big no-no.

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#8 Spenhouet

Spenhouet

    Seeker

  • Active Members
  • 37 posts

Posted 05 June 2012 - 08:29 AM

Does this work with ListView? When i use it...my list is frozen...

#9 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,744 posts

Posted 05 June 2012 - 08:40 AM

Spenhouet,

No, this UDF deals with ListBoxes - ListViews are a very different beast. If you want to drag items within a ListView, take a look at the GUIListViewEx UDF in my sig. ;)

M23
  • Spenhouet likes this
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
RecFileListToArray- An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users