unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* bug in focus management
@ 2003-02-16 15:44 Stan Pinte
  2003-02-16 17:57 ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Stan Pinte @ 2003-02-16 15:44 UTC (permalink / raw)
  Cc: guile-gtk

hello,

I guess we have a bug in our focus management code, in guile-gtk-1.2-0.31.

Indeed, when a widget has the focus, a call to (gtk-widget-get ref-entry 'has-focus) returns #f.

the following code should proof the point.

Any idea?

thanks a lot,

Stan.

(use-modules (ice-9 format))
(use-modules (gtk gtk))

(let ((window (gtk-window-new 'toplevel))
      (button (gtk-button-new-with-label "Say Hello"))
      (ref-entry (gtk-entry-new)))
  (gtk-widget-set-name button "mybutton")
  (gtk-widget-set-name window "mywindow")
  (gtk-window-set-title window "Guile-Gtk: Hello World")
  (gtk-container-border-width window 10)
;  (gtk-container-add window button)
  (gtk-container-add window ref-entry)
  (gtk-signal-connect ref-entry "insert-text"
		      (lambda (new-text new-length position)
			(if (string? new-text)
			    (format #t "inserted: [~c]~%" (string-ref new-text 0))
			    (format #t "not text!!!~n"))))
	;;;shows the problem

  (gtk-signal-connect ref-entry "focus-in-event"
		      (lambda (entry)
			(format #t "focused [~A]. Has focused: ~A ~%" 
				ref-entry
				(gtk-widget-get ref-entry 'has-focus))))

	;;;end of problem

  (gtk-widget-show-all window)
  (gtk-standalone-main window))

-- 

Stanislas Pinte

Computer Consultant

	98, rue Bois l'Evêque
	B-4000 Liège

web:		http://www.altosw.be
email:		alto_stan@wanadoo.be



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug in focus management
  2003-02-16 15:44 bug in focus management Stan Pinte
@ 2003-02-16 17:57 ` Marius Vollmer
  2003-02-18  8:42   ` Stan Pinte
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Vollmer @ 2003-02-16 17:57 UTC (permalink / raw)
  Cc: guile-user

Stan Pinte <alto_stan@wanadoo.be> writes:

> Indeed, when a widget has the focus, a call to (gtk-widget-get ref-entry 'has-focus) returns #f.
> 
> Any idea?

Try 'has_focus instead of 'has-focus.  Also, the focus flag seems to
be set only after the "focus-in-event" handler has returned.  Try
printing the focus flag from the "insert-text" handler to observe
this.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug in focus management
  2003-02-16 17:57 ` Marius Vollmer
@ 2003-02-18  8:42   ` Stan Pinte
  2003-02-18 11:16     ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Stan Pinte @ 2003-02-18  8:42 UTC (permalink / raw)
  Cc: guile-user


indeed, calling 'has_focus after the "focus-in-event" does the trick!!!!

thanks a lot,

Stan.

It is weird, though, because the property is documented as "has-focus" in the Gtk docs...

Is this normal? Is there a rule to guess the right form?

Stan.

On 16 Feb 2003 18:57:30 +0100
Marius Vollmer <mvo@zagadka.de> wrote:

> Stan Pinte <alto_stan@wanadoo.be> writes:
> 
> > Indeed, when a widget has the focus, a call to (gtk-widget-get ref-entry 'has-focus) returns #f.
> > 
> > Any idea?
> 
> Try 'has_focus instead of 'has-focus.  Also, the focus flag seems to
> be set only after the "focus-in-event" handler has returned.  Try
> printing the focus flag from the "insert-text" handler to observe
> this.
> 
> -- 
> GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405
> 





_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug in focus management
  2003-02-18  8:42   ` Stan Pinte
@ 2003-02-18 11:16     ` Marius Vollmer
  0 siblings, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2003-02-18 11:16 UTC (permalink / raw)
  Cc: guile-user

Stan Pinte <alto_stan@wanadoo.be> writes:

> It is weird, though, because the property is documented as
> "has-focus" in the Gtk docs...
> 
> Is this normal? Is there a rule to guess the right form?

I have no idea.  I just tried a few things and suddenly one of them
worked.  I also looked at (gtk-widget-flags ...) to find out about the
has-focus flag.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-18 11:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-16 15:44 bug in focus management Stan Pinte
2003-02-16 17:57 ` Marius Vollmer
2003-02-18  8:42   ` Stan Pinte
2003-02-18 11:16     ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).