Jump to content

Listbox


Recommended Posts

Remove your GUICtrlCreateListViewItem and replace _GUICtrlListGetText() with:

GUICtrlCreateListViewItem(_GUICtrlListGetText($Listbox, $u_count), $sListview)

But I'm sure you're going to want to do something with what's in the listview afterwards, so on to the "next" question, "How do I put what is selected in the ListView into a variable for use"...

Now if you seriously ask that question... You need to stick your nose in the Help file until you can achieve some of the medial things that the help file (if actually read and comprehended) would provide for you.

Ok it didn't put the items from the listbox into my listview, but it did put two -1's in my listview. Why did it do that?
Link to comment
Share on other sites

Remove your GUICtrlCreateListViewItem and replace _GUICtrlListGetText() with:

GUICtrlCreateListViewItem(_GUICtrlListGetText($Listbox, $u_count), $sListview)

But I'm sure you're going to want to do something with what's in the listview afterwards, so on to the "next" question, "How do I put what is selected in the ListView into a variable for use"...

Now if you seriously ask that question... You need to stick your nose in the Help file until you can achieve some of the medial things that the help file (if actually read and comprehended) would provide for you.

Ok it didn't put the items from the listbox into my listview, but it did put two -1's in my listview. Why did it do that?
Link to comment
Share on other sites

  • Moderators

Ok it didn't put the items from the listbox into my listview, but it did put two -1's in my listview. Why did it do that?

Again... you'd be amazed at what you found in the help file.

If it's putting -1, my first assumption would be .... Hmmm - _GUICtrlListGetText($Listbox, $u_count) is where I'm getting my value, so then I would open up my help file and look at _GUICtrlListGetText() to see what it actually says it will return for "Success" and "Failure".

Now if I did something so silly as look in the help file, rather than annoy the hell out of everyone on the forum because I'm too lazy too... I'd probably find:

The return value is the item string

If $i_index does not specify a valid index, the return value is $LB_ERR.

Then I'd probably look through the constants in my Program Files\AutoIt3\Include\ListBoxConstants.au3, and I'd quickly find the value for $LB_ERR which is -1, and now I'd have a place to concentrate on. :)^_^

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Again... you'd be amazed at what you found in the help file.

If it's putting -1, my first assumption would be .... Hmmm - _GUICtrlListGetText($Listbox, $u_count) is where I'm getting my value, so then I would open up my help file and look at _GUICtrlListGetText() to see what it actually says it will return for "Success" and "Failure".

Now if I did something so silly as look in the help file, rather than annoy the hell out of everyone on the forum because I'm too lazy too... I'd probably find:

Then I'd probably look through the constants in my Program Files\AutoIt3\Include\ListBoxConstants.au3, and I'd quickly find the value for $LB_ERR which is -1, and now I'd have a place to concentrate on. :)^_^

How would I get a valid index. I used $Listbox in _GUICtrlListCount() and its the variable for the window that contains the listbox.

my code is $Listbox = ControlGetHandle("Find Player", "", 259)

Link to comment
Share on other sites

  • Moderators

How would I get a valid index. I used $Listbox in _GUICtrlListCount() and its the variable for the window that contains the listbox.

my code is $Listbox = ControlGetHandle("Find Player", "", 259)

1. You're using an old version of AutoIt, but you've been told this under your other name before (and after a month, I can't believe you still don't have it).

2. Because you are using an older version of autoit, those GUI Functions you are using are for AutoIt GUI controls only.

Case in point

$Listbox = ControlGetHandle("Find Player", "", 259)
$i_count = _GUICtrlListCount($Listbox)
MsgBox(0, 0, $i_count)
I'd bet anything, you get -1 there.

Don't ask what you should use... just download the newest version and start over.... End of discussion until you can post a question that you actually showed to the forum you put an effort in trying to understand rather than having someone do the work for you.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

1. You're using an old version of AutoIt, but you've been told this under your other name before (and after a month, I can't believe you still don't have it).

2. Because you are using an older version of autoit, those GUI Functions you are using are for AutoIt GUI controls only.

Case in point

$Listbox = ControlGetHandle("Find Player", "", 259)
$i_count = _GUICtrlListCount($Listbox)
MsgBox(0, 0, $i_count)
I'd bet anything, you get -1 there.

Don't ask what you should use... just download the newest version and start over.... End of discussion until you can post a question that you actually showed to the forum you put an effort in trying to understand rather than having someone do the work for you.

My script is too big to start over.
Link to comment
Share on other sites

  • Moderators

I warned you about bumping this thread within a 24 hour period.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...