Jump to content

Find and highlights in to GuiCtrlListView


Recommended Posts

Hello guys, I'm working on this script:

$search = GUICtrlCreateButton("Search", 10, 10, 90, 30)
$find = GUICtrlCreateInput("", 710, 10, 200, 25)
GUICtrlSetState($find, $GUI_DISABLE)
$ok_find = GUICtrlCreateButton("Find", 925, 10, 65, 25)
GUICtrlSetState($ok_find, $GUI_DISABLE)


Case $search
   GUICtrlSetState($ok_trova, $GUI_ENABLE)
   GUICtrlSetState($trova, $GUI_ENABLE)
   _GUICtrlListView_SimpleSort($list, $g_bSortSense, 0, False)
   $File_txt = _FileListToArray("\\PATH\", "*.ini", $FLTA_FILES, True)
   Local $aLines, $File_txt
      For $i = 1 To $File_txt[0]
         _FileReadtoArray($File_txt[$i], $aLines)
         For $j = 1 To $aLines[0]
            GUICtrlCreateListViewItem($aLines[$j], $list)
      For $i2 = 0 To _GUICtrlListView_GetColumnCount($list)
        _GUICtrlListView_SetColumnWidth($list, $i2, $LVSCW_AUTOSIZE_USEHEADER)
Case $ok_find
   $iI = _GUICtrlListView_FindInText($list, GUICtrlRead($input_find))
   MsgBox($MB_SYSTEMMODAL, "Information", "Target Item Index: " & $iI)
   _GUICtrlListView_EnsureVisible($list, $iI)

through a inputbox I would search for the desired word and highlight it in the GuiCtrlListView.

Can you help me?

Link to comment
Share on other sites


Two questions:

1 - Why do this?

_GUICtrlListView_SimpleSort($list, $g_bSortSense, 0, False)

2 - You are creating a listview of contiguous lines from multiple input files. Are you sure that you don't want an edit control here?  If you describe your project you may find additional help from some of the excellent programmers here.


edit: Sorry, did not mention that a search for altering chars within an item or sub-item does not look hopeful for your goal. 


Edited by kylomas
additional info

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
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

  • Create New...