Jump to content

Searching "Google style" in combo's


Edifice
 Share

Recommended Posts

Hey

We are all familiar with google's "new" feature: It suggests keywords as you type in the box - very neat!

Anyway, I work at a computer-repair shop, and as it is we really keep track of all our repairs with a piece of paper. I decided to change that.

I have managed to create a database-file in SQLite, with various data reagarding the repairs and ofcourse a matching GUI to input data.

I am now working on the bit to get the data back on-screen again, and have to sort all the forms somehow. I have to have a search-feature, coz there is just too many entries to look through by hand.

My $id looks like this:

Dim $form_num = GUIctrlRead($input_phonenumber, 1) & @MDAY&@MON&@YEAR&@HOUR&@MIN&@SEC

Which with the Danish phonenumbers generate a number that looks somewhat like this: 7833664119022009105053 (Unique coz of the timestamp ^_^)

Anyway, let me get to the point: I have to be able to search these inputs by phonenumber (It's also in the DB - standalone input, if that helps me out)

What I would like to do is to be able to type for example "7" in a combobox, then search all the $id's for input with "7" in it, and display them in the combo to select. Then type some more: "7833" and display all the $id's with that specific number to select .... I think you see where this is going :)

I have no idea where to start here and would just appreciate it very much to be pointed in the right direction - and maybe even with a bit of help along the way :)

Link to comment
Share on other sites

Hey

We are all familiar with google's "new" feature: It suggests keywords as you type in the box - very neat!

Anyway, I work at a computer-repair shop, and as it is we really keep track of all our repairs with a piece of paper. I decided to change that.

I have managed to create a database-file in SQLite, with various data reagarding the repairs and ofcourse a matching GUI to input data.

I am now working on the bit to get the data back on-screen again, and have to sort all the forms somehow. I have to have a search-feature, coz there is just too many entries to look through by hand.

My $id looks like this:

Dim $form_num = GUIctrlRead($input_phonenumber, 1) & @MDAY&@MON&@YEAR&@HOUR&@MIN&@SEC

Which with the Danish phonenumbers generate a number that looks somewhat like this: 7833664119022009105053 (Unique coz of the timestamp :huh2:)

Anyway, let me get to the point: I have to be able to search these inputs by phonenumber (It's also in the DB - standalone input, if that helps me out)

What I would like to do is to be able to type for example "7" in a combobox, then search all the $id's for input with "7" in it, and display them in the combo to select. Then type some more: "7833" and display all the $id's with that specific number to select .... I think you see where this is going :)

I have no idea where to start here and would just appreciate it very much to be pointed in the right direction - and maybe even with a bit of help along the way :)

This would be quite a cool concept. You are lucky but Google hasn't released suggest in our country yet ^_^
Link to comment
Share on other sites

It's sounds like something like it yeah, however the result of running that script was at first a couple of error on undeclared stuff. After I put in some includes I was able to get a GUI with an Input.

I have the feeling it was supposed to do something more?

Link to comment
Share on other sites

Meant to be an example of how to go about using a combo with auto complete. I didn't say it would solve your problem 100%.

Can you post a replicator script?

Cheers,

Brett

Link to comment
Share on other sites

Meant to be an example of how to go about using a combo with auto complete. I didn't say it would solve your problem 100%.

Can you post a replicator script?

Cheers,

Brett

Ofcourse not - I just don't think the version I'm running is Working As intended

Here is what i've got:

#include <GUIComboBox.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>


Opt('MustDeclareVars', 1)

$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

Example_Internal()

Func Example_Internal()
    Local $hGUI

  ; Create GUI
    $hGUI = GUICreate("(Internal) ComboBox Auto Complete", 400, 296)
    $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 20, BitOR ($CBS_NOINTEGRALHEIGHT, $CBS_SIMPLE))
    GUISetState()

  ; Add files
    _GUICtrlComboBox_BeginUpdate ($hCombo)
    _GUICtrlComboBox_AddDir ($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate ($hCombo)

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

  ; Loop until user exits
    Do
        Sleep (10)
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc ;==>Example_Internal

Func _Edit_Changed()
    _GUICtrlComboBox_AutoComplete ($hCombo)
EndFunc ;==>_Edit_Changed

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    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_EDITCHANGE; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
                    _Edit_Changed()
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
Link to comment
Share on other sites

Arh got it working now! - Dunno what I messed up in the first copy+paste action :)

This is actually really, really great!

I took the styling off and discovered that the combo didn't have more than one option. I was kinda hoping to get all the results with "7833" in there to be able to choose from.

I do have returning customers, and I have to be able to handle the same phonenumber twice. Thus the timestamp in the $id.

Anyone with a bright idea? - I have to admit this code is a bit advanced for me :)

Edited by Edifice
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...