AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

listview highlighting/flashing

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
evan
Guest





PostPosted: Wed Aug 20, 2008 10:46 am    Post subject: listview highlighting/flashing Reply with quote

i am making a stock market gui program
like this:


code:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

list1=NetDragon,   0777.HK, 1000, 11.50
list2=CCB,         0939.HK, 3000, 6.00
list3=ChinaMobile, 0941.HK, 500,  92.50
list4=ChinaLife,   2628.HK, 1000, 26.70

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SetFormat, float, 6.2
Needle = <td class="ticker_up">

settimer, refresh, 60000
Gui +ToolWindow 
Gui, Add, ListView,grid r4 w800, Name|Stock#|Quantity|Buy-In$|Current$|Profit/Loss `%|Buy-in Total|Current Total|Profit/Loss|

loop 9
LV_ModifyCol(a_index, 87)

loop 4
{
StringSplit, array%a_index%list, list%a_index%, `,,%A_Space%

bt := array%a_index%list3 * array%a_index%list4
bt = $%bt%
bi := array%a_index%list4
bi = $%bi%
LV_Add("", array%a_index%list1, array%a_index%list2, array%a_index%list3, bi,"","",bt)
}
gosub, refresh
Gui,show, x1 y1
return
GuiClose:
ExitApp

refresh:
loop 4
{
ww := array%a_index%list2
UrlDownloadToFile, http://quote.yahoo.com/lookup?s=%ww%, %A_ProgramFiles%/stock.txt
FileRead, Haystack, %A_ProgramFiles%/stock.txt
StringGetPos, pos, Haystack, %Needle%
pos+=23
StringMid, OutputVar, Haystack, %pos% ,6
cu = %OutputVar%, %cu%
}
StringReplace, cu, cu, >, %A_SPACE%, All
StringReplace, cu, cu, /, %A_SPACE%, All
StringReplace, cu, cu, <, %A_SPACE%, All

StringSplit, outcu, cu, `,,%A_Space%

pl1 := (outcu4 - array1list4) / array1list4 * 100
pl2 := (outcu3 - array2list4) / array2list4 * 100
pl3 := (outcu2 - array3list4) / array3list4 * 100
pl4 := (outcu1 - array4list4) / array4list4 * 100

pl1 = %pl1%`%
pl2 = %pl2%`%
pl3 = %pl3%`%
pl4 = %pl4%`%


cuto1 := array1list3 * outcu4
cuto2 := array2list3 * outcu3
cuto3 := array3list3 * outcu2
cuto4 := array4list3 * outcu1


pll1 := cuto1 - (array1list3 * array1list4)
pll2 := cuto2 - (array2list3 * array2list4)
pll3 := cuto3 - (array3list3 * array3list4)
pll4 := cuto4 - (array4list3 * array4list4)

outcu1 = $%outcu1%
outcu2 = $%outcu2%
outcu3 = $%outcu3%
outcu4 = $%outcu4%

cuto1 = $%cuto1%
cuto2 = $%cuto2%
cuto3 = $%cuto3%
cuto4 = $%cuto4%

pll1 = $%pll1%
pll2 = $%pll2%
pll3 = $%pll3%
pll4 = $%pll4%

LV_Modify(1, "col5",outcu4)
LV_Modify(2, "col5",outcu3)
LV_Modify(3, "col5",outcu2)
LV_Modify(4, "col5",outcu1)

LV_Modify(1, "col6",pl1)
LV_Modify(2, "col6",pl2)
LV_Modify(3, "col6",pl3)
LV_Modify(4, "col6",pl4)

LV_Modify(1, "col8",cuto1)
LV_Modify(2, "col8",cuto2)
LV_Modify(3, "col8",cuto3)
LV_Modify(4, "col8",cuto4)

LV_Modify(1, "col9",pll1)
LV_Modify(2, "col9",pll2)
LV_Modify(3, "col9",pll3)
LV_Modify(4, "col9",pll4)

return

^r::reload



i wanted to add red highlights when its Loss (row1)
and green when its Profit (row2,3,4)

and probably add flashing highlights when 10% profit / loss

found this thread, it works.
but...kind of complicated for me to understand/adapt in my script
http://www.autohotkey.com/forum/topic9266.html

anyone can explain a little bit or edit 1 row for me so i can follow?
(or is there another way of doing this)

Thanks
Back to top
crxvfr



Joined: 10 Mar 2006
Posts: 55

PostPosted: Wed Aug 20, 2008 4:51 pm    Post subject: Reply with quote

I don't know how to do that but the help file has this under the options section for listview.

Background: Specify the word Background followed immediately by a color name (see color chart) or RGB value (the 0x prefix is optional). Examples: BackgroundSilver, BackgroundFFDD99. If this option is not present, the ListView initially defaults to the background color set by the last parameter of Gui Color (or if none, the system's default background color). Specifying BackgroundDefault applies the system's default background color (usually white). For example, a ListView can be restored to the default color via GuiControl, +BackgroundDefault, MyListView.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group