Solved

About RichEdit - Up and Down

Posted on 1998-11-02
13
398 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 136
delphi prevent click fast 2 219
Newbie Thread Programming 1 152
Sending files from  idTcpServer Socket to idTcpClient 2 40
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

778 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