Jump to content
Sign in to follow this  

[Problem] ListView concrete Item font color

Recommended Posts

I wrote this script and...

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>

$VERSION = "1.0"

$GUIWidth = 600
$GUIHeight = 350
$DefaultFontColor = 0xFFFFFF

Func _ConsoleWrite($sUser,$sMessage,$cColor=0xFFFFFF)

#Region GUI
$Form = GUICreate("B;ah blah blah", $GUIWidth, $GUIHeight, -1, -1)
$Console = GUICtrlCreateListView("|||", 0, 0, $GUIWidth, $GUIHeight-21, BitOR($GUI_SS_DEFAULT_LISTVIEW,$LVS_NOCOLUMNHEADER), 0)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 130)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 400)
$InputCommand = GUICtrlCreateInput("", 0, $GUIHeight-21, $GUIWIdth, 21)

for $i=0 to 10 step 1
_ConsoleWrite("Color","I'm green until you scroll down...",0x00EE00)
_ConsoleWrite("Color","I'm yellow until you scroll down...",0xFFDD00)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE


...the problem appears when I scrolls down the ListView and the colors disappears.
Is anyone knows how to easy solve this problem?
Please help me!

Edited by Hidix17

Share this post

Link to post
Share on other sites

I don't think you are doing anything wrong. It appears to be a glitch with creating items that are out of the limits of the GUI. Try resizing the GUI height to 600 and you will see that your code works as expected.

Now try a simple WinMove and the font color of all lines goes to the default color you set. I don't know why it's doing this, but these are my observations.

RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post

Link to post
Share on other sites

(Had some similar question)

Just added 1 line and now it works perfectly fine:

Func _ConsoleWrite($sUser,$sMessage,$cColor=0xFFFFFF)

I think the colors have to be assigned to the ListViewItem, not the console itself, because the console is limited to actually what you see. So you either handle it like abberration stated with WinMove (to let AutoIT know when it was scrolled and to recolor everything again) or by simply using the code above.

Edited by draien

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  

  • Create New...