Re: 2 (simple?) questions

2002-08-20 Thread John . Cupitt

Krzysztof Magrel wrote:
> I've got Segmentation Fault :_(
> My function to change active widget looks like:
> 
> void
> przejdz (char *element, GtkWidget * mw)
> {
> // Change active widget to widget with name element
>   GtkWidget *w;
>   if ((w = lookup_widget (mw, element)) == NULL)
> return;
>   gtk_widget_grab_focus (w);
>   return;
> }
> 
> and for example:
> 
> przejdz("entry3",main_window);
> 
> make 1 or 2 seconds without reaction (coursor doesn't) change it's
position
> (program freezes) and after this time window closes with Segmentation
Fault
> message.

Something else is broken :-( maybe you're trying to warp the focus to a 
widget that's not been built properly yet?

This works for me:

--
#include 

int
main (int argc, char *argv[])
{
   GtkWidget *window;
   GtkWidget *vbox;
   GtkWidget *button1;
   GtkWidget *button2;

   gtk_init (&argc, &argv);

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE);

   vbox = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (window), vbox);

   button1 = gtk_button_new_with_label ("foo");
   gtk_box_pack_start (GTK_BOX (vbox), button1, TRUE, TRUE, 0);
   button2 = gtk_button_new_with_label ("bar");
   gtk_box_pack_start (GTK_BOX (vbox), button2, TRUE, TRUE, 0);

   gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
  GTK_SIGNAL_FUNC (gtk_widget_grab_focus),
  GTK_OBJECT (button2));
   gtk_signal_connect_object (GTK_OBJECT (button2), "clicked",
  GTK_SIGNAL_FUNC (gtk_widget_grab_focus),
  GTK_OBJECT (button1));

   gtk_widget_show_all (window);

   gtk_main ();

   return 0;
}
--

John



== 
Fabric of Vision 
Dress and Drapery in Painting 

19 June - 8 September 2002 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/fabric/
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



RE: 2 (simple?) questions

2002-08-20 Thread Krzysztof Magrel



> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, August 20, 2002 8:09 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: 2 (simple?) questions
>
>
> Krzysztof Magrel wrote:
> >>>2. How can I change active widget? Tab key only can change coursor
> >>>position
> >>>to the next widget. I want to change active widget from
> >>
> >>source level. (It
> >>
> >>>depends what user of program will do). I know that it is
> >>
> >>not possible for
> >>
> >>>some widgets (ie.labels, etc).
> >>
> >
> > I use gtk-1.2. I tried to find, but niether gtk_widget_grab_focus or
> > gtk_widget_activate doesnt work for me :(
> > And for 1st question i have no Idea :_(
>
> Hi, gtk_widget_grab_focus() works for me, what problem were
> you having
> with it?
I've got Segmentation Fault :_(
My function to change active widget looks like:

void
przejdz (char *element, GtkWidget * mw)
{
// Change active widget to widget with name element
  GtkWidget *w;
  if ((w = lookup_widget (mw, element)) == NULL)
return;
  gtk_widget_grab_focus (w);
  return;
}

and for example:

przejdz("entry3",main_window);

make 1 or 2 seconds without reaction (coursor doesn't) change it's position
(program freezes) and after this time window closes with Segmentation Fault
message.


>
> There are a bunch of freeze/thaw functions in gtk+-1.2, but
> they don't
> work very well and have all been removed for gtk2 (I think). gtk2 is
> much more sensible about painting the screen and you don't
> need this trick.
>
> John
>
>
>
> ==
> Fabric of Vision
> Dress and Drapery in Painting
>
> 19 June - 8 September 2002
>
> For information and tickets:
> http://www.nationalgallery.org.uk/exhibitions/fabric/
> ___
> gtk-list mailing list
> [EMAIL PROTECTED]
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
> Zgodz sie, co Ci szkodzi... >>> http://link.interia.pl/f163b
>
>

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: 2 (simple?) questions

2002-08-20 Thread John . Cupitt

Krzysztof Magrel wrote:
>>>2. How can I change active widget? Tab key only can change coursor
>>>position
>>>to the next widget. I want to change active widget from
>>
>>source level. (It
>>
>>>depends what user of program will do). I know that it is
>>
>>not possible for
>>
>>>some widgets (ie.labels, etc).
>>
> 
> I use gtk-1.2. I tried to find, but niether gtk_widget_grab_focus or
> gtk_widget_activate doesnt work for me :(
> And for 1st question i have no Idea :_(

Hi, gtk_widget_grab_focus() works for me, what problem were you having 
with it?

There are a bunch of freeze/thaw functions in gtk+-1.2, but they don't 
work very well and have all been removed for gtk2 (I think). gtk2 is 
much more sensible about painting the screen and you don't need this trick.

John



== 
Fabric of Vision 
Dress and Drapery in Painting 

19 June - 8 September 2002 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/fabric/
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



RE: 2 (simple?) questions

2002-08-19 Thread Martin Kestel


Krzysztof,

you want to use something with *freeze*, do things in memory and then *thaw*
your widget/application. I have used such things like gtk_text_freeze[thaw] or
with clists... A complete list of these functions should be in the
gtkwidget.h (the reply posted earlier).

For the second one I have no idea.

  Regards,

  Martin

>>
>> > 1. Is it possible to freeze display (and do something only
>> in memory) and
>> > unfreeze after program do what I want? I want to freeze
>> main_window and in
>> > this time I wanna show/hide widgets and add elements for
>> lists etc. It
>> > takes
>> > much more time (and looks not nice) when everytking is visible.
>>


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



RE: 2 (simple?) questions

2002-08-19 Thread Krzysztof Magrel



> > I have 2 questions. Perhaps someone knows solutions?
>
> > 1. Is it possible to freeze display (and do something only
> in memory) and
> > unfreeze after program do what I want? I want to freeze
> main_window and in
> > this time I wanna show/hide widgets and add elements for
> lists etc. It
> > takes
> > much more time (and looks not nice) when everytking is visible.
>
> > 2. How can I change active widget? Tab key only can change coursor
> > position
> > to the next widget. I want to change active widget from
> source level. (It
> > depends what user of program will do). I know that it is
> not possible for
> > some widgets (ie.labels, etc).
>
> For both of these questions you sould look in
> "gtk+-2.0/gtk/gtkwidget.h" in
> your include directory. There you should find answers. If you are not
> familiar with these files you can also take a look in the
> gtk+-2.0-reference manual
> at .
>
I use gtk-1.2. I tried to find, but niether gtk_widget_grab_focus or
gtk_widget_activate doesnt work for me :(
And for 1st question i have no Idea :_(

Could someone help?

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: 2 (simple?) questions

2002-08-19 Thread Simon Fuhrmann

Hi!

> I have 2 questions. Perhaps someone knows solutions?

> 1. Is it possible to freeze display (and do something only in memory) and
> unfreeze after program do what I want? I want to freeze main_window and in
> this time I wanna show/hide widgets and add elements for lists etc. It
> takes
> much more time (and looks not nice) when everytking is visible.

> 2. How can I change active widget? Tab key only can change coursor
> position
> to the next widget. I want to change active widget from source level. (It
> depends what user of program will do). I know that it is not possible for
> some widgets (ie.labels, etc).

For both of these questions you sould look in "gtk+-2.0/gtk/gtkwidget.h" in
your include directory. There you should find answers. If you are not
familiar with these files you can also take a look in the gtk+-2.0-reference manual
at .

Regards,

-- 
Simon Fuhrmann | [EMAIL PROTECTED] | www.dismember.de

GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list