in reply to Re: Win32::GUI::Richedit strange results for deselecting a selection (events)
in thread Win32::GUI::Richedit strange results for deselecting a selection

(just now came across my post through a Google search, ... here's the solution for completeness sake)

"SelChange" event: quite right! That's what hooks are for.

$myRichEdit->Hook(EN_SELCHANGE, \&SelChangeEvents_Handler); sub SelChangeEvents_Handler { my ($object, $wParam, $lParam, $type, $msgcode) = @_; return unless($type == WM_NOTIFY); return unless($msgcode == EN_SELCHANGE); my ($hwndFrom, $idFrom, $code, $cpMin, $cpMax, $seltyp) = unpack("LLLLLL", unpack("P24", pack("L", $lParam))); return unless($hwndFrom == $object->{-handle}); my $haveSelection = ($cpMin != $cpMax); if($haveSelection){ print STDERR " we have a selection!"; } }
  • Comment on Re^2: Win32::GUI::Richedit strange results for deselecting a selection (events)
  • Download Code