ajit Posted July 3, 2013 Posted July 3, 2013 Hi, I want to create a list view that would have some blinking items so as to grab the attention of the user. I would be grateful for any ideas, links or examples. Example of trigger for the blinking could be system time matching with list view item. Regards, Ajit
orbs Posted July 3, 2013 Posted July 3, 2013 (edited) not tested: how about GUICtrlSetColor() for the ListViewItem you want to emphasize? Edited July 3, 2013 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
DW1 Posted July 3, 2013 Posted July 3, 2013 (edited) If you want this to blink without interrupting the rest of the script you could set up a system to keep track of what should be blinking so that you can just add an item to the array if you want it to blink, then have a function that runs every X milliseconds from AdlibRegister to process any work to do in the array. If that didn't make sense, here is a quick example of what I mean (This way you just have to call blink() to add an item to the array that is watched by our AdlibRegistered function). expandcollapse popup#include <GUIConstantsEx.au3> #include <Array.au3> Global $aBlink[1][5] = [[0]] AdlibRegister('Blinker') $hGUI = GUICreate("LV blink", 220, 240) $hLV = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150) $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $hLV) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $hLV) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $hLV) $hButton1 = GUICtrlCreateButton("Blink item1", 10, 165, 200, 20) $hButton2 = GUICtrlCreateButton("Blink item2", 10, 190, 200, 20) $hButton3 = GUICtrlCreateButton("Blink item3", 10, 215, 200, 20) GUICtrlSetColor($item1, 0x000000) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hButton1 Blink($item1) Case $hButton2 Blink($item2) Case $hButton3 Blink($item3) EndSwitch WEnd ;Blink(Item handle, color to blink to, color to return to, how many times) Func Blink($hItem, $iColorB = 0xFF0000, $iColorR = 0x000000, $iTimes = 8) $aBlink[0][0] += 1 ReDim $aBlink[UBound($aBlink) + 1][5] $aBlink[UBound($aBlink) -1][0] = $hItem $aBlink[UBound($aBlink) -1][1] = $iColorB $aBlink[UBound($aBlink) -1][2] = $iColorR $aBlink[UBound($aBlink) -1][3] = $iTimes $aBlink[UBound($aBlink) -1][4] = 0 EndFunc Func Blinker() If $aBlink[0][0] = 0 Then Return For $i = 1 To $aBlink[0][0] If $aBlink[$i][4] = 0 Then GUICtrlSetColor($aBlink[$i][0], $aBlink[$i][1]) $aBlink[$i][4] = 1 Else GUICtrlSetColor($aBlink[$i][0], $aBlink[$i][2]) $aBlink[$i][3] -= 1 $aBlink[$i][4] = 0 EndIf Next ;Remove entries that are done For $i = $aBlink[0][0] To 1 Step -1 If $aBlink[$i][3] = 0 Then _ArrayDelete($aBlink, $i) $aBlink[0][0] -= 1 EndIf Next EndFunc Edited July 3, 2013 by danwilli AutoIt3 Online Help
ajit Posted July 3, 2013 Author Posted July 3, 2013 @danwilli, Thanks, that looks beautiful when blinking. Thanks again, Regards, Ajit
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