Dan Harrell wrote:
> I have been using your Win32::GUI library to build a
> chatterbox client for perlmonks.org.  So far, it has worked
> pretty well.  One thing I have been unable to do is to move
> to the bottom of a RichEdit field when I add new text.  The
> user must constantly scroll down in order for it to work.
>
> Any suggestions?

you can look at the source for pride.pl in the samples
directory of my distribution, in the sub GotoLine there
is something similar.
a possible code follows:

    my $EM_LINESCROLL = 182;
    my $EM_SCROLLCARET = 183;

    sub ScrollToBottom {
        my $LastLine = $Window->RichEdit->LineFromChar(
            length( $Window->RichEdit->Text )
        );
        my $ActualLine = $Window->RichEdit->FirstVisibleLine;
        my $diff = ($LastLine - 1) - $ActualLine;
        $Window->RichEdit->SendMessage($EM_LINESCROLL, 0, $diff);
        my ($ci, $li) = $Window->Editor->CharFromPos(1, 1);
        $Window->RichEdit->Select($ci, $ci);
        $Window->RichEdit->SendMessage($EM_SCROLLCARET, 0, 0);
        $Window->RichEdit->SetFocus();
    }

quite a few work, I know ;-)
it will be implemented in a more reasonable way sooner or
later...

cheers,
Aldo

__END__
$_='just perl',s, , another ,,s,$, hacker,,print;




Reply via email to