Board index » delphi » HELP ME HELP ME HELP ME HELP ME

HELP ME HELP ME HELP ME HELP ME

Hi,

 I have a small problem.  I have a memo called moMain.  I want to get the
exact row and column where the cursor is.  Can that be done?  Then, for
example, the user selects a piece of text.  How can I add, diffetent text,
on both sides of the selected text?

abcdef$ijklmnopq$tuvwxyz

Where the $ is, I want to add 'gh', and 'rs'.  I'd appreciate it if you can
help me.  Thanks,

Johann Joubert

joha...@geocities.com
http://www.geocities.com/SiliconValley/Lakes.2610/index.html

 

Re:HELP ME HELP ME HELP ME HELP ME


Johann,

You don't need to know exactly where the selected text is, but that would
be available through SELSTART (number of characters before the selection
starts where the first character in the memo is 0)

This line inserts two percent signs in the beginning and in the end of the
selected text.

   Memo1.SelText := '%%' + Memo1.SelText + '%%';

Mathias

Johann Joubert <lou...@pc.jaring.my> skrev i inl?gg
<01bc3398$00681d00$db708ea1@louisj>...

Quote
> Hi,

>  I have a small problem.  I have a memo called moMain.  I want to get the
> exact row and column where the cursor is.  Can that be done?  Then, for
> example, the user selects a piece of text.  How can I add, diffetent
text,
> on both sides of the selected text?

> abcdef$ijklmnopq$tuvwxyz

> Where the $ is, I want to add 'gh', and 'rs'.  I'd appreciate it if you
can
> help me.  Thanks,

> Johann Joubert

> joha...@geocities.com
> http://www.geocities.com/SiliconValley/Lakes.2610/index.html

Re:HELP ME HELP ME HELP ME HELP ME


Hi Johann

Quote
>  I have a small problem.  I have a memo called moMain.  I want to get the
> exact row and column where the cursor is.  Can that be done?

Use messages :
  row := SendMessage(memo1.handle, EM_LINEFROMCHAR, memo.selstart, 0);
  col := memo1.selstart - SendMessage( memo1.handle, EM_LINEINDEX, row,
0 );

Quote
> Then, for example, the user selects a piece of text.  How can I add, diffetent text,
> on both sides of the selected text?

  memo1.selText:='Begin'+ memo1.selText + 'end';

HTH
Allan

Other Threads