From: Sean H. <jal...@ho...> - 2002-02-24 14:21:39
|
>Well, to get the _Change event working, just send this message: >$RichEdit->SendMessage(0x445, 0, 1); This will help me. This has probably been posted before. I wish the search function on the mailing archives would work. Ah well, if wishes were fishes... >Unfortunately, theres a slight problem... > >This line is complaining that it needs another paramater. > >my $currentline = $RichEdit->LineFromChar; Sorry, forgot something: >($x,$y) = $RichEdit->Selection; >$currentline = $RichEdit->LineFromChar; should be: $currentline = $RichEdit->LineFromChar($y); Of course, you could also put $x, but if you're actively typing, your selection size will be 0 and $x and $y will be the same, and if you have a longer bit selected, you probably want the whole selection visible. _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |
From: Ultimate R. D. <scc...@ho...> - 2002-02-24 20:07:01
|
Hmm, it's still not working for me. Here, i'll post what I currently have: (All thats relevant) $main = Win32::GUI::Window->new(-width=>429, -height=>532, -style=> WS_MINIMIZEBOX | WS_SYSMENU, -text=>'Test', -name=>'Main', -menu=>$menu, -dialogui=>1 ); $main->AddRichEdit(-width=>380, -height=>119, -name=>'reDesc', -top=>108, -left=>20, -wrap=>1, -autovscroll=>1, -ultiline=>1, -style=> WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_LEFT | ES_MULTILINE, -exstyle=> WS_EX_CLIENTEDGE, ); #This IS executing, I can tell because $changes is being set to 1... sub reDesc_Change{ $changes = 1; my ($x,$y) = $main->reDesc->Selection; my $currentline = $main->reDesc->LineFromChar($x); while (1) { my $firstline = $main->reDesc->FirstVisibleLine; my $linecount = $main->reDesc->SendMessage(0x00ba,0,0); my $lastline = $firstline + $linecount - 1; last if ($lastline >= $currentline); $main->reDesc->SendMessage(0x00b5,1,0); } return 1; } A lot of that was pieced together from what I could figure out from previous posts (BTW, it looks like the search function is ALMOST fixed). Unfortunately... it isn't working... It's possible that one of the settings above are preventing it... ----Original Message Follows---- >Well, to get the _Change event working, just send this message: >$RichEdit->SendMessage(0x445, 0, 1); This will help me. This has probably been posted before. I wish the search function on the mailing archives would work. Ah well, if wishes were fishes... >Unfortunately, theres a slight problem... > >This line is complaining that it needs another paramater. > >my $currentline = $RichEdit->LineFromChar; Sorry, forgot something: >($x,$y) = $RichEdit->Selection; >$currentline = $RichEdit->LineFromChar; should be: $currentline = $RichEdit->LineFromChar($y); Of course, you could also put $x, but if you're actively typing, your selection size will be 0 and $x and $y will be the same, and if you have a longer bit selected, you probably want the whole selection visible. _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Sean H. <jal...@ho...> - 2002-02-25 03:01:32
|
>#This IS executing, I can tell because $changes is being set to 1... >sub reDesc_Change{ > $changes = 1; > my ($x,$y) = $main->reDesc->Selection; > my $currentline = $main->reDesc->LineFromChar($x); > > while (1) > { > my $firstline = $main->reDesc->FirstVisibleLine; > my $linecount = $main->reDesc->SendMessage(0x00ba,0,0); > my $lastline = $firstline + $linecount - 1; > last if ($lastline >= $currentline); > $main->reDesc->SendMessage(0x00b5,1,0); > } > return 1; >} Okay, the problem is EM_LINECOUNT returns total lines, not visible lines (I should have read the documentation more closely). I tried this and it works: sub reDesc_Change{ $changes = 1; my ($start,$stop) = $main->reDesc->Selection; while (1) { my ($x,$y) = $main->reDesc->PosFromChar($stop); # or $start, if you prefer last if ($y <= $main->reDesc->Height - 20); $main->reDesc->SendMessage(0x00b5,1,0); } return 1; } You might want to set a variable before the while loop instead of calling $main->reDesc->Height over and over again (it's less processor-intensive, although in my tests, the code took less than a second, anyway) (or, if you never resize the control, you could even hard-code it, although I dislike that approach myself). I subtract 20 because the limiting rectangle of the control (that's the amount of space text can appear in) is smaller than the actual rectangle. (PosFromChar returns a value relative to the limiting rectangle, not the actual rectangle.) There is a message you can send to get the actual limiting rectangle, but it requires packing a structure, which apparently will not work with Win32::GUI::SendMessage (although someone posted that it will work if you roll your own SendMessage via Win32::API). Rather than go through all that, I simply fudged it by using 20. (If you're planning on using different font sizes, you'll probably want to use a variable here, too.) If you would prefer a more exact approach, I would be willing to help (as, I'm sure, would others). _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |
From: Ultimate R. D. <scc...@ho...> - 2002-02-25 03:21:27
|
Yeah, that seems to work. Thanks. I wonder if tracking will ever be completely incorperated into it. It would be nice if a person could just push the up arrow and expect it to scroll up with them. *Adds to wish list* Thanks again. Now all I need to do is figure out how to allow people to format the text entered. Know of any detailed examples of how to insert parts of other programs into win32::gui windows? _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |