Re: Right-Click Menus
| From: | Malk0 | Date: | Fri, 29 Oct 2004 21:26:53 +0000 |
| Subject: | Re: Right-Click Menus | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5187@lists.php.net to get a copy of this message | ||
Hi,
like christian i didn't achieved to do this, the only way i found to
have a simple copy/past features was to auto-copy any selected text
and to paste with the middle click as you can do under some unix
system.
here's the sample code if it can help you
/**
windows support for mouse copy/paste as unix style
only connect the selected widget
button_press_event|leave-notify-event to this function
@param GtkEditable $call_wdgt an entry or text widget we want to
support this feature
@param GdkEvent $event the button_press_event received
*/
function mouse_copy_unix_style(&$call_wdgt,$event){
if(strtoupper(substr(PHP_OS, 0,3)) != 'WIN')
return FALSE;
if($event->button==2)
$call_wdgt->paste_clipboard();
elseif($call_wdgt->selection_start_pos != $call_wdgt->selection_end_pos)
$call_wdgt->copy_clipboard();
}
/**
add the mouse_copy_unix_style callback to a gtkeditable
@param gtkeditable $wdgt the gtkeditable to add mouse copy support to
*/
function add_mouse_copy_unix_style(&$wdgt){
if(strtoupper(substr(PHP_OS, 0,3)) != 'WIN')
return FALSE;
$wdgt->connect('leave-notify-event','mouse_copy_unix_style');
$wdgt->connect('button_press_event','mouse_copy_unix_style');
}
include this in your apps code and use it like this:
....
$gtkentry = &new gtkentry();
add_mouse_copy_unix_style($gtkentry);
....
That's not what you're asking for but still the best i can do for now.
Hope this help,
regards.
nathan
On 29 Oct 2004 20:17:15 -0000, kunkie@rediffmail.com
<kunkie@rediffmail.com> wrote:
> How can you make a right-click menu appear whilst having text selected in an 'entry'
> at the same time so the user can cut/copy/paste in and out of the field?
>