 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
philz
Joined: 05 Jun 2007 Posts: 87 Location: USA
|
Posted: Tue Jul 03, 2007 9:15 pm Post subject: autofilling comboboxes [SOLVED] |
|
|
In microsoft excel, if you type a value in one cell then type the beginning of the first cell in a second, it highlights the rest of the contents of the first cell. pressing delete or backspace stops the autofill with highlighting then the process can restart. i am trying to emulate this for comboboxes. ive been working on this code for hours but i cant get pressing delete or backspace to stop the autofill , or get it to restart by pressing anyother key.
this is the code i have thus far
| Code: | values = |0000|0001|0010|0011|0100|0101|0110|0111|1000|1001|1010|1011|1100|1101|1110|1111
gui, add, combobox, w120 vcombo, %values%
gui, show
settimer, filly, 200
return
backspace::
send, % chr(9)
listlines
msgbox
return
filly:
input, in, L1 B
send, %in%
if in = chr(9)
{
msgbox, whoohoo
return
}
gui, submit, nohide
cmboxfill(combo, values)
in = ;
return
cmboxfill(needle, haystack)
{
stringreplace, tempy, haystack, `|%needle%, |**###?###**,
regexmatch(tempy, "\|\*\*###\?###\*\*[^\|]*",jimmy)
stringreplace, jimmy, jimmy, |**###?###**
stringreplace, jimmy, jimmy, |
stringlen, len, jimmy
sendinput, %jimmy%{shift down}{left %len%}{shift up}
}
tab::
enter::
gui, submit, nohide
ifnotinstring, values, %combo%
values = %Values%|%combo%
guicontrol,,combobox, %combo%
guicontrol, text, combo
return
guiclose:
exitapp
|
any ideas. MAN THIS IS FRUSTRATING. Any help would be greatly appreciated.
Last edited by philz on Wed Jul 11, 2007 5:13 am; edited 1 time in total |
|
| Back to top |
|
 |
philz
Joined: 05 Jun 2007 Posts: 87 Location: USA
|
Posted: Thu Jul 05, 2007 1:07 pm Post subject: |
|
|
| any ideas? |
|
| Back to top |
|
 |
nick
Joined: 24 Aug 2005 Posts: 345 Location: Berlin / Germany
|
Posted: Thu Jul 05, 2007 10:10 pm Post subject: |
|
|
Maybe this might come closer:
| Code: | #NoEnv
Values = 0000|0001|0010|0011|0100|0101|0110|0111|1000|1001|1010|1011|1100|1101|1110|1111
Gui, Margin, 10, 10
Gui, Add, ComboBox, w120 vCombo Limit Number, %Values%
Gui, Add, Edit, xm y+10 w120 r1
Gui, Show, , Gui
Gui, +LastFound
Gui_ID := WinExist()
SetTimer, Filly, 100
SetTimer, WhoIsActive, 100
Return
; ------------------------------------------------------------------------------
Filly:
SetTimer, Filly, Off
_Input := True
Input, in, L1 V, {Enter}{Tab}
If (InStr(ErrorLevel, "NewInput")) {
_Input := False
Return
}
if (InStr(ErrorLevel, "Endkey:")) {
GoSub, Addy
SetTimer, Filly, On
Return
}
GuiControlGet, Combo
If (RegExMatch( "|" . Values . "|", "U)\|" . Combo . "([^\|]+)\|", RX)) {
Len := StrLen(RX1)
SendInput, %RX1%{Shift Down}{Left %Len%}{Shift Up}
}
SetTimer, Filly, On
Return
; ------------------------------------------------------------------------------
Addy:
GuiControlGet, Combo
If (!InStr("|" . Values . "|", "|" . Combo . "|")) {
Values .= "|" . Combo
GuiControl, ,Combo, |%Values%
}
GuiControl, Text, Combo
GuiControl, Focus, Combo
Return
; ------------------------------------------------------------------------------
WhoIsActive:
If (WinActive("ahk_id" . Gui_ID)) {
GuiControlGet, Act_Control, FocusV
If (Act_Control <> "Combo") {
If (_Input) {
Input
_Input:= False
}
} Else {
If (!_Input) {
_Input := True
SetTimer, Filly, On
}
}
} Else {
If (_Input) {
Input
_Input:= False
}
}
Return
; ------------------------------------------------------------------------------
GuiClose:
ExitApp
|
_________________ nick
denick @ http://de.autohotkey.com/forum/ |
|
| Back to top |
|
 |
philz
Joined: 05 Jun 2007 Posts: 87 Location: USA
|
Posted: Wed Jul 11, 2007 5:12 am Post subject: |
|
|
Thanks but i already got it solved in a simple fasion.
See my post "Smart Comboboxes"
i suppose i should have relamed this topic as solved
thanks again |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|