I'm having difficulty trying to get an autoscrolling RichEdit - I can get the scroll bar to show up correctly, but all attempts to have the text automatically scroll up in the RichEdit is failing. In some cases, no scrolling occurs (although I can see the scroll bar growing), and in others, scrolling occurs, but the last line of text shows as the first line of the window (not the last).

My creator code:

  # create the log box which is gonna hold all our info.
   $logbox = $window->AddRichEdit( -name    => "_RichEdit",
                                   -font    => $font,
                                   -top     => 116,
                                   -left    => 0,
                                   -width   => 505,
                                   -tabstop => 1,
                                   -autovscroll => 1,
-style => WS_CHILD | WS_VISIBLE |
                                               WS_VSCROLL | WS_HSCROLL |
                                               ES_LEFT | ES_MULTILINE

And my add code:

   # add the string to our box.
   $logbox->Text($logbox->Text . "\r\n $message");

   # autoscroll the window. 277 is the number
   # of the WM_VSCROLL constant, which Win32::GUI
   # doesn't seem to define for us.
   Win32::GUI::SendMessage($logbox, 277, 7, 7);

In the above cases, $message always contains the complete RichEdit text so that it can be reprinted (this is probably wrong). The SendMessage I dunno what it does - it came from someone else. If I comment it out, no scrolling occurs.

What's my solution?


Reply via email to