Crys
Lt. Commander
- Registriert
- Apr. 2009
- Beiträge
- 1.601
Servus Zusammen,
ich muss gestehen, dass ich noch nie wirklich oop programmiert habe und da wird auch das Problem liegen.
Für einen kleines PHP-GTK2 Skript benötige ich, dass der Inhalt eines Input-Feldes in die Zwischenablage kopiert wird, ich verstehe aber nicht ganz, wie ich die copy-clipboard-Funktion aufrufen soll?
Der gtk-Teil stimmt sowie, ist bis auf die Fuinktion aus dem Beispiel Skript übernommen.
Danke euch
ich muss gestehen, dass ich noch nie wirklich oop programmiert habe und da wird auch das Problem liegen.
Für einen kleines PHP-GTK2 Skript benötige ich, dass der Inhalt eines Input-Feldes in die Zwischenablage kopiert wird, ich verstehe aber nicht ganz, wie ich die copy-clipboard-Funktion aufrufen soll?
PHP:
<?
function copy2Clipboard(GtkLabel $cInpTest)
{
// http://gtk.php.net/manual/en/html/gtk/gtk.gtkentry.signal.copy-clipboard.html
//$strEntry = $cInpTest->get_text();
//$strEntry->copy-clipboard();
//connect('copy-clipboard', GtkEntry $entry);
//copy_clipboard();
$cInpTest->connect('copy-clipboard');
// Delete the Text
$cInpTest->set_text("");
}
//Create the window
$cWnd = new GtkWindow();
$cWnd->set_title('Test');
//Close the main loop when the window is destroyed
$cWnd->connect_simple('destroy', array('gtk', 'main_quit'));
$cLblTest = new GtkLabel('_Test', true);
$cInpTest = new GtkEntry("TextDerKopiertWerdenSoll");
$cButCopy = new GtkButton('_Kopieren');
//Call the login function when the user clicks
$cButCopy->connect_simple('clicked', 'copy2Clipboard', $cInpTest);
//Lay out all the widgets in the table
$cGuiTab = new GtkTable(1, 2);
$cGuiTab->attach($cLblTest, 0, 1, 0, 1);
$cGuiTab->attach($cInpTest, 1, 2, 0, 1);
//Add the button to a button box
$cGuiBox = new GtkHButtonBox();
$cGuiBox->set_layout(Gtk::BUTTONBOX_EDGE);
$cGuiBox->add($cButCopy);
//Add the table and the button box to a vbox
$cGuiVBox = new GtkVBox();
$cGuiVBox->pack_start($cGuiTab);
$cGuiVBox->pack_start($cGuiBox);
//Add the vbox to the window
$cWnd->add($cGuiVBox);
//Show all widgets
$cWnd->show_all();
//Start the main loop
Gtk::main();
?>
Danke euch