Jump to content

ComboBox issues.


Recommended Posts

So below is my full script.

And when you type something (try gragas, soraka or veigar) it will autocomplete and show the LoL counters on the list.

The problem is if you select a name of the list, it wont work.

I tried making the "Comparator" function activate on different WM_COMMAND messages.

As you can see is commented out at the bottom to figure out which would work.

The problem is, i got it to work once, but then the auto complete didn't work.

And now that i fixed the auto complete it doesn't.

Please test around and if you have any ideas on how to fix anything, please let me know.

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work
Global $hCombo
; Create GUI
GUICreate("ComboBox Auto Complete", 400, 300)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
;~ GUICtrlCreateLabel("Counter picks:", 2, 27)
$HeightForLabel = 33
GUICtrlCreateLabel("Champ:", 12, $HeightForLabel)
$Champ = GUICtrlCreateLabel(" ", 52, $HeightForLabel, 150)
$ButtonClear = GUICtrlCreateButton("Clear", 330, 27, 60, 25)
$HeightForLabel += 18
GUICtrlCreateGroup("Counter picks:", 2, $HeightForLabel, 396, 200)
$HeightForLabel += 17
$Counter1 = GUICtrlCreateLabel("1 - ", 12, $HeightForLabel, 150)
;~ $HeightForLabel += 20
;~ $CounterReason1 = GUICtrlCreateLabel("TESTTESTTEST", 12, $HeightForLabel)
$HeightForLabel += 20
$Counter2 = GUICtrlCreateLabel("2 - ", 12, $HeightForLabel, 150)
;~ $HeightForLabel += 20
;~ $CounterReason2 = GUICtrlCreateLabel("TESTTESTTEST", 12, $HeightForLabel)
$HeightForLabel += 20
$Counter3 = GUICtrlCreateLabel("3 - ", 12, $HeightForLabel, 150)
;~ $HeightForLabel += 20
;~ $CounterReason3 = GUICtrlCreateLabel("TESTTESTTEST", 12, $HeightForLabel)

GUISetState()
;Create Array
Global $Array[4][4]
$Array[0][0] += 1
$Array[1][0] = "Gragas"
$Array[1][1] = "Sion"
$Array[1][2] = "Twisted Fate"
$Array[1][3] = "Ryze"
$Array[0][0] += 1
$Array[2][0] = "Veigar"
$Array[2][1] = "Gangplank"
$Array[2][2] = "Ryze"
$Array[2][3] = "Kassadin"
$Array[0][0] += 1
$Array[3][0] = "Soraka"
$Array[3][1] = "Miss fortune"
$Array[3][2] = "Tristana"
$Array[3][3] = "Sona"

;~ _ArrayDisplay($Array)
_ArraySort($Array, 0, 0, 0, 0)
;~ _ArrayDisplay($Array)
;~ MsgBox("","",$Array[0][0])
;~ Exit
;~ #cs
; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
Local $X = 1
Do
_GUICtrlComboBox_AddString($hCombo, $Array[$X][0])
$X += 1
Until ($X - 1) = $Array[0][0]
_GUICtrlComboBox_EndUpdate($hCombo)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
;~ _ArrayDisplay($Array)
Do
Switch GUIGetMsg()
  Case $ButtonClear
   GUICtrlSetData($hCombo, "")
   _Comparitor()
EndSwitch
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Func _Comparitor()
$ComboText = _GUICtrlComboBox_GetEditText($hCombo)
$Z = 1
If Not $ComboText = "" Then
  Do
   If StringCompare($ComboText, $Array[$Z][0]) = 0 Then ExitLoop
   $Z += 1
   ConsoleWrite("Z: " & $Z & " - Array : " & $Array[$Z][0] & @CRLF)
  Until $Z = $Array[0][0]
;~   If Not $Z = $Array[0][0] Then
   ConsoleWrite("<< Z: " & $Z & " - Array : " & $Array[$Z][0] & @CRLF)
   GUICtrlSetData($Champ, $Array[($Z)][0])
   GUICtrlSetData($Counter1, "1 - " & $Array[$Z][1])
   GUICtrlSetData($Counter2, "2 - " & $Array[$Z][2])
   GUICtrlSetData($Counter3, "3 - " & $Array[$Z][3])
;~   Else
;~  ConsoleWrite("<< Z: " & $Z & " - Array : " & $Array[$Z][0] & " - No hamp display'ed" & @CRLF)
;~  GUICtrlSetData($Champ, "")
;~  GUICtrlSetData($Counter1, "1 - ")
;~  GUICtrlSetData($Counter2, "2 - ")
;~  GUICtrlSetData($Counter3, "3 - ")
;~   EndIf
Else
  GUICtrlSetData($Champ, "")
  GUICtrlSetData($Counter1, "1 - ")
  GUICtrlSetData($Counter2, "2 - ")
  GUICtrlSetData($Counter3, "3 - ")
EndIf
EndFunc   ;==>_Comparitor

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
Switch $hWndFrom
  Case $hCombo, $hWndCombo
   Switch $iCode
    Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed
;~    _Comparitor()
    Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box
;~    _Comparitor()
    Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible
    Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
     _GUICtrlComboBox_AutoComplete($hCombo)
     _Comparitor()
    Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text
;~    _Comparitor()
    Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request
    Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus
    Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box
;~    _Comparitor()
    Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box
;~    _Comparitor()
    Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list
;~    _Comparitor()
    Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus
   EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND
;~ #ce

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Global $Array[4][4]
$Array[0][0] += 1
$Array[1][0] = "Gragas"
$Array[1][1] = "Sion"
$Array[1][2] = "Twisted Fate"
$Array[1][3] = "Ryze"
$Array[0][0] += 1
$Array[2][0] = "Veigar"
$Array[2][1] = "Gangplank"
$Array[2][2] = "Ryze"
$Array[2][3] = "Kassadin"
$Array[0][0] += 1
$Array[3][0] = "Soraka"
$Array[3][1] = "Miss fortune"
$Array[3][2] = "Tristana"
$Array[3][3] = "Sona"

Hi, maffe811. Is this for League of Legends, or some other app?

I will answer this for you: yes this is for League of Legends. Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Yes, this is for league of legends, that is a game, this does not interact with the game in any way, its not game automatician, IF that is what you were wondering about! ;)

This is basicly a program to easilier search through this:

https://docs.google.com/spreadsheet/lv?hl=en_US]&key=0Aq-068L0cPIZdHdZR3JtaXlOdTZWQjJVb3FoUVZLM1E&toomany=true

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

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...