Solved

About RichEdit - Up and Down

Posted on 1998-11-02
13
396 Views
Last Modified: 2013-11-22
Hmmm... I want to make a little modification in TRichEdit.
Here it is. Usually after we press arrow key down, our
cursor will move to the next line.
But I want to be like this:
* If I press arrow key down:
  The next line goes up, and replace the position of the
  current line (like scroll up).
* If I press arrow key up:
  The previous line goes down and replace the position of
  the current line (like scroll up).
This is the example:
1st line: I love experts-exchange.
2nd line: There are so many humble experts there.
3rd line: They will help newbies.

First condition in TRichEdit:
-------------------------------------- <- Border of RichEdit
I love experts-exchange.                
There are so many humble experts there.
They will help newbies.
---------------------------------------

After I press key down:
I love experts-exchange. ----> Outside RichEdit Screen
---------------------------------------
There are so many humble experts there.
They will help newbies.
---------------------------------------

After I press key down again:
I love experts-exchange.      ----> Outside RichEdit Screen
There are so many humble experts there.
---------------------------------------
They will help newbies.
---------------------------------------

Then I press key up:
I love experts-exchange. ----> Outside RichEdit Screen
---------------------------------------
There are so many humble experts there.
They will help newbies.
---------------------------------------

After I press again key up:
--------------------------------------
I love experts-exchange.                
There are so many humble experts there.
They will help newbies.
---------------------------------------

Hope you understand what I want.

Really need guidance of Delphi experts.

Hoping for the answer,

Daniel
0
Comment
Question by:daniel_c
  • 6
  • 5
  • 2
13 Comments
 
LVL 1

Accepted Solution

by:
jecksom earned 50 total points
ID: 1345385
Hi daniel_c!

use  em_scroll message , set memo1.enabled:=false and try this:


.skipped
type
  TForm1 = class(TForm)
    Memo1: TMemo;
  procedure wndproc(var Message: TMessage);override;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

.skipped

procedure Tform1.wndproc(var Message: TMessage);
begin
if message.msg=wm_keydown then
case message.wparam of
vk_down:SENDMESSAGE(memo1.handle,em_scroll,SB_LINEDOWN,0);
VK_UP:SENDMESSAGE(memo1.handle,em_scroll,SB_LINEUP,0);
END;
inherited;
end;

Jecksom

0
 
LVL 1

Expert Comment

by:jecksom
ID: 1345386
Sorry in my example i used TMemo , but this method works with Treachedit as well.
Also, if you need to make strings empty when they not exist at bottom or top add manually
strings add when delete .

Best Regards ,
          Jecksom.

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1345387
jecksom, It's em_VScroll. Zif. :-)
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1345388
oops, forget it, it's wm_VScroll, but thats something else.
0
 
LVL 7

Author Comment

by:daniel_c
ID: 1345389
Very fast answer!!!

Thanks Jecksom...
Thanks Tom...

Both of you are wonderful!!!

0
 
LVL 7

Author Comment

by:daniel_c
ID: 1345390
Hey experts, another problems came out now.
The answer is work when WordWrap is set to FALSE, but what if the WordWrap is set to TRUE??? I want a solution for it.
If wordwrap is set to TRUE, then may be 1 line can be broken to 2-3 lines.
So, what I want is to go to the next TRUE line (maybe skip 2-3 lines!)

Once again need your help...
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:jecksom
ID: 1345391
Hi again!

So you want to showup/down next line in case it's splitted with wordwrap and want to
scroll it as unsplitted one ?

Jecksom

0
 
LVL 7

Author Comment

by:daniel_c
ID: 1345392
yes Jecksom... that's what exactly I want...
I want to show up/down next line in case it's splitted with wordwrad and want to scroll it as unsplitted one!!!
Perfect understanding.
So, any solution for this?
0
 
LVL 1

Expert Comment

by:jecksom
ID: 1345393
Hi Daniel!

Well i guess it possible , i'll try to make it today.

Best Regards,
                    Ivan.

0
 
LVL 7

Author Comment

by:daniel_c
ID: 1345394
Ok Ivan... or Jecksom???
Anyway, I will wait for it...
Thanks very much for your kindness...
I really appreciate it.
0
 
LVL 7

Author Comment

by:daniel_c
ID: 1345395
no solution yet?
should I put this as new question?
0
 
LVL 1

Expert Comment

by:jecksom
ID: 1345396
New question ? hm, no , i think your main question good enough to be answered here.
I'm not answering b'coz , i didn't found standart method to do this , now i can
only offer override this with lines array like : unwordwrap text ->index unwraped lines->
wrap-> and then use scrolling with this array. O'coz it must be doing via onChange method.
But i still think there is something much more easy and will try to find it.

0
 
LVL 7

Author Comment

by:daniel_c
ID: 1345397
hmmm... yeah
it is more complicated now, isn't it?
i have given up, that's why I ask to this forum
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now