Jump to content

List view works great, even when I change tabs.


Gene
 Share

Recommended Posts

This is in a people tracking program. TAB 0 is the contact info. The others cover personal life details. The listview (LV) is on TAB 0, it displays the record with the focus and the 8 adjacent records on either side of it, 17 all together. Works great. Problem is, when another TAB is clicked, it paints and is immediately partially obscured by the LV. Graphic below.

I've tried Setting the state disabled and/or hide, I even tried deleting the list view.

Suggestions are welcome.

Some code snippets....

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->     
       
   
           $tTabGroupClick = GUICtrlRead($tTabGroup)
           Select
                   Case $tTabGroupClick = 0
                       _Lv_Show()
                       GUICtrlSetState($sT0SerchName, $GUI_FOCUS)
                   _DisplayRec()
                   Case $tTabGroupClick = 1
                       _Lv_Show()
                   GUICtrlSetState($sT1SerchName, $GUI_FOCUS)
                       _DisplayRec()
       
      ;=====================================
       
       Func _Lv_Show()
           
           If $tTabGroupClick = 0 Then
               GUICtrlSetState($sT0SerchResult, $GUI_ENABLE + $GUI_SHOW)
               $k = 0 
               Return 0
           Else
               GUICtrlSetState($sT0SerchResult, $GUI_DISABLE + $GUI_Hide )
               $k = 1
               Return 1
           EndIf
       EndFunc  ;==>_Lv_Show
      ;===========================================
       
       Func _DispLview()
       
           If $tTabGroupClick = 0 Then
               Local $sT0SerchResult = GUICtrlCreateListView("L. Name|F. Name|Initial|Address|City|State|Zip", 340, 70, 351, 306, $LVS_SORTASCENDING,$LVS_SHOWSELALWAYS)
               GUICtrlSetState($sT0SerchResult, $GUI_ENABLE + $GUI_SHOW)
           Else
               GUICtrlDelete ( $sT0SerchResult )
               _DisplayRec()
           EndIf
       
           
               If $RecNmbr - 8 > -1 Then
                   $aLVRecs17 = StringSplit($aAtData[$RecNmbr - 8], "|")
                   $aLVitems[17] = $aLVRecs17[1] & "|" & $aLVRecs17[2] & "|" & $aLVRecs17[3] & "|" & $aLVRecs17[6] & "|" & $aLVRecs17[8] & "|" & $aLVRecs17[9]
                   $sT0SerchResult_17 = GUICtrlCreateListViewItem($aLVitems[17], $sT0SerchResult)
               EndIf
               If $RecNmbr - 7 > -1 Then
                   $aLVRecs16 = StringSplit($aAtData[$RecNmbr - 7], "|")
                   $aLVitems[16] = $aLVRecs16[1] & "|" & $aLVRecs16[2] & "|" & $aLVRecs16[3] & "|" & $aLVRecs16[6] & "|" & $aLVRecs16[8] & "|" & $aLVRecs16[9]
                   $sT0SerchResult_16 = GUICtrlCreateListViewItem($aLVitems[16], $sT0SerchResult)
               EndIf
               If $RecNmbr - 6 > -1 Then
                   $aLVRecs1 = StringSplit($aAtData[$RecNmbr - 6], "|")
                   $aLVitems[1] = $aLVRecs1[1] & "|" & $aLVRecs1[2] & "|" & $aLVRecs1[3] & "|" & $aLVRecs1[6] & "|" & $aLVRecs1[8] & "|" & $aLVRecs1[9]
                   $sT0SerchResult_1 = GUICtrlCreateListViewItem($aLVitems[1], $sT0SerchResult)
               EndIf
               If $RecNmbr - 5 > -1 Then
                   $aLVRecs2 = StringSplit($aAtData[$RecNmbr - 5], "|")
                   $aLVitems[2] = $aLVRecs2[1] & "|" & $aLVRecs2[2] & "|" & $aLVRecs2[3] & "|" & $aLVRecs2[6] & "|" & $aLVRecs2[8] & "|" & $aLVRecs2[9]
                   $sT0SerchResult_2 = GUICtrlCreateListViewItem($aLVitems[2], $sT0SerchResult)
               EndIf
               If $RecNmbr - 4 > -1 Then
                   $aLVRecs3 = StringSplit($aAtData[$RecNmbr - 4], "|")
                   $aLVitems[3] = $aLVRecs3[1] & "|" & $aLVRecs3[2] & "|" & $aLVRecs3[3] & "|" & $aLVRecs3[6] & "|" & $aLVRecs3[8] & "|" & $aLVRecs3[9]
                   $sT0SerchResult_3 = GUICtrlCreateListViewItem($aLVitems[3], $sT0SerchResult)
               EndIf
               If $RecNmbr - 3 > -1 Then
                   $aLVRecs4 = StringSplit($aAtData[$RecNmbr - 3], "|")
                   $aLVitems[4] = $aLVRecs4[1] & "|" & $aLVRecs4[2] & "|" & $aLVRecs4[3] & "|" & $aLVRecs4[6] & "|" & $aLVRecs4[8] & "|" & $aLVRecs4[9]
                   $sT0SerchResult_4 = GUICtrlCreateListViewItem($aLVitems[4], $sT0SerchResult)
               EndIf
               If $RecNmbr - 2 > -1 Then
                   $aLVRecs5 = StringSplit($aAtData[$RecNmbr - 2], "|")
                   $aLVitems[5] = $aLVRecs5[1] & "|" & $aLVRecs5[2] & "|" & $aLVRecs5[3] & "|" & $aLVRecs5[6] & "|" & $aLVRecs5[8] & "|" & $aLVRecs5[9]
                   $sT0SerchResult_5 = GUICtrlCreateListViewItem($aLVitems[5], $sT0SerchResult)
               EndIf
               If $RecNmbr - 1 > -1 Then
                   $aLVRecs6 = StringSplit($aAtData[$RecNmbr - 1], "|")
                   $aLVitems[6] = $aLVRecs6[1] & "|" & $aLVRecs6[2] & "|" & $aLVRecs6[3] & "|" & $aLVRecs6[6] & "|" & $aLVRecs6[8] & "|" & $aLVRecs6[9]
                   $sT0SerchResult_6 = GUICtrlCreateListViewItem($aLVitems[6], $sT0SerchResult)
               EndIf
       
               $aLVRecs7 = StringSplit($aAtData[$RecNmbr], "|")
               $aLVitems[7] = $aLVRecs7[1] & "|" & $aLVRecs7[2] & "|" & $aLVRecs7[3] & "|" & $aLVRecs7[6] & "|" & $aLVRecs7[8] & "|" & $aLVRecs7[9]
               $sT0SerchResult_7 = GUICtrlCreateListViewItem($aLVitems[7], $sT0SerchResult)
               GUICtrlSetColor ( -1, 0xff0000)
               GUICtrlSetBkColor(-1,0x00ff00)
   
               If $RecNmbr + 1 < UBound($aAtData) Then
                   $aLVRecs8 = StringSplit($aAtData[$RecNmbr + 1], "|")
                   $aLVitems[8] = $aLVRecs8[1] & "|" & $aLVRecs8[2] & "|" & $aLVRecs8[3] & "|" & $aLVRecs8[6] & "|" & $aLVRecs8[8] & "|" & $aLVRecs8[9]
                   $sT0SerchResult_8 = GUICtrlCreateListViewItem($aLVitems[8], $sT0SerchResult)
               EndIf
               If $RecNmbr + 2 < UBound($aAtData) Then
                   $aLVRecs9 = StringSplit($aAtData[$RecNmbr + 2], "|")
                   $aLVitems[9] = $aLVRecs9[1] & "|" & $aLVRecs9[2] & "|" & $aLVRecs9[3] & "|" & $aLVRecs9[6] & "|" & $aLVRecs9[8] & "|" & $aLVRecs9[9]
                   $sT0SerchResult_9 = GUICtrlCreateListViewItem($aLVitems[9], $sT0SerchResult)
               EndIf
               If $RecNmbr + 3 < UBound($aAtData) Then
                   $aLVRecs10 = StringSplit($aAtData[$RecNmbr + 3], "|")
                   $aLVitems[10] = $aLVRecs10[1] & "|" & $aLVRecs10[2] & "|" & $aLVRecs10[3] & "|" & $aLVRecs10[6] & "|" & $aLVRecs10[8] & "|" & $aLVRecs10[9]
                   $sT0SerchResult_10 = GUICtrlCreateListViewItem($aLVitems[10], $sT0SerchResult)
               EndIf
               If $RecNmbr + 4 < UBound($aAtData) Then
                   $aLVRecs11 = StringSplit($aAtData[$RecNmbr + 4], "|")
                   $aLVitems[11] = $aLVRecs11[1] & "|" & $aLVRecs11[2] & "|" & $aLVRecs11[3] & "|" & $aLVRecs11[6] & "|" & $aLVRecs11[8] & "|" & $aLVRecs11[9]
                   $sT0SerchResult_11 = GUICtrlCreateListViewItem($aLVitems[11], $sT0SerchResult)
               EndIf
               If $RecNmbr + 5 < UBound($aAtData) Then
                   $aLVRecs12 = StringSplit($aAtData[$RecNmbr + 5], "|")
                   $aLVitems[12] = $aLVRecs12[1] & "|" & $aLVRecs12[2] & "|" & $aLVRecs12[3] & "|" & $aLVRecs12[6] & "|" & $aLVRecs12[8] & "|" & $aLVRecs12[9]
                   $sT0SerchResult_12 = GUICtrlCreateListViewItem($aLVitems[12], $sT0SerchResult)
               EndIf
               If $RecNmbr + 6 < UBound($aAtData) Then
                   $aLVRecs13 = StringSplit($aAtData[$RecNmbr + 6], "|")
                   $aLVitems[13] = $aLVRecs13[1] & "|" & $aLVRecs13[2] & "|" & $aLVRecs13[3] & "|" & $aLVRecs13[6] & "|" & $aLVRecs13[8] & "|" & $aLVRecs13[9]
                   $sT0SerchResult_13 = GUICtrlCreateListViewItem($aLVitems[13], $sT0SerchResult)
               EndIf
       
               If $RecNmbr + 7 < UBound($aAtData) Then
                   $aLVRecs14 = StringSplit($aAtData[$RecNmbr + 7], "|")
                   $aLVitems[14] = $aLVRecs14[1] & "|" & $aLVRecs14[2] & "|" & $aLVRecs14[3] & "|" & $aLVRecs14[6] & "|" & $aLVRecs14[8] & "|" & $aLVRecs14[9]
                   $sT0SerchResult_14 = GUICtrlCreateListViewItem($aLVitems[14], $sT0SerchResult)
               EndIf
               If $RecNmbr + 8 < UBound($aAtData) Then
                   $aLVRecs15 = StringSplit($aAtData[$RecNmbr + 8], "|")
                   $aLVitems[15] = $aLVRecs15[1] & "|" & $aLVRecs15[2] & "|" & $aLVRecs15[3] & "|" & $aLVRecs15[6] & "|" & $aLVRecs15[8] & "|" & $aLVRecs15[9]
                   $sT0SerchResult_15 = GUICtrlCreateListViewItem($aLVitems[15], $sT0SerchResult)
               EndIf
       EndFunc  ;==>_DispLview
       
      ;========================================
       
       Func _DisplayRec()
       $sWrkvar = $aAtData [$RecNmbr]
           $a_Record = StringSplit($sWrkvar, "|")
       $j = 1
           $sT0_LName = $a_Record[$j]
           $j = $j + 1
           $sT0_Fname = $a_Record[$j]
           $j = $j + 1
           $sT0_Initial = $a_Record[$j]
           $j = $j + 1
           $sT0_Computer = $a_Record[$j]
           $j = $j + 1
           $dT0_DateTimeofRecord = $a_Record[$j]
           $j = $j + 1
           $sT0_Addr1 = $a_Record[$j]
           $j = $j + 1
           $sT0_Addr2 = $a_Record[$j]
       
        . . . . . . snipped
       
           $rT5_Administrator = $a_Record[$j]
           $j = $j + 1
           $rT5_Deceased = $a_Record[$j]
           $j = $j + 1
           $rT5_NoContact = $a_Record[$j]
           $j = $j + 1
           $rT5_Current = $a_Record[$j]
       
           GUICtrlSetData($sT0LName, $sT0_LName)
           GUICtrlSetData($sT0Fname, $sT0_Fname)
           GUICtrlSetData($sT0Initial, $sT0_Initial)
           GUICtrlSetData($sT0Addr1, $sT0_Addr1)
       
        . . . . . .   snipped
       
           GUICtrlSetData($rT4Administrator, $rT4_Administrator)
           GUICtrlSetData($rT4Deceased, $rT4_Deceased)
           GUICtrlSetData($rT4NoContact, $rT4_NoContact)
           GUICtrlSetData($rT4Current, $r_Current)
           sT0CurrentNameChange()
       
       
           _DispLview()
       EndFunc  ;==>_DisplayRec<!--c2--></div><!--ec2-->

