Hidix17 Posted January 19, 2015 Share Posted January 19, 2015 (edited) Hello! I wrote this script and... expandcollapse popup#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) GUICtrlSetColor($Console,$cColor) GUICtrlCreateListViewItem(@HOUR&":"&@MIN&":"&@SEC&"|"&$sUser&"|"&$sMessage,$Console) GUICtrlSetColor($Console,$DefaultFontColor) EndFunc #Region GUI $Form = GUICreate("B;ah blah blah", $GUIWidth, $GUIHeight, -1, -1) GUISetBkColor(0x111111) $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) GUICtrlSetBkColor(-1,0x222222) GUICtrlSetColor(-1,$DefaultFontColor) GUICtrlSetFont(-1,10,400,-1,"System") $InputCommand = GUICtrlCreateInput("", 0, $GUIHeight-21, $GUIWIdth, 21) GUISetState(@SW_SHOW) #EndRegion 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) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ...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 January 19, 2015 by Hidix17 Link to comment Share on other sites More sharing options...
abberration Posted January 20, 2015 Share Posted January 20, 2015 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. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
draien Posted January 22, 2015 Share Posted January 22, 2015 (edited) (Had some similar question) Just added 1 line and now it works perfectly fine: Func _ConsoleWrite($sUser,$sMessage,$cColor=0xFFFFFF) ;GUICtrlSetColor($Console,$cColor) GUICtrlCreateListViewItem(@HOUR&":"&@MIN&":"&@SEC&"|"&$sUser&"|"&$sMessage,$Console) GuiCtrlSetColor(-1,$cColor) ;GUICtrlSetColor($Console,$DefaultFontColor) EndFunc 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 January 22, 2015 by draien Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now