Re: [Iup-users] Lua, UTF-16 and iup.clipboard
Thank you, I will give it try when the app I use adopts the new release. On Fri, 8 May 2020, 15:16 Andrew Robinson, wrote: > Nice. > > On 2020-05-08 at 6:42 AM, Antonio Scuri wrote: > > Ok. > > I had an idea. Just added a new attribute for IupClipboard: > > FORMATDATASTRING [Windows and GTK Only]: sets/gets FORMATDATA and > FORMATDATASIZE considering data being a string in the system format. (since > 3.29) > > Best, > Scuri > > > > > Em qui, 7 de mai de 2020 06:32, Jane Taubman > escreveu: > >> I get the plain text, excluding the html code.When you copy from a >> web browser like Chrome you get several different formats. >> So if I copy your post from gmail the TEXT is >> - >> What happen if you simply try using: >> >> script = clipboard.text >> instead of >>script = clipboard.formatdata >> >> Leaving the rest as it is. >> - >> but the text/html is >> >> What happen if you simply try using: >> script = clipboard.textinstead of script = >> clipboard.formatdata Leaving the rest as it >> is. >> >> On Mon, 4 May 2020 at 23:13, Antonio Scuri >> wrote: >> >>> What happen if you simply try using: >>> >>> script = clipboard.text >>> instead of >>>script = clipboard.formatdata >>> >>> Leaving the rest as it is. >>> >>> Best, >>> Scuri >>> >>> >>> Em seg., 4 de mai. de 2020 às 13:41, Jane Taubman >>> escreveu: >>> >>>> I'll try to explain in a clearer way. >>>> >>>> If I open a file saved in UTF-16 in Lua using the IO library. I can >>>> then handle the content of that file to convert each pair of bytes as >>>> needed to end up with UTF-8 or even Ascii. All I want to do is to be able >>>> to read in the text/html format from the clipboard and process it in lua. >>>> >>>> However I can not do anything with the Light user Data returned from >>>> the Clipboard using Lua, that I can discover. >>>> >>>> >>>> >>>> On Sun, 3 May 2020 at 21:56, Andrew Robinson >>>> wrote: >>>> >>>>> I hate to state the obvious but in a string data type, an >>>>> ASCII "character" is one byte in size (char), and a UTF-16 "character" is >>>>> two bytes in size (short). >>>>> >>>>> I apologize if this is out-of-place for your conversation, but I get a >>>>> lot of people who confuse a string character with a byte, instead of a >>>>> variable number of bytes, but ... you know, just in case that is the real >>>>> issue here I wanted to "fix it". >>>>> >>>>> So I'm not sure whether to say de nada or lo siento, >>>>> Andrew >>>>> >>>>> On 2020-05-03 at 12:02 PM, Antonio Scuri >>>>> wrote: >>>>> >>>>> > The UTF-16 function takes a "string" >>>>> >>>>> That is weird. UTF-16 strings are *unsigned short** arrays, strings >>>>> in Lua are *char** arrays. Something is not right. >>>>> >>>>> Is there a link for the documentation of that library? >>>>> >>>>> Best, >>>>> Scuri >>>>> >>>>> >>>>> Em dom., 3 de mai. de 2020 às 09:02, Jane Taubman < >>>>> janetaub...@gmail.com> escreveu: >>>>> >>>>>> >"data" can not be converted to a string using "tostring". It >>>>>> must use this function you mentioned. >>>>>> >>>>>> Sorry I did not make myself clear.The UTF-16 function takes a >>>>>> "string" and will not work with a "light user data" so I need to know how >>>>>> to convert the light user data from the iup.clipboard to a string using >>>>>> just lua. >>>>>> >>>>>> >>>>>> -- >>>>>> Jane. >>>>>> >>>>>> Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk >>>>>> ___ >>>>>> Iup-users mailing list >>>>>> Iup-users@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/iup-users >>>>>> >>>>> >>>>> ___ >>>>> Iup-users mailing list >>>>> Iup-users@lists.sourceforge.net >>>>> 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 >>>> Iup-users@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/iup-users >>>> >>> ___ >>> Iup-users mailing list >>> Iup-users@lists.sourceforge.net >>> 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 >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > > ___ > Iup-users mailing list > Iup-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/iup-users > ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Lua, UTF-16 and iup.clipboard
I get the plain text, excluding the html code.When you copy from a web browser like Chrome you get several different formats. So if I copy your post from gmail the TEXT is - What happen if you simply try using: script = clipboard.text instead of script = clipboard.formatdata Leaving the rest as it is. - but the text/html is What happen if you simply try using: script = clipboard.textinstead of script = clipboard.formatdata Leaving the rest as it is. On Mon, 4 May 2020 at 23:13, Antonio Scuri wrote: > What happen if you simply try using: > > script = clipboard.text > instead of >script = clipboard.formatdata > > Leaving the rest as it is. > > Best, > Scuri > > > Em seg., 4 de mai. de 2020 às 13:41, Jane Taubman > escreveu: > >> I'll try to explain in a clearer way. >> >> If I open a file saved in UTF-16 in Lua using the IO library. I can >> then handle the content of that file to convert each pair of bytes as >> needed to end up with UTF-8 or even Ascii. All I want to do is to be able >> to read in the text/html format from the clipboard and process it in lua. >> >> However I can not do anything with the Light user Data returned from the >> Clipboard using Lua, that I can discover. >> >> >> >> On Sun, 3 May 2020 at 21:56, Andrew Robinson wrote: >> >>> I hate to state the obvious but in a string data type, an >>> ASCII "character" is one byte in size (char), and a UTF-16 "character" is >>> two bytes in size (short). >>> >>> I apologize if this is out-of-place for your conversation, but I get a >>> lot of people who confuse a string character with a byte, instead of a >>> variable number of bytes, but ... you know, just in case that is the real >>> issue here I wanted to "fix it". >>> >>> So I'm not sure whether to say de nada or lo siento, >>> Andrew >>> >>> On 2020-05-03 at 12:02 PM, Antonio Scuri >>> wrote: >>> >>> > The UTF-16 function takes a "string" >>> >>> That is weird. UTF-16 strings are *unsigned short** arrays, strings >>> in Lua are *char** arrays. Something is not right. >>> >>> Is there a link for the documentation of that library? >>> >>> Best, >>> Scuri >>> >>> >>> Em dom., 3 de mai. de 2020 às 09:02, Jane Taubman >>> escreveu: >>> >>>> >"data" can not be converted to a string using "tostring". It must >>>> use this function you mentioned. >>>> >>>> Sorry I did not make myself clear.The UTF-16 function takes a >>>> "string" and will not work with a "light user data" so I need to know how >>>> to convert the light user data from the iup.clipboard to a string using >>>> just lua. >>>> >>>> >>>> -- >>>> Jane. >>>> >>>> Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk >>>> ___ >>>> Iup-users mailing list >>>> Iup-users@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/iup-users >>>> >>> >>> ___ >>> Iup-users mailing list >>> Iup-users@lists.sourceforge.net >>> 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 >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > ___ > Iup-users mailing list > Iup-users@lists.sourceforge.net > 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 Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Lua, UTF-16 and iup.clipboard
I'll try to explain in a clearer way. If I open a file saved in UTF-16 in Lua using the IO library. I can then handle the content of that file to convert each pair of bytes as needed to end up with UTF-8 or even Ascii. All I want to do is to be able to read in the text/html format from the clipboard and process it in lua. However I can not do anything with the Light user Data returned from the Clipboard using Lua, that I can discover. On Sun, 3 May 2020 at 21:56, Andrew Robinson wrote: > I hate to state the obvious but in a string data type, an > ASCII "character" is one byte in size (char), and a UTF-16 "character" is > two bytes in size (short). > > I apologize if this is out-of-place for your conversation, but I get a lot > of people who confuse a string character with a byte, instead of a variable > number of bytes, but ... you know, just in case that is the real issue here > I wanted to "fix it". > > So I'm not sure whether to say de nada or lo siento, > Andrew > > On 2020-05-03 at 12:02 PM, Antonio Scuri wrote: > > > The UTF-16 function takes a "string" > > That is weird. UTF-16 strings are *unsigned short** arrays, strings in > Lua are *char** arrays. Something is not right. > > Is there a link for the documentation of that library? > > Best, > Scuri > > > Em dom., 3 de mai. de 2020 às 09:02, Jane Taubman > escreveu: > >> >"data" can not be converted to a string using "tostring". It must >> use this function you mentioned. >> >> Sorry I did not make myself clear.The UTF-16 function takes a >> "string" and will not work with a "light user data" so I need to know how >> to convert the light user data from the iup.clipboard to a string using >> just lua. >> >> >> -- >> Jane. >> >> Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk >> ___ >> Iup-users mailing list >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > > ___ > Iup-users mailing list > Iup-users@lists.sourceforge.net > 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 Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Lua, UTF-16 and iup.clipboard
>"data" can not be converted to a string using "tostring". It must use this function you mentioned. Sorry I did not make myself clear.The UTF-16 function takes a "string" and will not work with a "light user data" so I need to know how to convert the light user data from the iup.clipboard to a string using just lua. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Lua, UTF-16 and iup.clipboard
On Tue, 25 Jun 2019 at 15:18, Antonio Scuri wrote: > It will be returned as a light user data. Then you can use your > conversion functions. > I have finally returned to this one and now need to process the lightuserdata in Lua, I tried to use the tostring() option to get the string out of the returned lightuserdata, but I don't think the __tostring metamethod has been defined. Is there any other way I can get the string out of the lightuserdata, remember I don't have access to the main application so need to do any manipulation in Lua. Thanks My current code is clipboard = iup:clipboard() clipboard.format = 'text/html' data = clipboard.formatdata print(clipboard.formatavailable,clipboard.FORMATDATASIZE) print(tostring(data)) ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Using the iup.scrollbox
Thanks, in the end I just removed the second Scroll box as when that is not included the window behaves as I wanted leaving the bottom of the screen a fixed size and the top growing and shrinking with the window size. On Wed, 11 Mar 2020 at 14:11, Pete Lomax via Iup-users < iup-users@lists.sourceforge.net> wrote: > Not an expert, but I clocked this bit in the middle with some suspicion: > scrollbar = "VERTICAL", > xmax = "0", > dy = "334", > ymax = "583", > I wondered about expand = "VERTICAL" and/or getting rid of that ymax > setting. Have not tried either here, my apologies if neither helps. > -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Using the iup.scrollbox
Thanks for your help What I was hoping to get to was to dock the message and buttons to the base using the space for the fieldlist, but I can't seem to work out how. On Tue, 10 Mar 2020, 19:42 Antonio Scuri, wrote: > ok Got it. I attached the full example so we can move on from there. > > Here is the result: > > [image: image.png] > > I'm still trying to figure out the initial size, but when I resize the > dialog, its children are resized accordingly. > > What's not expected for you? > > Best, > Scuri > > > Em ter., 10 de mar. de 2020 às 15:32, Jane Taubman > escreveu: > >> I used iup.Popup(iup.LayoutDialog(dlg)) to dump out the dialog source >> at the end of the build >> >> As follows >> >> -- Generated by IupLayoutDialog export to Lua. >> >> function create_dialog_dialogDump() >> iup.dialog{ >> iup.vbox{ >> iup.hbox{ >> iup.label{ >> title = "Enter name and other information as shown on Census", >> }, >> margin = "4x2", >> }, >> iup.scrollbox{ >> iup.vbox{ >> iup.hbox{ >> iup.label{ >> size = "80", >> usersize = "140x0", >> title = "Name:", >> }, >> iup.text{ >> expand = "HORIZONTAL", >> size = "200", >> usersize = "350x0", >> value = "Henry Mullins", >> }, >> }, >> iup.hbox{ >> iup.label{ >> size = "80", >> usersize = "140x0", >> title = "Relationship:", >> }, >> iup.text{ >> expand = "HORIZONTAL", >> size = "200", >> usersize = "350x0", >> }, >> }, >> iup.hbox{ >> iup.label{ >> size = "80", >> usersize = "140x0", >> title = "Sex:", >> }, >> iup.list{ >> expand = "HORIZONTAL", >> size = "200", >> usersize = "350x0", >> ["1"] = "Male", >> ["2"] = "Female", >> ["3"] = "Unknown", >> dropdown = "YES", >> }, >> }, >> iup.hbox{ >> iup.label{ >> size = "80", >> usersize = "140x0", >> title = "Age:", >> }, >> iup.text{ >> expand = "HORIZONTAL", >> size = "200", >> usersize = "350x0", >> mask = "/d+[dwmy]", >> }, >> }, >> iup.hbox{ >> iup.label{ >> size = "80", >> usersize = "140x0", >> title = "Marriage Status:", >> }, >> iup.list{ >> expand = "HORIZONTAL", >> size = "200", >> usersize = "350x0", >> ["1"] = "Single", >> ["2"] = "Married", >> ["3"] = "Widower", >> ["4"] = "Widow", >> dropdown = "YES", >> }, >> }, >> iup.hbox{ >> iup.label{ >> size = "80", >> usersize = "140x0", >> title = "Years Married:", >> }, >> iup.text{ >> expand = "HORIZONTAL", >> size = "200", >> usersize = "350x0", >> }, >> }, >> iup.hbox{ >> iup.label{ >> size = "80", >> usersize = "140x0", >> title = "Children Born:", >> }, >> iup.text{ >> expand = "HORIZONTAL", >> size = "200", &
Re: [Iup-users] Using the iup.scrollbox
size = "80", usersize = "140x0", title = "Employment Status:", }, iup.text{ expand = "HORIZONTAL", size = "200", usersize = "350x0", }, }, iup.hbox{ iup.label{ size = "80", usersize = "140x0", title = "At Home:", }, iup.text{ expand = "HORIZONTAL", size = "200", usersize = "350x0", }, }, iup.hbox{ iup.label{ size = "80", usersize = "140x0", title = "Where Born:", }, iup.text{ expand = "HORIZONTAL", size = "200", usersize = "350x0", }, }, iup.hbox{ iup.label{ size = "80", usersize = "140x0", title = "Nationality:", }, iup.text{ expand = "HORIZONTAL", size = "200", usersize = "350x0", }, }, iup.hbox{ iup.label{ size = "80", usersize = "140x0", title = "Infirmity:", }, iup.text{ expand = "HORIZONTAL", size = "200", usersize = "350x0", }, }, iup.hbox{ iup.label{ size = "80", usersize = "140x0", title = "Record:", }, iup.button{ expand = "HORIZONTAL", size = "200", usersize = "350x0", title = "Record - Select or Create ...", }, }, }, canfocus = "NO", scrollbar = "VERTICAL", xmax = "0", dy = "334", ymax = "583", wheeldropfocus = "YES", }, iup.vbox{ iup.hbox{ iup.button{ expand = "HORIZONTAL", padding = "4x4", title = "OK", active = "0", }, iup.button{ expand = "HORIZONTAL", padding = "4x4", title = "Cancel", }, }, iup.scrollbox{ iup.frame{ iup.label{ expand = "YES", title = "Relationship cannot be empty\\nSex selection required\\nAge cannot be empty\\nMarriage Status selection required\\nRecord must be selected\\n", alignment = ":ATOP", font = "Tahoma, 10", }, }, maxsize = "x100", canfocus = "NO", xmax = "515", dx = "515", dy = "100", ymax = "100", wheeldropfocus = "YES", }, }, margin = "10x2", expandchildren = "YES", gap = "5", minsize = "300", }, title = "England and Wales 1911 Census Data Input", } return dialogDump end On Tue, 10 Mar 2020 at 12:42, Antonio Scuri wrote: > That depends on what's inside the fieldlist. If you provide a complete > sample code I can test it here. > > Best, > Scuri > > > Em seg., 9 de mar. de 2020 às 16:02, Jane Taubman > escreveu: > >> I have the following >> >> dlg = >> iup.dialog{title=sTitle,iup.vbox{iup.hbox{iup.label{title=sTopMessage},margin='4x2'}, >> iup.frame{iup.scrollbox{fieldlist,scrollbar="VERTICAL",expand="YES"}},lButtons,iup.scrollbox{iup.frame{warning,margin='10x2'},maxsize="x100"}, >> margin='10x2'}, gap="5",minsize="300"} >> >> The field list is an vbox container. When first displayed it is fully >> displayed, but when I slightly change the dialog size the scroll box >> around the field list shrink. >> >> Can anyone spot what I have done wrong? >> >> >> >> -- >> Jane. >> >> Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk >> ___ >> Iup-users mailing list >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > ___ > Iup-users mailing list > Iup-users@lists.sourceforge.net > 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 Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] Using the iup.scrollbox
I have the following dlg = iup.dialog{title=sTitle,iup.vbox{iup.hbox{iup.label{title=sTopMessage},margin='4x2'}, iup.frame{iup.scrollbox{fieldlist,scrollbar="VERTICAL",expand="YES"}},lButtons,iup.scrollbox{iup.frame{warning,margin='10x2'},maxsize="x100"}, margin='10x2'}, gap="5",minsize="300"} The field list is an vbox container. When first displayed it is fully displayed, but when I slightly change the dialog size the scroll box around the field list shrink. Can anyone spot what I have done wrong? -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Using iup.txt to create an autofill box
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 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 > 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 >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > _______ > Iup-users mailing list > Iup-users@lists.sourceforge.net > 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 Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] GetParam with %h
> > You miss passing the label to the GetParam. This: > > *lbl* = iup.label{size="200x5"} > > iup.GetParam("Title", nil, > "Boolean: %s\n%h \n", > pboolean, *lbl*) > Thank you that worked just fine and your alternate solution was what I tried to start with but I could not work out how I needed to use GetParamParam etc ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] GetParam with %h
I have been trying to workout how to pass the handle into the GetParam dialog when building the string, but I can not work out what it wants, if I give it l it fails concatenation. l = iup.label{size="200x5"} pboolean = 1 ret, pboolean = iup.GetParam("Title", nil, "Boolean: %s\n%h \n", pboolean) if (not ret) then return end All I was trying to do was make the prompt box wider as I need the %s items to be about 3 times as long as they default to. Any ideas please let me know -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Using iup.txt to create an autofill box
> > 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 Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Using iup.txt to create an autofill box
Just to add to my previous email, I think can use the iup.list function, but even though I have enabled the EDITBOX option, I don't seem to be able to type a new entry into the box, I have missed setting a parameter? On Sun, 1 Mar 2020 at 08:43, Jane Taubman wrote: > I just wondered if anyone has created an autofill text box. > > By this I mean a box where you start typing and an option appears below > and pressing tab completes the field with the suggested value. > > Any ideas and sample code appreciated. I am working in Lua > > -- > Jane. > > Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk > -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] Using iup.txt to create an autofill box
I just wondered if anyone has created an autofill text box. By this I mean a box where you start typing and an option appears below and pressing tab completes the field with the suggested value. Any ideas and sample code appreciated. I am working in Lua -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] GetParam with Native Windows in lua
Thanks. Ok, I have found a work around for IupMessageAlarm, by creating a "parent" dialog in iup whose parent is the main application. However I can not work out how to access the iup dialog name to use in SetAttribute which wants a string. If I use an IUP dialog as the parent for iup.Getparam() how do I get the name to use in iup.SetAttribute("PARENTDIALOG",h) so iup.GetParam can be a child of the "parent" sub window. On Fri, 28 Feb 2020 at 18:11, Antonio Scuri wrote: > Hi, > > *PARENTDIALOG *is the name of a dialog in IUP. In IupLua, if you set an > IUP object Ihandle as attribute will automatically finds its name, or even > generates a name, and do the association. For example, > > parent_dialog1 = iup.dialog{... > > child_dialog = iup.dialog{ parentdialog = parent_dialog1, ... > > In IupLua, the handle of a dialog or image, or any resource, is > automatically translated to its name, when set as an attribute of another > dialog or element. > > *NATIVEPARENT *explicitly states that instead of a regular IUP handle, > it expects a "native" handle, in that case you can use a HWND in Windows. > In any other situation, you can not. > > If you have a window that is not a regular IUP dialog, you can use it as > parent only using this attribute. I don't think you will be able to use it > as parent for a IupAlarm, neither in IupMessageAlarm where a Ihandle is > expected. > > Best, > Scuri > > > Em sex., 28 de fev. de 2020 às 11:21, Jane Taubman > escreveu: > > > > Back in June Antonio posted > > > > IupAlarm and IupGetParam internally use IupDialogs, but both are > functions that create and show pre-defined dialogs. Usually they are > configured through a callback (IupGetParam) or global attributes > (IupAlarm). Although they are not NATIVEPARENT friendly. It will be not > simple to use NATIVEPARENT with them, but it is possible, at least for > IupGetParam. > > > > > > > > I am using function which returns a light user object which can be used > with standard dialogues using > > h = fhGetContextInfo("CI_PARENT_HWND") > > iup.SetAttribute(filedlg, "NATIVEPARENT",h); -- Set the parent window > handle > > > > where filedlg is a standard iup dialog. > > > > However using > > iup.SetGlobal("PARENTDIALOG",fhGetContextInfo("CI_PARENT_HWND")) > > > > fails saying it wants a string and not a light user object. > > > > I also get the same problem with > > > > local h=fhGetContextInfo('CI_PARENT_HWND') > > local r = iup.MessageAlarm(h, 'Question' , sQuestion..'?', 'YESNO') > > > > Is there a way to get from the light user object I have to something > usable with these dialogues please. > > > > > > > > -- > > Jane. > > > > Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk > > ___ > > Iup-users mailing list > > Iup-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/iup-users > ___ > Iup-users mailing list > Iup-users@lists.sourceforge.net > 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 Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] GetParam with Native Windows in lua
Back in June Antonio posted IupAlarm and IupGetParam internally use IupDialogs, but both are functions that create and show pre-defined dialogs. Usually they are configured through a callback (IupGetParam) or global attributes (IupAlarm). Although they are not NATIVEPARENT friendly. It will be not simple to use NATIVEPARENT with them, but it is possible, at least for IupGetParam. I am using function which returns a light user object which can be used with standard dialogues using h = fhGetContextInfo("CI_PARENT_HWND") iup.SetAttribute(filedlg, "NATIVEPARENT",h); -- Set the parent window handle where filedlg is a standard iup dialog. However using iup.SetGlobal("PARENTDIALOG",fhGetContextInfo("CI_PARENT_HWND")) fails saying it wants a string and not a light user object. I also get the same problem with local h=fhGetContextInfo('CI_PARENT_HWND') local r = iup.MessageAlarm(h, 'Question' , sQuestion..'?', 'YESNO') Is there a way to get from the light user object I have to something usable with these dialogues please. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] Lua, UTF-16 and iup.clipboard
I am using Lua 5.3 IUP 3.26 I am trying to get the HTML text from the clipboard using require "iuplua" local clipboard = iup:clipboard() local script clipboard.format = 'text/html' if clipboard.formatavailable == 'YES' then script = clipboard.formatdata print(clipboard.FORMATDATASIZE) print(#script,script) end When I run the above the formatdata size returns 64, but my script string terminates at the first null what appears to be a UTF-16 HTML string. How do I get the whole contents back from the clipboard please, I have a function to convert UTF-16 to UTF-8 if I can get the whole string back to a variable. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk | www.fhug.org.uk ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Using iup,Append with Tabs in Lua
Not to worry I have found what I was doing wrong in an earlier post. I needed to change the code as follows: -- Add Quick Search local inp_search = iup.text{expand="HORIZONTAL" } function inp_search:killfocus_cb() local name = self.value local newtab = iup.vbox{iup.webbrowser{value=linktemplate:gsub('{n}',name)};tabtitle=name} iup.Append(tabs,newtab) iup.Map(newtab) iup.Refresh(tabs) tabs.value = newtab end On 9 October 2013 12:11, Jane Taubman wrote: > I am trying to add a tab to an existing tab set using append. The tab is > added when I exit the field, and the name is shown, but the contents are > not shown. I have included the code below please could someone tell me > what I am doing wrong. > > -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] Using iup,Append with Tabs in Lua
I am trying to add a tab to an existing tab set using append. The tab is added when I exit the field, and the name is shown, but the contents are not shown. I have included the code below please could someone tell me what I am doing wrong. iup version is 3.7 require( "iupluaweb" ) local linktemplate = ' http://www.behindthename.com/php/extra.php?extra=n&terms={n}' local strGivenNames = "Fred George" -- Build a Tab for each Given Name local tablist = {} local tc = 0 for name in string.gmatch(strGivenNames, "%a+") do tc = tc + 1 tablist[tc] = iup.vbox{iup.webbrowser{value=linktemplate:gsub('{n}',name)} , tabtitle=name} end -- Creates tabs local tabs = iup.tabs{unpack(tablist)} -- Add Quick Search local inp_search = iup.text{expand="HORIZONTAL" } function inp_search:killfocus_cb() local name = self.value local newtab = iup.vbox{iup.webbrowser{value=linktemplate:gsub('{n}',name)};tabtitle=name} iup.Append(tabs,newtab) end -- Creates dialog local dlg = iup.dialog{iup.vbox{iup.label{title="Search for"},inp_search,tabs; margin="10x10"}; title="Behind The Name", size="HALFxHALF", close_cb=function() return iup.CLOSE end} -- Shows dialog in the center of the screen dlg:showxy(iup.CENTER, iup.CENTER) if (iup.MainLoopLevel()==0) then iup.MainLoop() end -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] iup,clipboard - creating an html clip
On 21 December 2012 02:34, Antonio Scuri wrote: > > I had to make a very simple fix in the Windows driver to enable the multiple format copy. Just committed to the CVS. It will be available in the pre-compiled binaries at the next version scheduled to April 2013. Thanks very much, I will give it a try. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] iup,clipboard - creating an html clip
On 6 December 2012 11:48, Antonio Scuri wrote: > clipboard = iup:clipboard() > clipboard.addformat = 'HTML Format' > > clipboard.format = 'HTML Format' > > clipboard.formatdatasize = htmltemplate:len()+1 > > clipboard.formatdata = htmltemplate > Thanks for taking the time to look at this for me. I have tried that and it works to an extent, I can't work out the fragment positions either, but will experiment. However only being able to put one format in does pose a slight problem as Windows does not seem to auto populate the other formats. So if I copy in the sample, it only exists in HTML Format and can not be pasted to a text editor which only accepts text. This is not a problem for the task in hand, but it would be helpful to be able to do this, when you have the time to look at it. I am away myself from tomorrow and will be "off grid" for a week or so. If it's any help I use a free windows clipboard tool called CLCL<http://www.nakka.com/soft/clcl/index_eng.html> which displays the contents of the clipboard and the formats it contains and makes it easy to see the formats. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] iup,clipboard - creating an html clip
I am currently using IUP with Lua on a windows system. What I would like to do, is load the clipboard with a set of html text so that when it's pasted to another program, it is formatted correctly. At the moment I have tried "HTML" and "CF_HTML" in the format fields, but when the text is pasted in to Evernote it appears as the original text. I have tried to follow the instructions on the help page, but as I have only ever written text to the clipboard previously realise I am probably doing completely the wrong method. When I review the contents in the clipboard viewer only the text version is registered. Any help appreciated. htmltemplate = [[ Version:0.9 StartHTML:71 EndHTML:170 StartFragment:140 EndFragment:160 StartSelection:140 EndSelection:160 The HTML Clipboard http://sample/specs";> The Fragment ]] clipboard = iup:clipboard() clipboard.format = 'HTML' clipboard.text = striptags(htmltemplate) clipboard.FORMATDATASIZE = htmltemplate:len() clipboard.FORMATDATA = htmltemplate Thanks in advance. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Using IUP with LuaCom to control IE
Thanks for replying. I think I have cracked the syntax now. So I'll post it here in case some one needs it. using the example code if you add myfield = control.com.Document:getElementById('myvalue') print(o2.InnerHtml) You can get the values from any DOM element, but you need to get the element and then access it via a variable. On 21 December 2011 16:00, Antonio Scuri wrote: > I guess it is something related to the LuaCOM objects. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] Using IUP with LuaCom to control IE
I can create an HTML (IE) window in an IUP dialog and navigate to a page using the example in the example files http://www.tecgraf.puc-rio.br/iup/examples/Lua/olecontrol_browser.wlua and get back the main document using ohtml = control.com.Document.DocumentElement.InnerHtml BUT I can not work out the syntax to get an element by ID and although I can find examples in other languages none seem to work in Lua. So I am hoping someone can point me in the right direction. Thanks -- Jane. -- Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev ___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Setting the Minimum Size on a dialogue,
Thank you very much for all those answers, I will give them all a try. On 4 August 2011 17:06, Antonio Scuri wrote: > In your code, there is a problem: > > ** ** > > dlg.minsize = dlg.size > > ** ** > > because “minsize” is in pixels and “size” is in character units. I think > that what you want is: > > ** ** > > dlg.minsize = dlg.rastersize > > ** ** > -- > Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] Setting the Minimum Size on a dialogue,
I am using expand with a dialog to let iup calculate the size of a dialog, issuing a show and setting the minsize from the dialog size, how ever the size I am getting back is not the same as the actual size on the screen. The size (on my screen is returned as 640x217, but if I screen grab the window it's 960x527 (on Windows 7 x64) I have posted the whole function and caller below. Am I going about this the wrong way or should this be possible? -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk --Creates a simple dialog. - Start Search Replace Prompt function srPrompt(txtType,strFrom,strTo,bConfirm) local btn_ok = iup.button { title="Ok",padding = '5x5',size='50'} local btn_skip = iup.button { title="Skip",padding = '5x5',size='50'} local btn_cancel = iup.button { title="Cancel",padding = '5x5',size='50'} local inp_from_string = iup.text{expand="HORIZONTAL",minsize='200'} local inp_to_string = iup.text{expand="HORIZONTAL"} local inp_confirm = iup.toggle {'1'} if txtType == "M" then inp_from_string.multiline = 'YES' inp_from_string.size = '0x80' inp_from_string.wordwrap = 'YES' inp_to_string.multiline = 'YES' inp_to_string.size = '0x80' inp_to_string.wordwrap = 'YES' end local bSkip = false local bQuit = false local vbox = iup.vbox { iup.label {title="Original"}, inp_from_string, iup.label {title="Replacement"}, inp_to_string, iup.hbox { iup.label {title="Confirm All Replacements"}, inp_confirm}, iup.hbox{ btn_ok,btn_skip,btn_cancel,expandchildren = 'YES', expand="YES"}, expandchildren = 'YES', alignment = 'ACENTER', gap = '10', margin = '10x10',expand="YES" } local dlg = iup.dialog{vbox;expandchildren = 'YES', title="Search and Replace",size="HALF", startfocus=btn_ok} function btn_ok:action(dlg) return iup.CLOSE end function btn_skip:action(dlg) bSkip = true return iup.CLOSE end function btn_cancel:action(dlg) bQuit = true return iup.CLOSE end inp_from_string.value = strFrom inp_to_string.value = strTo if bConfirm then inp_confirm.value = 'ON' else inp_confirm.value = 'OFF' end dlg:show() print (dlg.size) dlg.minsize = dlg.size iup.MainLoop() strFrom = inp_from_string.value strTo = inp_to_string.value bConfirm = (inp_confirm.value == 'ON') dlg:destroy() return strFrom,strTo,bConfirm,bSkip,bQuit end - End Search Replace Prompt bSkip = false bQuit = false bConfirm = true frmString,toString,bConfirm,bSkip,bQuit = srPrompt('M',frmString,toString,bConfirm) print(frmString,toString,bSkip,bQuit,bConfirm) -- Got Input? Slashdot Needs You. Take our quick survey online. Come on, we don't ask for help often. Plus, you'll get a chance to win $100 to spend on ThinkGeek. http://p.sf.net/sfu/slashdot-survey___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Problem with the GetParm dialog in Lua
Sorry one more question. When the 3rd button is pressed on GetParm, I can trap it fine in the handling function, what I then want to do is to set a flag and then mimic the OK button being pressed is this possible or do I need to use a full blown dialog window. Thanks again for all your help. On 25 July 2011 19:10, Antonio Scuri wrote: > >> Put the “Bt” option at last. It will work. Can’t remember why this >> restriction. I’ll check. >> > -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- Storage Efficiency Calculator This modeling tool is based on patent-pending intellectual property that has been used successfully in hundreds of IBM storage optimization engage- ments, worldwide. Store less, Store more with what you own, Move data to the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Problem with the GetParm dialog in Lua
Thanks that worked fine. On 25 July 2011 19:10, Antonio Scuri wrote: > Put the “Bt” option at last. It will work. Can’t remember why this > restriction. I’ll check. > > ** > -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- Storage Efficiency Calculator This modeling tool is based on patent-pending intellectual property that has been used successfully in hundreds of IBM storage optimization engage- ments, worldwide. Store less, Store more with what you own, Move data to the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
Re: [Iup-users] Problem with the GetParm dialog in Lua
On 22 July 2011 16:08, Antonio Scuri wrote: > The objective of iup.GetParam is to get a “param”. You only specified the > button and no parameter. It needs at least one parameter. > > ** > This also fails function parmaction (dialog,index) print(index) status = index end status = 0 pa ={text=1,longtext=1,name=1,place=1,wordlist=1} pConfirm = 1 -- Prompt User to Confirm Options bOK, strSearch,strReplace,pConfirm,pa.text,pa.longtext,pa.name,pa.place,pa.wordlist = iup.GetParam("Text Search and Replace", parmaction, "Bt %u[OK,TEST]\n".. "Search For: %s\n".. "Replace with: %s\n".. "Confirm Every Change: %b\n".. "Replace in the following Classes %t\n".. "Text fields: %b\n".. "Long Text: %b\n".. "Names: %b\n".. "Places: %b\n".. "Wordlists: %b\n", "","",pConfirm,pa.text,pa.longtext,pa.name,pa.place,pa.wordlist) print(bOK, status) removing "Bt %u[OK,TEST]\n".. makes it work again. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] Problem with the GetParm dialog in Lua
This is probably "user error", but I can't get the GetParm to work overriding the buttons. I presume I have a newish version as I have access to IupLayoutDialog which came in V3.3 My code is result = iup.GetParam("Test",parmaction, 'bt %u[OK,Skip,Cancel] /n this is some text %t /n' ) print(result) The dialog does not appear and the result value is false -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- 5 Ways to Improve & Secure Unified Communications Unified Communications promises greater efficiencies for business. UC can improve internal communications as well as offer faster, more efficient ways to interact with customers and streamline customer service. Learn more! http://www.accelacomm.com/jaw/sfnl/114/51426253/___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
[Iup-users] iup.getparm adds enter to field
I am not sure if this is by design, when using getParm under Lua (on Windows) if the user presses enter on a field, it correctly treats this as an equivalent of pressing the OK button, but the returned string field which was active when enter is pressed appears to contain a linefeed. -- Jane. Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk -- AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev___ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users