Jump to content

Help understanding _GUICtrlComboBox_AutoComplete


Recommended Posts

http://www.autoitscript.com/autoit3/docs...ctions/_GUICtrlComboBox_AutoCo

The link above is to the function im having trouble with.

I understand everything until the _Edit_Changed function

What does _GUICtrlComboBox_AutoComplete do ?

"AutoComplete a ComboBox edit control"

But what do you need the WM_COMMAND func for then?

Is the WM_COMMAND func listening for changes?

And all this:

#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

Like i don't understand what most of it does/contain.

I usually understand after reading the help file and if that doesn't work the example does the rest.

In this case the text doesn't say much and the help is just confusing.

How can i make this as compact as possible?

And also will the GUIRegisterMsg get messed up if i write stuff inhere:

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Im making a League of Legends counter pick list.

So it will be extracting data from a file (most likely an excel file) and then it will list all the names there.

Then you start writing the name for whoever you were looking for and it will list who you counter OR you can toggle a check box and see who counters you.

Im just walking into something i don't really understand ;)

[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

  • Moderators

Maffe811,

Like i don't understand what most of it does/contain

Then I suggest reading the GUIRegisterMsg tutorial in the Wiki to get it all explained. :)

Im making a League of Legends counter pick list

You have been here long enough to have read the Forum Rules - can you assure me that this does not interact with the game and is something entirely separate? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Maffe811,

Then I suggest reading the GUIRegisterMsg tutorial in the Wiki to get it all explained. :)

Only thing i didn't look up ;)

You have been here long enough to have read the Forum Rules - can you assure me that this does not interact with the game and is something entirely separate? :)

M23

Yes, its basicly this:

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

But in a program instead of just a big sheet.

So it does not interact with the program in any way, ive been here long enough to see what happens with thoose who try game automation. ;)

Also the list linked to above only supports checking who you should pick to counter champion "X".

Not who champion "X" would counter.

So i would create the possibility to check both ways, not only one way like the list.

[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

  • Moderators

So it does not interact with the program in any way

Delighted to hear it! ;)

Please ask if you have any questions after reading the tutorial and I shall do my best to clarify - although as I wrote it that might be a bit difficult! :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

That was incredibly educating!

I still got some questions though.

Local $iIDFrom = BitAND($wParam, 0xFFFF) ; LoWord - this gives the control which sent the message

I don't fully understand what BitAND does here, but i asume it gets the name of the controll?

But what is 0xFFFF

and what do you want $wParam to be ?

Local $iCode = BitShift($wParam, 16)     ; HiWord - this gives the message that was sent

This gets something out of $wParam? The thing that has changed?

And then later checks it against this:

If $iCode = $EN_CHANGE Then ; If we have the correct message

And $EN_CHANGE is something that have changed and if its = to the change happened with our thing then it continues on to:

Switch $iIDFrom ; See if it comes from one of the inputs

And if $iIDForm is equal to your input it will do whatever you have as Do something

Case $hInput1
    ;Do something

What is, if anything is, correct?

[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

  • Moderators

Maffe811,

Stand by for short course in Bit arithmetic. :)

$wParam is 8 bytes wide - think "12345678", although each digit can actually be 0-F. Sometimes the value in $wParam is divided into 2 separate 4 byte values - the "High" and the "Low" words. In the example above, these are: High = "1234"; Low = "5678". It is a clever way of passing 2 values within a single parameter. ;)

So how to separate these values? We could use _WinAPI_HiWord and _WinAPI_LoWord, but that would mean including WinAPI.au3. So we manipulate the value ourselves.

High word first: here we just shift the the whole parameter to the right:

Local $iCode = BitShift($wParam, 16)

Remember that each byte has 4 bits (Hex 0-F = Binary 0000 - 1111) - so if we shift the whole number 4x4 bits to the right, we get just "1234" - the "High" part.

Now the Low word: here we use another of the Bit operators to blank out the "High" bytes:

Local $iIDFrom = BitAND($wParam, 0xFFFF)

BitAND says only keep bit where there is a value in both of the operators - in our case we get this:

12345678
0000FFFF   - remember that F = 1111
=
00005678   - as only the final 4 bytes can possibly have 1's set in both values

So basically we keep all the Low bytes and set all the High bytes to zero - the result is the Low word.

Still with me? I will come back with the second part after the Germany/Portugal match has finished. :)

M23

Edited by Melba23
Typo

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Maffe811,

Part 2. ;)

The 2 words we extract from $wParam are the Code for that message and the IDFrom telling us the ControlID of the control which sent it.

$EN_CHANGE is a message sent by an Edit control (hence the E prefix) when something has changed within it. This is useful when looking to see if the user has entered something when we need to act upon it - we can use IDFrom[/i to check which edit control sent the message.

Here is a good example of both of them being used - see if you can follow it now. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

You made it all sound so simple! ;):)

Now with _WinAPI_LoWord, _WinAPI_HiWord and the arithmetic lesson it was easier to understand what the BitAnd and BitShift did.

But i think you covered everything i was wondering about!

Thank you so much for your time and help!

Edited by Maffe811

[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

  • Moderators

Maffe811,

My pleasure. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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