Re: 答复: A question about GTK Scale

2008-04-17 Thread Alvis Koon
Hi,

No, you should not use closed loop for GTK application when you expect
responses.
Use gtk timeout mechanism instead of the dead while loop with sleep.

Try that, I am quite sure that would help.

Yours faithfully,

Alvis Koon

On 16/04/2008, Ke Jin [EMAIL PROTECTED] wrote:
 The problem is solved. Thanks!

  But it is still a little strange that I have tried the
  while(gtk_events_pending()) gtk_main_iteration(); before which didn't work.
  But after I changed:
 slider = gtk_vscale_new_with_range(0,1000,0.1);
  to
 GtkObject *adj1;
 adj1 = gtk_adjustment_new (0.0, 0.0, 1001, 0.1, 1.0, 1.0);
 slider = gtk_vscale_new (GTK_ADJUSTMENT (adj1));

  it did work.

  Any idea why?


  -邮件原件-
  发件人: Christopher Backhouse [mailto:[EMAIL PROTECTED]
  发送时间: 2008年4月16日 9:40
  收件人: Ke Jin
  抄送: gtk-app-devel-list@gnome.org
  主题: Re: A question about GTK Scale


  Perhaps it takes 2 iterations of the main loop for the vscale to update.
  What happens if you try
  while(gtk_events_pending()) gtk_main_iteration();
  instead?

  Ke Jin wrote:
   Dear All,
 I have a VScale in my interface and I created button named Play that
   once the button is clicked, the scale will move automatically.
  
   Below is the function connected to the button. And it performed strangely.
   The scale was not updated every iteration of the loop, which means the
  value
   of the scale changed from 0 to 2 then to 4 then 6and jumped over
   1,3,5...
  
   Does anyone have any idea why this happened?
  
   void playClick(GtkWidget *widget, VScale *slider)
   {
   double interval = 1;
   double currentTime =  gtk_range_get_value((GtkRange*)(slider));
  
  
   while(currentTime=20)
   {
   currentTime += interval;
   usleep(100);
   printf(current Time: %f\n,currentTime);
   gtk_range_set_value((GtkRange*)(gtkE-slider),currentTime);
   gtk_main_iteration();
   }
   }
  
   Many Thanks,
   Ke
  
   ___
   gtk-app-devel-list mailing list
   gtk-app-devel-list@gnome.org
   http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  

  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

GTK STOCK ascending and descending

2007-08-02 Thread Alvis Koon
Hi,

Just wonder, why the GTK stock item icon of A-Z ascending and
descending are displayed with blue and red arrows respectively?

In my opinion, it will give the user a sense of activation for turning red.
When turning blue, it looks as if deactivated.
Actually they can both activated in both sense.

Yours faithfully,

Alvis Koon
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_button_set_label ERROR

2006-04-06 Thread Alvis Koon
use:

GtkWidget button;

gtk_button_set_label(GTK_BUTTON(button));

How did you initialise the button, that is what I want to ask.

On 4/6/06, 3saul  [EMAIL PROTECTED] wrote:


 Hi all,

 Whenever I call gtk_button_set_label I get the following error and the
 function does not succeed.

 GTK-CRITICAL **: gtk_button_set_label: assertion 'GTK_IS_BUTTON (button)
 failed.

 Is there a common reason for this error? I get no errors or warnings when
 compiling.
 --
 View this message in context:
 http://www.nabble.com/gtk_button_set_label-ERROR-t1403878.html#a3778435
 Sent from the Gtk+ - Apps Dev forum at Nabble.com.

 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list