Re: $editable->paste_clipboard() bug?



"Gregory S. Hayes" wrote:

For some reason when I use the following:

        $textbox->set_editable(1);
        $textbox->paste_clipboard();
        $textbox->set_editable(0);
        $textbox->insert_text("testing 1 2 3\n");
        $clipboard = $textbox->get_chars( 0, -1 );
        print $clipboard . "\n";

I only get "testing 1 2 3" in $clipboard. When I paste a second time
get_chars returns the contents of $textbox just before the paste event
(original paste + "testing 1 2 3").

Am I doing something wrong, or is this a bug?
Hi all,

I would also like to know how the clipboard is meant to be used. 

I added a binding for gtk_editable_clipboard_text() to my copy of
Gtk-Perl-0.7008/Gtk/xs/GtkEditable.xs with:
-------------------------------------------------------------------
char *
clipboard_text (editable, newvalue=&PL_sv_undef)
    Gtk::Editable editable
    SV * newvalue

    CODE:
    {
        RETVAL = editable->clipboard_text;
        if (items>1) {
                char * l = SvOK(newvalue) ? SvPV(newvalue, PL_na) : 0;
                editable->clipboard_text = l;
        }
    }
    OUTPUT:
    RETVAL
-------------------------------------------------------------------

I am not very good with XS so this may be completely wrong but it is
supposed to return what is in the editable's clipboard if you call:
    print $form->{'text1'}->clipboard_text, "\n";

and also then reset it if you supply a value like:
    $form->{'text1'}->clipboard_text("NEW TEXT");

Does anybody have a Perl example of using the clipboard properly?

Regards, Dermot




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]