Re: Statusbar not showing proper message

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

 



having read david's response, i must obviously ammend my previous post:

1) my change to highlight the functionality is indeed missing the  
opportunity for the mainloop to do anything; code modified to  
explicitly have the mainloop do the work of posting the messages.

2) as has been discussed, gtk_events_pending() is not good gtk form,  
avoid it unless absoutely unable to.

3) and, the sleep() is intended only to illustrate, do not write such  
blocks in a GUI, this too is bad form, the user will get quickly  
frustrated and curse your name often.

richard


On Feb 23, 2007, at 11:01 AM, Richard Boaz wrote:

> hi,
>
> it's a bit difficult to understand your misunderstanding without  
> knowing exactly what you're expecting to see.
>
> as written, it performs exactly as i'd expect: message one is  
> displayed, which is immediately (and probably so quickly you don't  
> even see message one) replaced with message two; just as you describe.
>
> if you'd like to see message one, then don't push message two.  any  
> pushed message to the statusbar stack will become the visible  
> message, regardless the contents of the rest of the stack (having  
> the same context, of course).  and if you want to see message one  
> again, pop message two, etc.  (see example change to your code below).
>
> as well, you obtain the same context twice.  this is unnecessary to  
> do a second time if the context hasn't changed and isn't different  
> than the first.  what do you think this context is and why are you  
> fetching the same value twice?
>
> richard
>
> On Feb 23, 2007, at 10:42 AM, ashok@xxxxxxxxxxxxx wrote:
>
>>
>> Hello List,
>> I write one callback function on a button clicked.
>>
>> void
>> on_button1_clicked                     (GtkButton       *button,
>>                                         gpointer         user_data)
>> {
>>   GtkWidget *stat;
>>   guint cont;
>>   stat=lookup_widget(window1,"statusbar1");
>>
>>   cont=gtk_statusbar_get_context_id(stat,"context");
>>   gtk_statusbar_push(stat,cont,"statusbar one");
>>   system("find /home/ashok -name abc -type f");
>>
>>   cont=gtk_statusbar_get_context_id(stat,"context");
>>   gtk_statusbar_push(stat,cont,"statusbar two");
>>   system("find /home/ashok -name abc -type f");
>
	// display 1st and 2nd messages, 2nd is only visible
	while(gtk_events_pending())
		gtk_main_iteration();
>      sleep(1);

	// pop 2nd message off the stack, dispalying 1st
>     gtk_statusbar_pop(stat, cont);
>> }
>>
>> But when i run this program it shows only "statusbar two" string,  
>> means it
>> shows only last entry.
>> plz. help me, i'm not able to understand why it is showing like this.
>>
>> Thanks
>> Ashok
>>
>>
>>
>> --------------------------------------------------------------------
>> mail2web.com – Enhanced email for the mobile individual based on  
>> Microsoft®
>> Exchange - http://link.mail2web.com/Personal/EnhancedEmail
>>
>>
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list@xxxxxxxxx
>> http://mail.gnome.org/mailman/listinfo/gtk-list
>>
>>
>

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux