Re: How to control focus "manually"

From: Date: Sun, 02 Nov 2003 03:34:24 +0000
Subject: Re: How to control focus "manually"
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4037@lists.php.net to get a copy of this message
Hello all, Another update... Did some experimenting and research and now I'm stuck at this point: I found out that "signal_handler_block" seems to be the "cool" function to handle my issue. What I did was: function focus-out_callback_function () { /* blah, blah, blah */
       # block my signal handler
       $this->arWidgets["txtQtd"]->signal_handler_block($this->arConnIds["txtQtd"]);
       # reset focus; because signal handler is blocked, it won't trigger another "focus-out" event! :-)
       $this->wndVenda->set_focus($this->arWidgets["txtCP"]);
        # restore things to normal
       $this->arWidgets["txtQtd"]->signal_handler_unblock($this->arConnIds["txtQtd"]);
} In order to "signal_handler_block" to work, you'll have to save "connect" (or "connect_after") return result (the "connection ID"),which is neatly done by the "arConnIds" array. Problem now is: focus seems to go to the right place, but keyboard control moves on to the next field... :-( I thought "focus" related to keyboard control as well..... Any ideas? Thanks for bearing with me so far! Paulo. Paulo Bernardo Lindoso (UOL) wrote:
Hello all, Played around with the "connect_after" function, but I now found out what is going on but cannot find the solution... What seems to be happening is a race condition because of the "focus-out" event, that is if I place a "set_focus" call within a function that is called by "focus-out", it will trigger an "focus-out" event again creating an endless loop. What I need to solve this problem is to prevent this recursion, ie. if I call a "set_focus" from within a "focus-out" callback function, it won't call itself again. Is there any way to do that? Is there a way to "block" a signal just once? It seems that GTK's "signal_emit_stop" function does something like this, but I couldn't understand how to use it... Thanks for the tips so far! Paulo. Christian Weiske wrote:
Hi It seems to me, that an infinite loop begins when the "focus-out" event occurs. To which function did you connect this event? If something in this routine causes the adicionaproduto() function to be called which itself starts the other routine, you've got a never ending loop. Perhaps you should try it with "connect_after" and the "focus-out" event. Regards/MfG, Christian Weiske <<<<<<<<<<<<<<>>>>>>>>>>>>>>>>
     Christian Weiske
    cweiske@cweiske.de
      www.cweiske.de
<<<<<<<<<<<<<<>>>>>>>>>>>>>>>> Always forgetting birthdays? Try birthday reminder! http://www.cweiske.de/birthday.htm


« previous php.gtk.general (#4037) next »