Edited by Gene

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

I had simillar problems with Tabs and haven't found the real answer to your problem. Hopefully a more experianced member will know

However I have found 2 'solutions' that may work for you

1) use child windows for each tab as described in this post

http://www.autoitscript.com/forum/index.php?showtopic=37876

2) move the listview to coordinates out side of the tabbed window when it is 'unselected' using guictrlsetpos()

You could set guictrlsetpos($listviewhandle,-2000,-2000) when the listview tab is unselected and reset the the position when the tab is reselected.

I have tried this method and it seems to work allthough I am not sure of the side effects it may create.

My Scripts[topic="73325"]_ReverseDNS()[/topic]Favourite scripts by other members[topic="81687"]SNMP udf[/topic][topic="70759"]Using SNMP - MIB protocol[/topic][topic="39050"]_SplitMon:Section off your monitor!, split your monitor into sections for easy management[/topic][topic="73425"]ZIP.au3 UDF in pure AutoIt[/topic][topic="10534"]WMI ScriptOMatic tool for AutoIt[/topic][topic="51103"]Resources UDF embed/use any data/files into/from AutoIt compiled EXE files[/topic]
Link to comment
Share on other sites

I had simillar problems with Tabs and haven't found the real answer to your problem. Hopefully a more experianced member will know

