Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

About RichEdit - Up and Down

Posted on 1998-11-02
13
Medium Priority
?
402 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 200 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 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