Getting line data from MLE (PB6, July 13, 1999)

Back Up Next

Author: Eric Aling (13 july 1999)
Accessed:

Question: How can I get the text from a specified line. Eg. Getting text from line 2 in MLE.

You should think that PowerBuilder has functions to do this basic stuff. Not. So, what else possibilities does exist to accomplish this. Actually, it is pretty simple. Just send a message to the MLE with some arguments. There are several argumtents you can pass. Check out the following example.

/* external functions */

function long SendMessageA(ulong hwnd, ulong msg, long wp, ref string s ) library 'user32.dll'
function long SendMessageA(ulong hwnd, ulong msg, long wp, long lp ) library 'user32.dll'

/* constants */
integer EM_LINELENGTH = 193
integer EM_GETLINE    = 196
integer EM_LINEINDEX  = 187
long    ll_linelength
long    ll_linechar
string  ls_line

/* example line to retrieve */
integer  li_line = 2

/* get charindex on line */
ll_linechar  = sendmessageA(handle(mle_1), EM_LINEINDEX, li_line - 1, 0 )
messagebox('first char on line',ll_linechar)

/* get linelength */
ll_linelength  = sendmessageA(handle(mle_1), EM_LINELENGTH, ll_linechar, 0 )
messagebox('linelength',ll_linelength)

/* allocate buffer */
ls_line = space(ll_linelength + 1)

/* get line */
sendmessageA(handle(mle_1), EM_GETLINE, li_line - 1, ls_line )

/* display */
messagebox('line',ls_line)

That's pretty simple ain't it. Check out the Windows API helpfile for more values to use.

 

 

Back Up Next