When you set the formatting in only a selection the remaining is preserved
if you did not clear it.
Scuri
Em 19/08/2014 19:51, "Milind Gupta" <[email protected]> escreveu:
> Thanks, that makes it work. So there is no way to incrementally add/remove
> formatting to the text box? Like make a certain word bold without changing
> everything else? To make it work now I think I would have to keep track of
> all formatting and set it every time I want to change the formatting.
>
> Milind
>
>
>
> On Tue, Aug 19, 2014 at 2:32 PM, Antonio Scuri <[email protected]>
> wrote:
>
>> First, instead of using ACTION I recommend using VALUECHANGED_CB. It is
>> faster.
>>
>> Then you can formatting tags but you have to create the tag with IupUser
>> every time you want to set a format.
>>
>> Best,
>> Scuri
>>
>>
>>
>> On Tue, Aug 19, 2014 at 5:08 PM, Milind Gupta <[email protected]>
>> wrote:
>>
>>> So what is the method to add formatting to the text at run time as text
>>> is added to the control?
>>>
>>>
>>>
>>>
>>> On Tue, Aug 19, 2014 at 7:38 AM, Antonio Scuri <[email protected]>
>>> wrote:
>>>
>>>> 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
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Iup-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Slashdot TV.
>> Video for Nerds. Stuff that matters.
>> http://tv.slashdot.org/
>> _______________________________________________
>> Iup-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Iup-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users