Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Limitation on number of characters in multi-row entry control ???

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Limitation on number of characters in multi-row entry control ???
#13212
Posted by: Michael S 2010-02-17 19:41:25 Last edited by: Michael S 2010-02-17 19:43:10 (Total edited 2 times)
Ran into the following limitation/bug for an entry control. Using the following code

			/* Display the text in the variable str in a REXX dialog window so user 
   			 can view it, and copy/paste it to the clipboard           */
			guiaddctltext('sql_results', str)
			/* Let's "scroll" to the top of the results */
			guisendmsg("sql_results", "SETSEL", 0, 0)
			guisendmsg("sql_results", "SCROLLCARET") 

(where str contains "lines" delimited by "0D0A"x) and where sql_results is defined as

entry 9, 73, 351, 206, multi|readonly|border|vscroll|tabstop, clientedge, sql_results

I notice that the results are getting "chopped" after approx 30000 characters (I had/needed to write 32965)

Is this a bug/deliberate limitation ?
Message2.
#13213
Posted by: Jeff Glatt 2010-02-18 12:40:32
Is this on Windows 95/98/ME? Those have that size limitation. Win 3000/XP/Vista don't.
Message3. This is on Windows XP
#13214
Posted by: Michael S 2010-02-18 15:40:10
Do you want me to throw together a quick test example ?
Message4.
#13215
Posted by: PeterJ 2010-02-18 16:17:34
Yes, please. I tried to create an example out of your descriptions, with little success.
Message5. Here's an example
#13216
Posted by: Michael S 2010-02-18 17:48:49 Last edited by: Michael S 2010-02-18 17:49:32 (Total edited 1 time)

/*
GUIBEGIN


WINDOW , 0, 0, 400, 200, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , My Window
	FONT 8, 400, MS Shell Dlg
	ENTRY 7, 6, 384, 188, MULTI|READONLY|BORDER|VSCROLL|TABSTOP, CLIENTEDGE, sql_results
DEND
GUIEND
*/

LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
limit = 367 /* Change this to 366 and all's okay */
temp = ""
DO i = 1 TO limit
	temp = temp || LEFT("This is line "i,80) || "0D0A"x
END 

y = RIGHT(temp,90)
y = TRANSLATE(y, "<>", "0D0A"x)
/* NB NB NB  Here's another strange event. Run the code, and you'll never see
             the say results in the console window. Debug it instead and you do */
SAY "Total characters = "LENGTH(temp)", last 90 characters ***"y"****"
guiaddctltext('sql_results', temp)
guisendmsg("sql_results", "SETSEL", 0, 0)
guisendmsg("sql_results", "SCROLLCARET") 
again:
DO FOREVER
	guigetmsg()
	IF EXISTS('GuiObject') == 0 THEN DO
		IF EXISTS('GuiSignal') THEN DO
		END
	END
	ELSE DO
		IF EXISTS('GuiSignal') == 0 THEN DROP (guiobject)
		ELSE SELECT guiobject
			WHEN 0 THEN NOP
			OTHERWISE
		END /* SELECT GuiObject */
	END /* Some child script signaled us */
	CATCH SYNTAX
			CONDITION()
			SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN
Message6.
#13217
Posted by: PeterJ 2010-02-18 18:55:07
yes, it cuts off after 30000 bytes. I slightly modified the do loop:

line=COPIES('1234567890',8)
DO i = 1 TO limit
    temp = temp || OVERLAY("This is line "i">>",line)|| "0D0A"x
END 

and received the following output (last lines)

this is line 364>>90123456789012345678901234567890123456789012345678901234567890
this is line 365>>90123456789012345678901234567890123456789012345678901234567890
this is line 366>>9012345678901234567890123456789012345678901234567890

which means we have 365 lines with 80 chars + CRLF= 365*82=29930 bytes + 70 bytes for line 366 = 30000 bytes.
Message7.
#13218
Posted by: Jeff Glatt 2010-02-19 14:01:05 Last edited by: Jeff Glatt 2010-02-19 14:02:32 (Total edited 1 time)
After you create the window (containing the multiline entry control), try sending the entry control a "LIMITTEXT" message, passing the maximum number of characters you want it to hold:
guisendmsg("MyMulti", "LIMITTEXT", 400000)
Message8. Wow - that was easy to fix.
#13219
Posted by: Michael S 2010-02-19 15:24:41
Thanks Jeff. Since I know the size of the variable I want to write to the ML entry, I assume there's no problem in including this code

/* Add 100 bytes to the length for no real reason */
guisendmsg("sql_results", "LIMITTEXT", 100+length(sql_results))

before each guiaddctltxt ??
Message9.
#13220
Posted by: PeterJ 2010-02-19 15:47:45
adding it before GUIADDCTLTEXT works fine!

guisendmsg("sql_results", "LIMITTEXT", 100+length(temp))
guiaddctltext('sql_results', temp)
...
Message10.
#13221
Posted by: Jeff Glatt 2010-02-20 05:30:37
OK, but you need to do it only once after the control is created. You don't have to do it every time you change text.
Message11. Granted, your example of 400,000 is MASSIVE,
#13222
Posted by: Michael S 2010-02-22 15:56:00
but both Peter and I have probably reasoned that by setting it to the actual number of bytes each time, the code will never fail.

One thing I've noticed with my Reginald exe code is that it's fast, so I never bother/worry about "unnecessary" code - it simply doesn't seem to make any difference to elapsed time.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-4-20  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0