However I have found 2 'solutions' that may work for you

1) use child windows for each tab as described in this post

http://www.autoitscript.com/forum/index.php?showtopic=37876

2) move the listview to coordinates out side of the tabbed window when it is 'unselected' using guictrlsetpos()

You could set guictrlsetpos($listviewhandle,-2000,-2000) when the listview tab is unselected and reset the the position when the tab is reselected.

I have tried this method and it seems to work allthough I am not sure of the side effects it may create.

Thanks for the quick reply. I have tried setting the position 2000 pixels to the left and right, but nothing with the X axis. I continued to get the smear on the other tabs which was better than having the listview in front of them, but not much. I remembered using a listviiew a couple years ago with no problem. I've been reviewing that code since my post and have not yet seen anything. There is of course 3 differences. That was a loop, this is event mode, the method of populating it, that was a long list, changed in frequently and this is a short one and is revised every time a different record is viewed.

Gene

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

Have you tried locking the main window while the update is in progress by using GUISetState(@SW_LOCK,$mainwindowhandle) command

My Scripts[topic="73325"]_ReverseDNS()[/topic]Favourite scripts by other members[topic="81687"]SNMP udf[/topic][topic="70759"]Using SNMP - MIB protocol[/topic][topic="39050"]_SplitMon:Section off your monitor!, split your monitor into sections for easy management[/topic][topic="73425"]ZIP.au3 UDF in pure AutoIt[/topic][topic="10534"]WMI ScriptOMatic tool for AutoIt[/topic][topic="51103"]Resources UDF embed/use any data/files into/from AutoIt compiled EXE files[/topic]
Link to comment
Share on other sites

Dont know if this helps....

I have a tabbed GUI, and on one tab i have a pie chart, before i figured out the the following, the pie chart would show on all tabs.

CODE

$Main_Pie = GUICtrlCreateGraphic(570, 253, 60, 60)

GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlSetState(-1, $GUI_ONTOP)

The $Main_Pie above merely sets the display area for the pie, in my script the actual pie is drawn into this space in a seperate function with: GUICtrlSetGraphic($Main_Pie,$GUI_GR_PIE, 120,70, 30, 0, 360)

So basically try setting the control to GUI_DISABLE and then GUI_ONTOP

Edited by frodo
Link to comment
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
 Share

  • Recently Browsing   0 members

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