« Return to Thread: GtkEntry "insert-at-cursor" not working

Re: GtkEntry "insert-at-cursor" not working

by HalfBrian :: Rate this Message:

Reply to Author | View in Thread

Thanks a lot.  Do you think the docs need updating? I didn't see that signal in the GtkEntry page.  Was it somewhere else?

-Brian

Bob Majdak Jr-2 wrote:
you seem to be right, insert-at-cursor was not responding. however,  
key-press-event and key-release-event was. the following code worked  
for me. (i use key-release-event because i like to have my finger off  
the key before i see things working.

#!/usr/bin/php -c/etc/gtk/php.ini
<?php

class bob extends GtkWindow {
        public function __construct() {
                parent::__construct();
                $this->vbox = new GtkVBox;
                $this->add($this->vbox);
               
                $this->entry = new GtkEntry;
                $this->entry->connect_simple('key-release-
event',array($this,'on_insert'));
                $this->vbox->pack_start($this->entry);
               
                $this->connect_simple('delete-event',array($this,'on_quit'));
                $this->set_size_request(300,-1);
               
                $this->show_all();
                return;
        }
       
        public function on_insert() {
               
                $this->set_title($this->entry->get_text());
                       
                return;
        }
       
        public function on_quit() {
                Gtk::main_quit();
                return;
        }
}

new bob;
Gtk::main();

?>

- bob

On Sep 6, 2008, at 10:13 PM, HalfBrian wrote:

>
> I am trying to write an image resizer and I need to get two boxes to  
> update
> when one of them is updated (the width and height boxes, so that
> fixed-aspect is possible)  I figured out that I should use the
> insert-at-cursor of a GtkEntry to make that feasible.  I have the  
> following
> code:
>
> $txtWidth = new GtkEntry();
> $txtWidth->connect_simple("insert-at-cursor","test");
>
> Theoretically, it should work, but test() never gets called.  If I  
> change
> "insert-at-cursor" to "backspace", it works (test() is called).
>
> Any ideas? Am I going about this the wrong way?
>
> -HalfBrian
> --
> View this message in context: http://www.nabble.com/GtkEntry-%22insert-at-cursor%22-not-working-tp19353621p19353621.html
> Sent from the Php - GTK - General mailing list archive at Nabble.com.
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 « Return to Thread: GtkEntry "insert-at-cursor" not working