Sign in to follow this  
Followers 0
Starky

Multiple list views

11 posts in this topic

#1 ·  Posted (edited)

I seem to be having a bit of trouble creating multiple list views. When I try to read selected data from the second list view, it reads a completely different controlID. I have posted an example below.

Select item 1 in the child list and hit enter to see what I mean. I am working on a workaround for now.

#include <GUIConstants.au3>

HotKeySet("{ENTER}", "ShowInfo")
Func ShowInfo()
    $x = GUICtrlRead($ParentList)
    $y = GUICtrlRead($x)
    $x2 = GUICtrlRead($ChildList)
    $y2 = GUICtrlRead($x2)
    
    MsgBox(0, "List", "Parent List: " & $x & " ~ " & $y & @CRLF & "Child List: " & $x2 & " ~ " & $y2)
    
    $x3 = $ParentListItem1
    $y3 = GUICtrlRead($ParentListItem1)
    $x4 = $ChildListItem1
    $y4 = GUICtrlRead($ChildListItem1)
    MsgBox(0, "Item", "Parent: " & $x3 & " ~ " & $y3 & @CRLF & "Child List: " & $x4 & " ~ " & $y4)
EndFunc

$GUIWidth = 250
$GUIHeight = 250

$ParentWin = GUICreate("Parent GUI", $GUIWidth, $GUIHeight)
$ParentList = GUICtrlCreateListView("1|2|3|4|5", 15, 15, 200, 200, $LVS_NOSORTHEADER)
$ParentListItem1 = GUICtrlCreateListViewItem("P-1-1|P-1-2|P-1-3|P-1-4|P-1-5", $ParentList)
$ParentListItem2 = GUICtrlCreateListViewItem("P-2-1|P-2-2|P-2-3|P-2-4|P-2-5", $ParentList)
GUISetState()

;$ChildWin = GUICreate("Child GUI", $GUIWidth, $GUIHeight)
$ParentWin_Pos = WinGetPos($ParentWin, "")
$ChildWin = GUICreate("Child GUI", $GUIWidth, $GUIHeight, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $ParentWin)
$ChildList = GUICtrlCreateListView("1|2|3|4|5", 15, 15, 200, 200, $LVS_NOSORTHEADER)
$ChildListItem1 = GUICtrlCreateListViewItem("C-1-1|C-1-2|C-1-3|C-1-4|C-1-5", $ChildList)
$ChildListItem2 = GUICtrlCreateListViewItem("C-2-1|C-2-2|C-2-3|C-2-4|C-2-5", $ChildList)
$ChildListItem3 = GUICtrlCreateListViewItem("C-3-1|C-3-2|C-3-3|C-3-4|C-3-5", $ChildList)
GUISetState()

While 1
   $msg = GUIGetMsg(1)
   
   Select
      Case $msg[0] = $GUI_EVENT_CLOSE
         If $msg[1] = $ChildWin Then
            GUISwitch($ChildWin)
            GUIDelete()
         ElseIf $msg[1] = $ParentWin Then
            GUISwitch($ParentWin)
            GUIDelete()
            Exit
         EndIf
   EndSelect
WEnd
Edited by Starky

Share this post


Link to post
Share on other sites



Any ideas?

Share this post


Link to post
Share on other sites

Sigh..

Share this post


Link to post
Share on other sites

I don't understand your completly different ControlID.

The Script is working as expected. ControlID are unique in AutoIT and not in sequence.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

In the first message box, the data selected in the child list view ($ChildList) is not correct data shown with GUICtrlRead(GUICtrlRead($ChildList)).. The second message box shows what I am suppose to get. Here is a screen shot of the first message box and then the second. In the parent list view I have the first item selected. In the child list view I also have the first item selected. Look at the outcomes. The child list view is reading what is in the parent list view. And if you select others in the child list view, it reads not what it is suppose to. I hope this clears up my problem.

http://starky.dnsalias.net/msgbox1.jpg

http://starky.dnsalias.net/msgbox2.jpg

Edited by Starky

Share this post


Link to post
Share on other sites

In the first message box, the data selected in the child list view ($ChildList) is not correct data shown with GUICtrlRead(GUICtrlRead($ChildList)).. The second message box shows what I am suppose to get. Here is a screen shot of the first message box and then the second. In the parent list view I have the first item selected. In the child list view I also have the first item selected. Look at the outcomes. The child list view is reading what is in the parent list view. And if you select others in the child list view, it reads not what it is suppose to. I hope this clears up my problem.

http://starky.dnsalias.net/msgbox1.jpg

http://starky.dnsalias.net/msgbox2.jpg

I was hard to find out that the problem has been corrected in the beta. Your problem occurs with the Official release it has been fix with the March 10 beta

Share this post


Link to post
Share on other sites

Ahh awesome. When will it be released or is it available to the public now?

Share this post


Link to post
Share on other sites

Ahh awesome. When will it be released or is it available to the public now?

The Beta is stable. For the official release I cannot answer, JON is the only one which decide. ;)

Share this post


Link to post
Share on other sites
;) I will leave the second list out for now. Thanks for all your help, jpm.

Share this post


Link to post
Share on other sites

;) I will leave the second list out for now. Thanks for all your help, jpm.

why not just switch to the beta? the beta is stable (and any bugs that ARE found are very quickly fixed), and offers alot of functionality that was/is not available in the "stable" release. then you could have your solution exactly the way that you want it, rather than having to re-work it waiting on an official release.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

I never really liked getting beta programs all too much, but I suppose I could give it a look.

Share this post


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
Sign in to follow this  
Followers 0