Jump to content

[SOLVED] GUICtrlCreateList Click


Recommended Posts

Ok, so I have trolled the forums for a bit, but still not found the answer to my question. I display a list of search results, and then, when a user clicks on a result, it executes a command. I've seen many examples under ListView and ListViewItem, but i'm not doing a ListView, just a normal list.

I really don't want people to use the 'Find' and 'Display Results' buttons, as they are not that user friendly.

So, from the code below, when the user clicks on a radio button choice (on the side of the program) it executes the various functionsl isted below to a) show the list result and show the ie window, and then buttons, and hide the other things on the screen, and then :) grab the results from the information that's been provided and c) when 'display results' is selected, it pulls up the needed HTML file.

However, I want to bypass actually pushing that button. How can I get the code below to work when a user simply 'clicks' on on a listed result?

$listview = GUICtrlCreateList("",0,40,410, 552);,$LVS_SORTDESCENDING)
GUICtrlSetLimit(-1,200); to limit horizontal scrolling
guictrlsetstate($listview, $GUI_HIDE)

$Input1 = ""
$kbSelect = ""

Func _ArrayFindAll($iArray, $iQuery, $iStart = 0,  $iEnd = 0, $iCaseSense = 0, $fPartialSearch = True)
    Local $Rtn = ''

    While 1
        $aSrch = _ArraySearch($iArray, $iQuery, $iStart,  $iEnd, $iCaseSense, $fPartialSearch)
        If $aSrch <> -1 Then
            $Rtn &= $aSrch & '|'
            $iStart = $aSrch + 1
        Else
            ExitLoop
        EndIf
    Wend

    If $Rtn <> '' Then
        $Rtn = StringSplit(StringTrimRight($Rtn, 1), '|')
        Return $Rtn
    Else
        Return SetError(1, 1, 'No matches to your query were found')
    EndIf
EndFunc 

$fQuery = ""
$datas = ""
$select = ""
$data = ""
Func goOKB()
guictrlsetdata($listview, "")
guictrlsetstate($kbSelect, $GUI_SHOW)
guictrlsetstate($listview, $GUI_SHOW)

Dim $aRecords
If Not _FileReadToArray(@ProgramFilesDir&"\BTC\db.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

If IsArray($aRecords) Then
        $Found = _ArrayFindAll($aRecords, $fQuery)
        If IsArray($Found) Then
            
            For $I = 1 To $Found[0]
                    guictrlsetdata($listview, $aRecords[$Found[$I]])
            Next

        Else
            MsgBox(0,'No Matches', $Found)
        EndIf
    EndIf
EndFunc


$okbID = ""
$okbIDdef = ""

Func goOKB_GetDef()
        $okbIDdef = guictrlread($listview, 1)
        $okbID = StringLeft($okbIDdef, 5)
        _IENavigate ($KBoIE, "file://"&@ProgramFilesDir&"/BTC/"&$okbID&".html", 0)
EndFunc
Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

@zackrspv...

So, from the code below, when the user clicks on a radio button choice (on the side of the program) it executes the various functionsl isted below to a) show the list result and show the ie window, and then buttons, and hide the other things on the screen, and then grab the results from the information that's been provided and c) when 'display results' is selected, it pulls up the needed HTML file.

What radio button? Please post your entire code.
Link to comment
Share on other sites

@zackrspv...

What radio button? Please post your entire code.

Take a look at: http://www.autoitscript.com/forum/index.php?showtopic=66432

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...