[comp.sys.mac.hypercard] SuperCard problem

cs290ac@ux1.cso.uiuc.edu (08/08/90)

I've got a bad supertalk problem.
What I want is to have a scrolling window with two fields inside which, when
clicked at, the line being clicked at changes its text style to bold.
After some digging, I found that I could change the text style of portions
of a field by selecting the desired portion, then changing the text style
of the field.  Only the selected portion is affected.  Great.
The only problem is that I find out what line was clicked by using a list
field, which apparently doesn't use selections at all.  When you select text
in a list field using the select command, nothing happens.  I also can't
use regular, non-list fields because I need to find out the line NUMBER being
clicked (I can't use the method of double clicking at the location of the
cursor).  The only way I know of finding the line number being clicked at in
a regular field is to use a hypertalk function called clickline.
This won't work because when it tries to get the textheight of the field,
supercard returns "mixed" rather than a number.

Any help would be greatly appreciated.

--RS

ALC@psuvm.psu.edu (08/08/90)

In article <18200006@ux1.cso.uiuc.edu>, cs290ac@ux1.cso.uiuc.edu says:
>
>I've got a bad supertalk problem.
>What I want is to have a scrolling window with two fields inside which, when
>clicked at, the line being clicked at changes its text style to bold.
>After some digging, I found that I could change the text style of portions
>of a field by selecting the desired portion, then changing the text style
>of the field.  Only the selected portion is affected.  Great.
>The only problem is that I find out what line was clicked by using a list
>field, which apparently doesn't use selections at all.  When you select text
>in a list field using the select command, nothing happens.  I also can't
>use regular, non-list fields because I need to find out the line NUMBER being
>clicked (I can't use the method of double clicking at the location of the
>cursor).  The only way I know of finding the line number being clicked at in
>a regular field is to use a hypertalk function called clickline.
>This won't work because when it tries to get the textheight of the field,
>supercard returns "mixed" rather than a number.
>
>Any help would be greatly appreciated.
First, if you are using "List" fields, then you CANNOT make one line
bold. By definition, all characters in a list field must have the same attribut
es (like font, style, etc).


If you want just one line to have a different style, they you have to use
standard, scrolling fields. In that case, you will have to compute the
clickLine manually by dividing the mousePosition by the textHeight. If your
textHeight is returning MIXED, then you either have to hard code in the
text height (which is the same number as the font size) or you'll have to
select all text in the field, make it plain, and then get the textHeight.

hsu_wh@jhunix.HCF.JHU.EDU (William H Hsu) (05/12/91)

	I have written a SuperCard stack which contains about 7 windows and
is very densely filled with digitized color and grayscale graphics and ASCII
text.  In one of the windows (actually in a card background) I wrote a multi-
window search routine which uses "Find" as its basic command (inside a loop).
	The arguments to the "Find" are:

		- a string to be searched for
		- a window to open (originally a stack before proting to SC
					v 1.5)
		- the field to be searched for, usually something like:
			bg fld "Report Window" of wd theWindow
	I am getting a crash during searches for certain words (e.g.,
"striate cortex") which causes the Mac (I've tried this on a 2.5 Mb SE, a
5 Mb IIcx, and an 8 Mb IIcx) to freeze up completely.  Other words (e.g.,
"positron") work fine.  Different words seem to crash on different windows;
however, the only two cases in which I have been able to recreate the bomb
occurred when the window (i.e., the field) was blank -- all cards were
devoid of text.  Putting in some didn't help.
	If anyone can tell what is wrong at this point, I would greatly
appreciate it.  I would certainly be willing to mail any or all of the code
to whomever might care to take a look, but it is far to long to post even
partially.  SuperCard technical support has told me the following:

1) It may be a memory fragmentation error caused by having windows opened
and closed frequently.
	I know that it can't be having too many windows open, because I
tried closing windows as soon as they have been searched.  A suggestion was
that I use the hasMemory function, but I can't figure it out.
2) Do not use the message box for the command; use "do".
	Originally, I was putting commands into the message box and using "type
return".  This seemed unwieldy, so I switched at the recommendation of SC's
programmers.  However, there seems to be no difference.  The "Do
Command" still sends a system message (I ascertained via 'trace' that it was
crashing right after a system message.

	Any suggestions would be very much appreciated.  I can be reached at:

	hsu@cs.jhu.edu
	hsu_wh@jhuvms.hcf.jhu.edu

						- William Hsu