Solved

About RichEdit - Up and Down

Posted on 1998-11-02
13
400 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 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