From: Sean H. <jal...@ho...> - 2002-02-23 19:39:53
|
>Also, does anyone know why, in multiline RE fields at least, if you just >keep hitting enter your cursor goes off the edit window and you have to >scroll down manually? Is there a way to make it focus on the cursor >automatically? A solution to this has been posted before, and someone may hvae a record of it, but here's a possible solution: ($x,$y) = $RichEdit->Selection; $currentline = $RichEdit->LineFromChar; while (1) { my $firstline = $RichEdit->FirstVisibleLine; my $linecount = Win32::GUI::SendMessage($RichEdit,EM_GETLINECOUNT,0,0); my $lastline = $firstline + $linecount - 1; last if ($lastline >= $currentline); Win32::GUI::SendMessage($RichEdit,EM_SCROLL,SB_LINEDOWN,0); } This code has not been tested, but it should work. You'd have to put in the '_Change' event of $RichEdit. (I have not been able to get the '_Change' event to work, but maybe someone has a solution for that problem.) A little modification, and you should be able to always make the current selection visible. EM_GETLINECOUNT = 0x00ba EM_SCROLL = 0x00b5 SB_LINEUP = 0 SB_LINEDOWN = 1 SB_PAGEUP = 2 SB_PAGEDOWN = 3 _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |