Link to home
Start Free TrialLog in
Avatar of ermac
ermac

asked on

A few questions about TMemo

I have a few questions to ask regarding the TMemo component
1) Is there a way to open large files (>100kb)?
2) How can I get the position of the cursor (i.e. row and col)?
3) Unlike the TRichEdit component, TMemo component does not have the OnSelectionChange event. I need to display the position of the cursor whenever the cursor is moved. How can I do this?

Thanks in Advance
Ermac
ASKER CERTIFIED SOLUTION
Avatar of ZifNab
ZifNab

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ermac
ermac

ASKER

Thanks!! It works!
But I got another question to ask...

How do I implement Insert/Overwrite operations using TMemo??
(30 points for this answer)
I'll try to find a solution. : this is already one, but I guess there should be better :

At onkeydown or onkeyup, if Insert key is pushed, toggle a boolean variable between false and true (overwrite and insert)

Check if overwrite is selected :
 if so, first delete character your cursor is on then write the character down. You can put this code in Onkeypress
Avatar of ermac

ASKER

Have already tried that... However it seems that the Memo flashes a lot when doing this...

Any other solutions??
Still thinking...
Avatar of ermac

ASKER

Or was it because my code was wrong??
Here's my piece of code for doing it...
with Editor do
begin
  if OverwriteText then
    if (GetTextLen > 0) and (Text[SelStart+1] <> '') and               (Text[SelStart+1] <> #13) then
      SelLength := 1;  
end;
No, looks correct. Maybe with selection lot's of repaint.
Thought otherway, just write VK_DELETE and then character, but
I can't get it to work properly


Avatar of ermac

ASKER

Have played with the VK_DELETE too...
Could get it to work but it still flashes a lot :(
Sorry, can't find a better solution, maybe there isn't any :-(
Maybe make a new TMemo component?
Avatar of ermac

ASKER

Anyway thanks for your help! :)