Hi,

You can not reuse the format tag. It is automatically destroyed when set.

Best,
Scuri



On Thu, Aug 14, 2014 at 9:48 PM, Antonio Scuri <[email protected]>
wrote:

> I will check that tomorrow.
>
> Scuri
> Em 14/08/2014 21:43, "Milind Gupta" <[email protected]> escreveu:
>
>> Hi,
>>       I was trying to learn how to use the formatting capabilities of
>> iuptext and I modified the multiline.wlua example in the examples
>> directory. Here is what I did:
>>
>> --  IupMultiline Simple Example in IupLua
>> --  Shows a multiline that ignores the treatment of the 'g' key,
>> canceling its effect.
>>
>> require( "iuplua" )
>>
>> ml = iup.text{MULTILINE = "YES", FORMATTING = "YES", expand="YES",
>> value="I ignore the 'g' key!", border="YES"}
>> tags = iup.user { bulk = "Yes", cleanout = "Yes" }
>>
>> ml.action = function(self, c, after)
>>    if c == iup.K_g then
>> iup.Append(tags, iup.user { selectionpos = "0:3", fgcolor = "255 0 0"})
>>  print("removed formatting")
>> ml.addformattag = tags
>> print("added format tag")
>>  return iup.IGNORE
>>   elseif c == iup.K_b then
>> iup.Append(tags, iup.user { selectionpos = "4:7", fgcolor = "0 255 0"})
>>  ml.addformattag = tags
>>     return iup.DEFAULT;
>>   else
>>     return iup.DEFAULT;
>>   end
>> end
>>
>> dlg = iup.dialog{ml; title="IupMultiline", size="QUARTERxQUARTER"}
>> dlg:show()
>>
>> if (iup.MainLoopLevel()==0) then
>>   iup.MainLoop()
>> end
>>
>> The 1st g press works fine and I get the foreground color then i press b
>> that although changes the next foreground color Lua crashes. It crashes
>> even if g is pressed the second time.
>>        I am trying to dynamically change the formatting of the text in
>> the text box. What am I doing wrong?
>>
>> Thanks,
>> Milind
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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

Reply via email to