It work in a regular situation, for example, use a button to scroll to
bottom. But it did not work with timer.

Antonio Scuri <antonio.sc...@gmail.com> 于2018年6月25日周一 下午7:59写道:

>   With the timer or in a regular situation?
>
> Em seg, 25 de jun de 2018 08:22, max chen <trls...@gmail.com> escreveu:
>
>> Yes, it works in Windows. But in Linux, I can't see the latest appended
>> string and the scroll bar will never reach the bottom.
>>
>> Antonio Scuri <antonio.sc...@gmail.com> 于2018年6月25日周一 下午6:14写道:
>>
>>>   Hi,
>>>
>>>   Your code is working in Windows and in Linux.
>>>
>>>   In Linux it takes a little longer to update the scrollbar because of
>>> the fast pace of the timer, but it is updated.
>>>
>>>   How does it behave on your system?
>>>
>>> Best,
>>> Scuri
>>>
>>>
>>> Em dom, 24 de jun de 2018 às 21:51, max chen <trls...@gmail.com>
>>> escreveu:
>>>
>>>> I want to use IupText to be a message output console, when message
>>>> append to IupText, I want to scroll to the bottom of IupText. I try the
>>>> following code, but it didn't work.
>>>>
>>>> [code]
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>> #include <string.h>
>>>> #include <iup.h>
>>>>
>>>> Ihandle *txt_message;
>>>>
>>>> int cb_timer(Ihandle *self)
>>>> {
>>>>     static int val;
>>>>     int line_cnt;
>>>>
>>>>     IupSetStrf(txt_message, "APPEND", "[%d]TEST TXT\n\r", val++);
>>>>     line_cnt = IupGetInt(txt_message, "LINECOUNT");
>>>>     IupSetStrf(txt_message, "SCROLLTO", "%d:1", line_cnt);
>>>>
>>>>     return IUP_DEFAULT;
>>>> }
>>>>
>>>> void create_main_dialog(void)
>>>> {
>>>>     Ihandle *dlg;
>>>>     Ihandle *timer;
>>>>
>>>>     timer = IupTimer();
>>>>     IupSetInt(timer, "TIME", 100);
>>>>     IupSetCallback(timer, "ACTION_CB", (Icallback)cb_timer);
>>>>     IupSetAttribute(timer, "RUN", "YES");
>>>>
>>>>     txt_message = IupText(NULL);
>>>>     IupSetAttribute(txt_message, "EXPAND", "YES");
>>>>     IupSetAttribute(txt_message, "READONLY", "YES");
>>>>     IupSetAttribute(txt_message, "MULTILINE", "YES");
>>>>     IupSetAttribute(txt_message, "APPENDNEWLINE", "NO");
>>>>
>>>>     dlg = IupDialog(
>>>>             IupSetAttributes(IupVbox(
>>>>                     txt_message,
>>>>                     NULL), "NMARGIN=10x10,GAP=10")
>>>>             );
>>>>
>>>>     IupSetAttribute(dlg, "TITLE", "RTT STLINK");
>>>>     IupSetAttribute(dlg, "RASTERSIZE", "800x600");
>>>>     IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
>>>> }
>>>>
>>>> int main(int ac, char** av)
>>>> {
>>>>     IupOpen(&ac, &av);
>>>>
>>>>     create_main_dialog();
>>>>     IupMainLoop();
>>>>
>>>>     IupClose();
>>>>     return 0;
>>>> }
>>>> [/code]
>>>>
>>>> Iup 3.25, linux 4.47, gtk+3.0
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> _______________________________________________
>>>> Iup-users mailing list
>>>> Iup-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Iup-users mailing list
>>> Iup-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Iup-users mailing list
>> Iup-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to