I have completed my autofill for a standard text boxes. Using the following
function place.action(self,key,newValue)
local len = newValue:len()
-- If the place has a value and the key was not a control one
if key > 0 and len > 0 then
local p = placeList:findFirst(newValue)
if p then
self.value = p
-- Put cursor to start of selection
self.caretpos = len
-- Select from cursor to end of the string
self.selectionpos = len..':999'
return iup.IGNORE
end
end
end
Unfortunately on GetParam I don't know how to get the details of the last
key pressed, to see if it was a character or a control key. I have tried
storing the last value, but that did not work as I wanted.
Is there an easy way to get the last key press back in GetParam?
-- Check for AutoText on field
if param.type == 'STRING' then
local ctrl = iup.GetParamHandle(param, "CONTROL")
print(oldv[param_index + 1],param.value)
if oldv[param_index + 1] == param.value then
return 1
else
oldv[param_index + 1] = param.value
end
local tag = id[param_index + 1]
if pRegions.shortcuts[tag] then
local l = param.value:len()
if l > 0 then
for k,r in ipairs(pRegions.shortcuts[tag]) do
local v = param.value:lower()
local s = string.lower(r:sub(1,l))
if v == s then
ctrl.value = r
ctrl.caretpos = l
ctrl.selectionpos = l..':999'
oldv[param_index + 1] = ctrl.value
return 0
end
end
end
end
On Mon, 2 Mar 2020 at 13:07, Antonio Scuri <[email protected]> wrote:
> No, sorry.
>
> If you start something I can help you get it done.
>
> Best,
> Scuri
>
>
> Em seg., 2 de mar. de 2020 às 09:34, Jane Taubman <[email protected]>
> escreveu:
>
>> IupText does not have that feature, but it can be created with some
>>> work. Using the IupText callbacks you can show an IupList inside a
>>> IupDialog (without decorations) over the dialog where you are typing.
>>>
>>
>> Are there any example of this available anywhere please?
>>
>>
>> _______________________________________________
>> Iup-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
> _______________________________________________
> Iup-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
--
Jane.
Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users