Jump to content

Recommended Posts

Posted

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!

Posted

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
  • Moderators
Posted

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:

  Reveal hidden contents

 

Posted

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.

  • Moderators
Posted

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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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