use Win32::GUI(); my $mw = Win32::GUI::Window->new(-title => "Richedit / Textfield deselecting differences", -size => [500,200]); my $re = $mw->AddRichEdit(-name => "re", -pos => [0,0], -size => [500, 100], -text => "RichEdit\r\ndouble click to select, then single click _outside of_ selection: \$start == \$end,\r\ndouble click to select, then single-click _within_ selection: \$start != \$end"); my $tf = $mw->AddTextfield(-name => "tf", -pos => [0,101], -size => [500, 99], -text => "Textfield\r\ndouble click to select, then single click _outside of_ selection: \$start == \$end,\r\ndouble click to select, then single-click _within_ selection: \$start == \$end", -multiline => 1); $mw->Show(); Win32::GUI::Dialog(); exit(0); sub re_MouseUp { my ($start, $end) = $re->GetSel(); print STDERR "RichEdit MouseUp selection: $start, $end\n"; 1; } sub tf_MouseUp { my ($start, $end) = $tf->GetSel(); print STDERR "TextField MouseUp selection: $start, $end\n"; 1; }