Jump to content

ListView Background Colour Graphical Problem


Recommended Posts

Greetings,

     I'm experiencing a strange issue with the background colour in a ListView control when it's in a tab.  If another window opens (this is one of the functions my app will be doing), the background of the tab overrides the background colour of the empty listview area.  I tried setting the listview control to $GUI_ONTOP, but that doesn't seem to help. 

     The only way I've figured out to get around it is to reset the background colour of the listview control to force it to redraw.  Obviously, this doesn't look too great.  Does anyone have any ideas?

This is just sample code, but reproduces the error consistently for me.

#include <GUIConstants.au3>
#include <GuiListView.au3>

$gui        = GUICreate("Test", 300, 300)
$button1    = GUICtrlCreateButton("Open Folder", 5, 275, 80, 20)
$button2    = GUICtrlCreateButton("Exit", 215, 275, 80, 20)
$tab        = GUICtrlCreateTab(5, 5, 290, 200)
$tab1       = GUICtrlCreateTabItem("Tab 1")
$listview   = GUICtrlCreateListView("Column 1|Column 2", 20, 50, 260, 150)
GUICtrlSetBkColor($listview, 0xAAAAAA)
For $i = 0 To 5
    _GUICtrlListView_AddItem($listview, "Item " & $i)
    _GUICtrlListView_AddSubItem($listview, $i, "Subitem " & $i, 1)
Next
$tab2       = GUICtrlCreateTabItem("Tab 2")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE, $button2
            Exit
        Case $button1
            Run('explorer.exe "' & @UserProfileDir)
        Case Else
            ;;;
    EndSwitch
WEnd

Thanks!

Link to comment
Share on other sites

I could not reproduce the error you described on a Win 7 x86 box with your posted code. However, I have had the problem you described when I had overlapping controls. I am curious to know if my code below produces your error.

#Include <GUIConstantsEx.au3>

$gui        = GUICreate("Test", 300, 300)
;GUISetBkColor(0xE2E2C7); remove comment to show tab region
$button1    = GUICtrlCreateButton("Open Folder", 5, 275, 80, 20)
$button2    = GUICtrlCreateButton("Exit", 215, 275, 80, 20)
$tab        = GUICtrlCreateTab(5, 5, 290, 200)
$tab1       = GUICtrlCreateTabItem("Tab 1")
$listview   = GUICtrlCreateListView("Column 1|Column 2", 20, 50, 260, 150)
GUICtrlSetBkColor($listview, 0xAAAAAA)
$tab2       = GUICtrlCreateTabItem("Tab 2")
GUICtrlCreateTabItem(""); end tabitem definition

For $i = 0 To 5
    GUICtrlCreateListViewItem("Item " & $i & "|SubItem " & $i,$listview)
Next

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE, $button2
            Exit
        Case $button1
            Run('explorer.exe "' & @UserProfileDir)
        Case Else
            ;;;
    EndSwitch
WEnd
Link to comment
Share on other sites

  • Moderators

Hi,

Both of those scripts reproduce the error for me. It seems that resetting the back colour of the ListView after a short pause (~250ms) resets the GUI, but I cannot for the moment stop the initial problem. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

SupaNewb, your code does reproduce it for me.

I currently have my script resetting the background colour after a short pause, but it makes it look really horrible, and I had to add a timer to occasionally reset the background colour constantly, in case some other process causes the problem.

Link to comment
Share on other sites

  • Moderators

SupaNewb,

No, I am running 3.3.10.2 and 3.3.11.3. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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