Jump to content

Input Control with drag and drop


Recommended Posts

I have a Tab Control with two tabs. If both tabs have a Input Control then drag and drop works.

But if one Tab has a Listview Control then the input does not accept drag and drop.

What am I not understanding to get drag and drop to work with Listview or is it not possible.

Using version 31184.

Thanks

#include <GuiConstants.au3>

main_(1)

main_(2)

exit

func main_($cmd)

GuiCreate("Test", 575, 460, -1, -1, -1, $WS_EX_ACCEPTFILES)

$tab = GUICtrlCreateTab(2, 2, 575-3, 460-23, -1)

if $cmd = 1 then

designTabInput_(1)

designTabInput_(2)

else

designTabInput_(1)

designTabListView_( )

endif

GUICtrlCreateTabItem("")

GUISetState( )

while 1

$msg = GUIGetMsg(1)

if $msg[0] = $GUI_EVENT_CLOSE then

GUIDelete( )

exitloop

endif

wend

endfunc

;****** create tab with input ******

func designTabInput_($var)

GUICtrlCreateTabitem(" Input" & $var & " ")

GuiCtrlCreateLabel("Filename :", 35, 174, 65, 20)

$input = GuiCtrlCreateInput("", 105, 170, 400, 20)

GUICtrlSetState(-1, $GUI_ACCEPTFILES)

endfunc

;****** create tab with listview ******

func designTabListView_( )

GUICtrlCreateTabitem(" Listview ")

$listView = GuiCtrlCreateListView("Item|Keycodes", 25, 40, 525, 340) ;$LVS_EX_FULLROWSELECT)

GuiCtrlCreateListViewItem("01|{F2}", $listView)

GuiCtrlCreateListViewItem("02|{F12}", $listView)

endfunc

Link to post
Share on other sites

seems like you are creating tabs with function calls... but the control names are the same

i would suggeat using the $var you are sending to the function as part of the controls actual name

example

;****** create tab with input ******
func designTabInput_($var)
$tab_[$var] = GUICtrlCreateTabitem(" Input" & $var & " ")

$label_[$var] = GuiCtrlCreateLabel("Filename :", 35, 174, 65, 20)
$input_[$var] = GuiCtrlCreateInput("", 105, 170, 400, 20)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
endfunc

these will need to to globalized or

Dim $tab_[2], $Label_[2], $input_[2]

******** and when you post code... use this

[ code ] ; no spaces

; paste code here

[ /code ] ; no spaces

8)

NEWHeader1.png

Link to post
Share on other sites

Valuater,

thanks for the help, but it didn't seem to correct the problem.

#include <GuiConstants.au3>

dim $tab_[4], $label_[4], $input_[4]
global $listView_[4]


main_(1)
main_(2)
exit


func main_($cmd)
  GuiCreate("Test", 575, 460, -1, -1, -1, $WS_EX_ACCEPTFILES)
  $tab_[0] = GUICtrlCreateTab(2, 2, 575-3, 460-23, -1)

  if $cmd = 1 then
    designTabInput_(1)
    designTabInput_(2)
  else
    designTabInput_(1)
    designTabListView_( )
  endif

  GUICtrlCreateTabItem("")
  GUISetState( )


  while 1
    $msg = GUIGetMsg(1)

    if  $msg[0] = $GUI_EVENT_CLOSE  then
      GUIDelete( )
      exitloop
    endif
  wend

endfunc


;******  create tab with input ******
func designTabInput_($var)
  $tab_[$var]   = GUICtrlCreateTabitem("  Input" & $var & "  ")
  $label_[$var] = GuiCtrlCreateLabel("Filename :", 35, 174, 65, 20)
  $input_[$var] = GuiCtrlCreateInput("", 105, 170, 400, 20)
  GUICtrlSetState(-1, $GUI_ACCEPTFILES)
endfunc


;******  create tab with listview ******
func designTabListView_( )
  GUICtrlCreateTabitem("  Listview  ")

  $listView_[0] = GuiCtrlCreateListView("Item|Keycodes", 25, 40, 525, 340)
  $listView_[1] = GuiCtrlCreateListViewItem("01|{F2}", $listView_[0])
  $listView_[2] = GuiCtrlCreateListViewItem("02|{F12}", $listView_[0])
endfunc
Link to post
Share on other sites

this works

#include <GuiConstants.au3>

dim $tab_[4], $label_[4], $input_[4]
global $listView_[4]


;main_(1)
main_(2)
exit


func main_($cmd)
  GuiCreate("Test", 575, 460, -1, -1, -1, $WS_EX_ACCEPTFILES)
  $tab_[0] = GUICtrlCreateTab(2, 2, 575-3, 460-23, -1)

  if $cmd = 1 then
    designTabInput_(1)
    designTabInput_(2)
  else
    designTabInput_(1)
    designTabListView_( )
  endif

  GUICtrlCreateTabItem("")
  GUISetState( )

GUICtrlSetState($input_[1], $GUI_ACCEPTFILES)
  while 1
    $msg = GUIGetMsg(1)

    if  $msg[0] = $GUI_EVENT_CLOSE  then
      GUIDelete( )
      exitloop
    endif
  
  wend

endfunc


;******  create tab with input ******
func designTabInput_($var)
  $tab_[$var]   = GUICtrlCreateTabitem("  Input" & $var & "  ")
  $label_[$var] = GuiCtrlCreateLabel("Filename :", 35, 404, 65, 20)
  $input_[$var] = GuiCtrlCreateInput("", 105, 400, 400, 20, $GUI_ACCEPTFILES)
  GUICtrlSetState(-1, $GUI_ACCEPTFILES)
endfunc


;******  create tab with listview ******
func designTabListView_( )
  GUICtrlCreateTabitem("  Listview  ")

  $listView_[0] = GuiCtrlCreateListView("Item|Keycodes", 25, 40, 525, 340)
  $listView_[1] = GuiCtrlCreateListViewItem("01|{F2}", $listView_[0])
  $listView_[2] = GuiCtrlCreateListViewItem("02|{F12}", $listView_[0])
endfunc

i think it just doesnt like the input being on-top ( even though on a different tab ) of the list view

well... maybe you can work with this

8)

NEWHeader1.png

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...