gtk_adjustment_set_value and unexpected async sequence



Hi ,

I have a gtk application which is logs messages
in to the main window. I am inserting new messages
at the end. I want the scroll bar to automatically
move down. 

 I have the following code to achieve the same.It is
working fine but when I move the scrollbar up and
down with the mouse it hangs saying unexpected async
reply seuqence 0x49fe.
 

 If I comment out the call to gtk_adjustment_set_value
 this works fine (but not the way I want.).

Can somebody point out me what is the mistake here.




void setLogLine (char *pszText)
{
        GtkAdjustment *pAdj;            

/* Validate the input parameter. */
        if (!pszText && strlen (pszText))
        {
                return;
        }

        /* insert the text at the current position. */
        /* Freeze the  update on the text window. */
        gtk_text_freeze (GTK_TEXT (ptxtWidget));

        /* Insert the given text in to the widget. */
        gtk_text_insert (GTK_TEXT (ptxtWidget), ptxtFont,
&txtColor, NULL,pszText, strlen (pszText));
        /* Insert a new line also. */
        gtk_text_insert (GTK_TEXT (ptxtWidget), ptxtFont,
&txtColor, NULL,"\n", 1);
        /*resume the text update on the text display.*/
        gtk_text_thaw (GTK_TEXT (ptxtWidget));


        /* move the scroll bar down. */
        pAdj = gtk_range_get_adjustment
((GtkRange*)pvscrollBar);

        gtk_adjustment_set_value (pAdj, 
                CLAMP (pAdj->upper, pAdj->lower,
                (pAdj->upper - pAdj->page_size)));
        gtk_adjustment_value_changed (pAdj);
}


Thanks and Regards,

 thomas joseph








http://careers.yahoo.com.au - Yahoo! Careers
- 1,000's of jobs waiting online for you!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]