Jump to content

Listview Column Header disappearing


MinJun
 Share

Recommended Posts

hi,

#include <GUIConstants.au3>
#include <GuiListView.au3>
$GUIHeight = 480
$GUIWidth = 640
$hGUI = GUICreate("ListViewHeader", $GUIWidth, $GUIHeight, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))
Opt("MustDeclareVars", 0)
Opt("TrayIconHide", 1)


$Tab1 = GUICtrlCreateTab(13, 13, $GUIWidth-32, $GUIHeight-58, BitOR($TCS_FLATBUTTONS,$TCS_BUTTONS,$WS_GROUP))
; TabSheet1
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
;$ListView1 = GUICtrlCreateListView("ID | Name1 | Name2 | Name3 | Name4 | Name5", 8, 50, $GUIWidth-50, $GUIHeight-200)
$ListView1 = GUICtrlCreateListView("ID | Name1 | Name2 | Name3 | Name4 | Name5", 8, 50, 600, 350)
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
_GUICtrlListViewSetColumnWidth($ListView1, 0, 0)
_GUICtrlListViewSetColumnWidth($ListView1, 1, 90)
_GUICtrlListViewSetColumnWidth($ListView1, 2, 210)
_GUICtrlListViewSetColumnWidth($ListView1, 3, 110)
_GUICtrlListViewSetColumnWidth($ListView1, 4, 80)
_GUICtrlListViewSetColumnWidth($ListView1, 5, 80)
_GUICtrlListViewJustifyColumn($ListView1, 1, 2)
_GUICtrlListViewJustifyColumn($ListView1, 4, 1)
_GUICtrlListViewJustifyColumn($ListView1, 5, 1)
For $i = 1 To 20 Step 1
    GuiCtrlCreateListViewItem($i & "|" & $i & "|" & $i & "|" & $i & "|" & $i & "|" & $i, $ListView1)
Next
; TabSheet2
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
;$ListView2 = GUICtrlCreateListView("ID | Name1 | Name2 | Name3 | Name4 | Name5", 8, 50, $GUIWidth-50, $GUIHeight-200)
$ListView2 = GUICtrlCreateListView("ID | Name1 | Name2 | Name3 | Name4 | Name5", 8, 50, 600, 350)
GUICtrlSendMsg($ListView2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
_GUICtrlListViewSetColumnWidth($ListView2, 0, 0)
_GUICtrlListViewSetColumnWidth($ListView2, 1, 90)
_GUICtrlListViewSetColumnWidth($ListView2, 2, 210)
_GUICtrlListViewSetColumnWidth($ListView2, 3, 110)
_GUICtrlListViewSetColumnWidth($ListView2, 4, 80)
_GUICtrlListViewSetColumnWidth($ListView2, 5, 80)
_GUICtrlListViewJustifyColumn($ListView2, 1, 2)
_GUICtrlListViewJustifyColumn($ListView2, 4, 1)
 _GUICtrlListViewJustifyColumn($ListView2, 5, 1)
For $i = 1 To 20 Step 1
    GuiCtrlCreateListViewItem($i & "|" & $i & "|" & $i & "|" & $i & "|" & $i & "|" & $i, $ListView2)
Next
GUICtrlCreateTabitem("")
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

as you can see in the attached image, each time I run this script, the GUI opens but after 5-10s the headers of the listview seam to disapper. as soon as i move the mouse over them, they are visible again.

post-28487-1193406273_thumb.gif

why do they disappear?

Is this a problem with my script (or autoit) or is my comuter causing it?

maybe someone could test this script and tell me if he/she can reproduce my error.

thanks in advance!

MinJun

Link to comment
Share on other sites

^ thanks for testing ^ <_<

in the first post i forgot to mention that my autoit version is 3.2.8.1 and OS is WinXP Pro SP2, too.

maybe some trouble with the graphics card?

I've seen this too, but have cured it since - I can't remember exactly what I did, but I do know that my code to create the ListView looks identical and I now perform these actions -

; Resize to make sure we can see the command OK
_GUICtrlListViewSetColumnWidth ( $ProcessListView, 4, $LVSCW_AUTOSIZE )
        
; Hide and re-show, to refresh
GUICtrlSetState ( $ProcessListView, $GUI_HIDE )
GUICtrlSetState ( $ProcessListView, $GUI_SHOW )

I don't send

GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)

and I'm almost certain I did use GUICtrlSendMsg() before - this may be part of the problem?

A little vague, but hope it helps.

Andy W

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...