Hi,
Some functions in IUP only work after mapping.

    IupSetAttribute(logText, "APPEND",    "YES\n");
    IupSetAttribute(logText, "APPEND",    "NO\n");

"APPEND", I believe that is the case.

 IupShowXY, IupShow, execute the map.

best regards,
Ranier Vilela

________________________________________
De: Moore, Tysen <tysen_mo...@mentor.com>
Enviado: terça-feira, 24 de março de 2020 16:15
Para: iup-users@lists.sourceforge.net
Assunto: [Iup-users] IupText APPEND Question

I am new to the IUP project and so far so good.  I have an issue trying to 
append text to the IupText.  I have looked at the examples and it seems very 
straight forward.  It seems that all I need is:


IupSetAttribute(logText, "APPEND",    "Something\n");


However, this is not working for me. I wasn't sure if there something else I 
was missing.  My basic code is: (taken from the

IupSubmenu)


    Ihandle *dlg;
    Ihandle *logText;


    /* Initializes IUP */
    IupOpen( &argc, &argv );

    /* Creates a multiline */
    logText = IupText (NULL);

    /* Sets value of the text and turns on expand */
    IupSetAttribute(logText, "EXPAND",    "YES");
    IupSetAttribute(logText, "MULTILINE", "YES");
    IupSetAttribute(logText, "APPEND",    "YES\n");
    IupSetAttribute(logText, "APPEND",    "NO\n");

    /* Creates dialog with a text */
    dlg = IupDialog (logText);

    /* Sets title and size of the dialog and associates a menu to it */
    IupSetAttributes (dlg, "TITLE=\"IupSubmenu Example\", SIZE = 
QUARTERxEIGHTH");

    /* Shows dialog in the center of the screen */
    IupShowXY (dlg, IUP_CENTER, IUP_CENTER);
    IupSetFocus(logText);

    IupMainLoop();

    IupClose();


I expected to see the text:


YES

NO


Instead I have an empty IupText.  I then added a timer using: (from a different 
user list example)


    int cb_timer(Ihandle *self)
    {
        IupSetAttribute(logText, "APPEND", "SOMETHING\n");
        return IUP_DEFAULT;
    }


    Ihandle *timer;
    timer = IupTimer();
    IupSetInt(timer, "TIME", 1000);
    IupSetCallback(timer, "ACTION_CB", (Icallback)cb_timer);
    IupSetAttribute(timer, "RUN", "YES");


This code works as expected; every second it appends "SOMETHING" to the IupText.


Is there a call that needs to be made after the APPEND?  From the examples I've 
seen it seems this is not the case, unless there is something behind the scenes 
that is causing this text to be written.


Any advice would be much appreciated, thanks in advance.


Tysen


I am using Ubuntu 18.04 building for GTK. (in case this info helps)






_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to