|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Nighthawyun Cheater Reputation: 0
Joined: 21 Jan 2019 Posts: 27
|
Posted: Fri Jan 25, 2019 4:43 am Post subject: LUA CEEdit Auto completion [HELP] |
|
|
how to make auto completion with CEEdit in Lua Script?
like picture
Description: |
|
Filesize: |
963 Bytes |
Viewed: |
1418 Time(s) |
|
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Fri Jan 25, 2019 1:10 pm Post subject: |
|
|
May use ComboBox, it can be edit like editbox, has .Text field to get edit content, and autoComplete functionality build in.
eg.
Code: |
local inet = getInternet()
cns = cns or inet.getURL[[https://gist.githubusercontent.com/kalinchernev/486393efcca01623b18d/raw/daa24c9fea66afb7d68f8d69f0c4b8eeb9406e83/countries]]
inet.Destroy()
local frm = createForm(false)
frm.OnClose = function()return caFree end
frm.Width,frm.Height,frm.Name = 600,200,"TEST_TEST"
frm.ChildSizing.Layout = "cclLeftToRightThenTopToBottom"
local edt = createEdit(frm)
edt.Text ="...for interaction..."
local cmb = createComboBox(frm)
cmb.AutoComplete, cmb.AutoDropDown = true, true
cmb.AutoCompleteText = "[cbactEnabled,cbactEndOfLineComplete,cbactSearchAscending]"
-- all option -> "[cbactEnabled,cbactEndOfLineComplete,cbactRetainPrefixCase,cbactSearchCaseSensitive,cbactSearchAscending]"
cmb.Items.Text = cns -- set autoComplete list here, should be sorted
cmb.onEditingDone = function(me)
edt.Text = me.Text
end
frm.Show()
|
_________________
- Retarded. |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Fri Jan 25, 2019 8:44 pm Post subject: |
|
|
panraven, i think better use tables and listbox.
first table contain all string items, then copy some items with paremeter key got from user input on edit box to second table. Next show filtered items to listbox.
I try to do it now, but my problem is copy items from 1st table to 2nd table with parameter key.
Code: | main_tab = {
"IDname = Albanian",
"IDname = Amazone",
"IDname = Baltimore",
"IDname = Bronx",
"IDname = California",
"IDname = Chile",
"IDname = Detroit"
}
|
for editbox :
Code: | local get_text = UDF1.CEEdit1.Text
if get_text == nil or get_text == "" then
return
else
first_letter = string.sub(get_text, 1, 1)
print(first_letter)
end |
so, first_letter is the parameter key.
Now, I need get all items from main_table which meets key parameters obtained from the editbox and add those items to second table.
Last is add listbox item from second table item.
EDIT 1 : something like this (unfinish)
Code: | fm = createForm()
fm.width = 200
fm.height = 200
fm.caption = "TEST"
edt = createEdit(fm)
edt.left = 10
edt.top = 10
edt.width = 180
list = createListBox(fm)
list.top = edt.top + edt.height + 10
list.width = 180
list.height = 160
list.visible = false
main_tab = {
"Albanian",
"Amazone",
"Baltimore",
"Bronx",
"California",
"Chile",
"Detroit"
}
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
function lbCheck()
local get_text = edt.Text
if get_text == nil or get_text == "" then
list.clear()
list.visible = false
else
filter_letter = string.sub(get_text, 1, 1)
-- variable1 = string.lower(filter_letter)
-- variable2 = string.upper(filter_letter)
list.clear()
local a = tablelength(main_tab)
for x = 1, a do
ls = string.sub(main_tab[x],1,1)
if ls == filter_letter then
-- if ls == variable1 or ls == variable2 then
list.Items.Add(main_tab[x])
list.visible = true
end
end
end
end
function getFromList()
--- get item from listbox and put to editbox
end
fm.show()
edt.onChange = lbCheck |
EDIT 2 :
So, here is complete code. The last thing is to handle upper case / lower case on Editbox.
Code: | fm = createForm()
fm.width = 200
fm.height = 200
fm.caption = "TEST"
edt = createEdit(fm)
edt.left = 10
edt.top = 10
edt.width = 180
list = createListBox(fm)
list.top = edt.top + edt.height + 10
list.left = 10
list.width = 180
list.height = 100
list.visible = false
lbl = createLabel(fm)
lbl.left = 10
lbl.top = list.top + list.height + 10
lbl.caption = 'Double Click to Select'
lbl.visible = false
main_tab = {
"Albanian",
"Amazone",
"Baltimore",
"Bronx",
"California",
"Chile",
"Detroit"
}
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
function lbCheck()
local get_text = edt.Text
if get_text == nil or get_text == "" then
list.clear()
list.visible = false
lbl.visible = false
else
filter_letter = string.sub(get_text, 1, 1)
-- variable1 = string.lower(filter_letter)
-- variable2 = string.upper(filter_letter)
list.clear()
local a = tablelength(main_tab)
for x = 1, a do
ls = string.sub(main_tab[x],1,1)
if ls == filter_letter then
-- if ls == variable1 or ls == variable2 then
list.Items.Add(main_tab[x])
list.visible = true
lbl.visible = true
end
end
end
end
function getFromList()
a = list.ItemIndex
z = list.Items[a]
edt.Text = z
end
fm.show()
edt.onChange = lbCheck
list.onDblClick = getFromList |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|