Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

row and column in an editbox??

Status
Not open for further replies.

SYN

Programmer
Nov 2, 2000
45
NL
Hi,
I have a editbox on a form. The controlsource is a memo field. Is it possible to determine the current row and column from the cursor?

thanks in advance

 
syn

There are no rows and columns in an editbox, because if you stretch the editbox either wider or longer the formatting would change. The only control you have is the properties SelSart, SelLenght and SelText. Which refers to the selected text in an Editbox.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,


I want to show to the user of this editbox the moment of making a new page (the editbox is beiing used for textediting which can be printed afterwards). So I have to know how many rows are beiing used. Do you have a suggestion?

Regards




 
Hi SYN

You can use Set Memowidth & MEMLINES() to determine how many rows in the editbox. This code is not perfect and really needs more work.


*** Editbox Keypress event
LPARAMETERS nKeyCode, nShiftAltCtrl
Local lnStart, lnLen, lnMemoWidth

If (nKeyCode < 127)
lnMemoWidth = set('memowidth')
lnLen = int(This.Width / (ThisForm.TextWidth('M ')/2))
Set memowidth to lnLen

lnStart = This.SelStart + 1
Do case
Case (nKeyCode = 1) && &quot;Home&quot; key
lnStart = 0
EndCase

Wait window nowait ;
'Char position: ' + transform(lnStart) + chr(13) + ;
'Rows counter : ' + transform(memlines(This.Value))
Set memowidth to lnMemoWidth
endif
-----------

Hope it helps

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top