Text widget does change its width and height. Why?? - Motif

This is a discussion on Text widget does change its width and height. Why?? - Motif ; Hi, I'm having problems with managing a text widget in a BulletinBoard. I have a function which comes on timer (4 seconds). In this function, I'm setting for the text widget same X, Y, Width, Height and font. The text ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Text widget does change its width and height. Why??

  1. Text widget does change its width and height. Why??

    Hi,
    I'm having problems with managing a text widget in a BulletinBoard. I
    have a function which comes on timer (4 seconds). In this function, I'm
    setting for the text widget same X, Y, Width, Height and font. The text
    that I'm writing in it is also the same. The problem is that when this
    function is first called, it displays the text widget correctly, with
    X, Y, W and H as I specified. But second time it puts another W and H.
    Again, the third times it puts the correctly W and H (as I specified)
    and so on. Practically, at every two calls of this callback timer
    function, the W and H values are modified after XtSetValues. If I'm not
    seting the font, the W and H values don't change !!! They remain with
    the correctly values all the time, at every timer calls. So, probably
    I'm doing something wrong at fontlist part.
    I'm writing also the code maybe someone's got a hint. Thank you so much
    for reading this .

    area it is a XmText
    screen_layout it's a XmBulletinBoard

    void display_widgets_temp(XtPointer client_data, XtIntervalId *id)
    {
    Arg al[55];
    int ac = 0;
    GEOM *Geom= (GEOM*)client_data;

    XtSetArg(al[ac], XmNeditable, FALSE); ac++;
    XtSetArg(al[ac], XmNcursorPositionVisible, FALSE); ac++;
    XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
    XtSetArg(al[ac], XmNautoShowCursorPosition, FALSE); ac++;
    XtSetArg(al[ac], XmNresizable, FALSE); ac++;

    char *pszRcvdMsg = new char[1000];sprintf(pszRcvdMsg," COMMUNICATION
    ERROR ")
    XFontStruct *font=NULL;
    XmFontList fontlist=NULL;

    char *namestring=NULL;
    namestring="*8x10*";
    font=XLoadQueryFont(XtDisplay(area),namestring);
    fontlist=XmFontListCreate(font,XmSTRING_DEFAULT_CH ARSET);
    XtSetArg(al[ac], XmNfontList, fontlist); ac++; //here, if i'm not
    seting this fontlist it's ok at every callback on timer. still, I need
    this font !

    XtSetArg(al[ac], XmNx, 180); ac++;
    XtSetArg(al[ac], XmNy, 140); ac++;
    XtSetArg(al[ac], XmNwidth, 240); ac++;
    XtSetArg(al[ac], XmNheight, 160); ac++;

    XtSetValues(area, al, ac);

    XmTextSetString(area, pszRcvdMsg);
    XmTextSetHighlight(area, 0, strlen(pszRcvdMsg), XmHIGHLIGHT_SELECTED);

    Geom->nX+=20;

    XtAppAddTimeOut(app_context,
    (unsigned long) 4000, /* milliseconds */
    display_widgets_temp,
    (XtPointer*)Geom) ;
    delete[] pszRcvdMsg;
    }


  2. Re: Text widget does change its width and height. Why??

    May be you have geometry attachments with that TextWidgets, or
    something of stuff, setting XmNwidth & XmNheight doesnt hardcode
    widget geometry...
    HTH :-)


+ Reply to Thread