[comp.sys.atari.st] Argh! MWC Resource & TEDINFO

csrobe@CS.WM.EDU (Chip Roberson) (09/14/89)

I am trying to create a simple form with editable strings, such as:
	Name: ______________________
using MWC's Resource construction set.  I was able to create the
complete form and even test it using Resource.  The cursor moved
from field to field just as it should and it even let me type in
dummy text.  

However, when I compiled the program, form_do() wouldn't let me
type in a single character.  So I go back and forth between my
code and Resource and I can't figure out why.  The template looks
correct:
	"Name: XXXXXXXXXXXXXXXXXXXX"
and the text is blank ("": I don't want anything in there that I have
to erase before I type in my input.  I want a virgin field!).  No go!
form_do() only lets me type in as much text as is in the te_ptext
field.  (This makes since form_do() seems to use the same place to store
the new input.)

Ok, so I see the following in the MWC lexicon pp. 357-8:  "te_ptext
points to a string to be displayed within the object.  The text typed
by the user will be written over this string.  [The first time I read
this I thought "written" meant "on the screen" not "in memory". -csr]
If you do not want text to be displayed, replace it with a string of
`@' characters as long as the maximum length of the string of input."

Seems reasonable, just get back into Resource and put 20 @'s in the
text field of NAME.  But NO!  Resource won't let me enter @'s into
the text field.  Ok, I'll do it the long way.  I'll decompile the
.rsc using Resdecom edit it manually and then compile it back using
Rescomp.  I go to recompile my source and it bombs out saying it
doesn't know the name of my EXIT Button.  What!?!  So I look at the
.h file and the last 6 or 7 objects in the form have all had their
C Names changed to things like BTN_027C!  Whydju do that?  I didn't
tell you to do that!

Ok, back to Resource to put my names back in.  I check on the object
with the @-signs in it, but I don't see them.  I go down to the text
field and try typing a few characters in frustration.  Hey wait a minute!
The @'s are there.  I can see them as I type, Resource just doesn't want
to show them to me.  Can I type '@'s in now?  NO!  Ok, so I cancel
and get out and compile the damn thing.

Well, the underscores are still there indicating that nothing is in
the field.  I try typing.  It takes the text.  Oh Boy, no what!?!
The underscores and the characters of the text merge into a new
character set.  The underscores aren't going away as I over them!

So what the farce am I to do now?  I'm tired.  I'm frustrated.  And
I'm not in a very good mood.  

Now I know this can be done because I have some resource files that
do exactly what I'm trying to do.  I even put one into Resource and
their object looks identical to mine!  How do I get around this
stupid problem?  How do I give the object the storage for the string
and still get an empty field?

Why isn't this straight-forward?  Please somebody give me a simple
answer that will fix this prolem.

Thanks for listening.
-c
| Chip Roberson                ARPANET:  csrobe@cs.wm.edu           |
| VA Remote Sensing Study                                           |
| Dept of Comp. Sci.                     csrobe@icase.edu           |
| College of William and Mary                                       |
| Williamsburg, VA 23185       UUCP:     ...!uunet!cs.wm.edu!csrobe |

csrobe@CS.WM.EDU (Chip Roberson) (09/14/89)

First off, let me thank you for replying to my plea for help.
Net-People like you have made the difference between my ST
being a real machine or just a piece of hardware!  Thanks.

In article <8909141428.AA25595@cory.Berkeley.EDU> you write:
>Chip,
>You have the right idea, 

Well in one way that's reassuring to me, while disappointing that the
solution isn't readily apparent and easy to acquire.

>but you need to do the following:
>
>Buffer the text with blanks equal to the # of "X"'s (which I
>assume are ALT-X's), and then place an @ at the start of the

Yes, the X's are ALT-X's.  There are 20 of them.

>buffered text. _You won't be able to see the @ but it's there!_.

Ok, I got into WMC's Resource and first typed in 20 spaces, then
moved to the first character postion (in front of those 20 spaces)
and inserted an @-sign.  When I inserted the @, the spaces
were no longer visible (just underbars).

I saved the new .rsc and decompiled it to look at the components
in textual form.  The @ + 20 spaces were there, though when it
decompiled, all of the CNAMEs for my edit fields had been changed
to really helpful names like FTXT_27A!

>Ok, the @ ensures you start on the left of the field before
>the user enters anything (and it's there, trust me), the blanks
>give space for the user to enter something!

I loaded the .rsc, that I had just built using Resource, into my program
and tried to edit the form.  The cursor cursor was at the beginning
of the field as you predicted and I could type in 20 characters of text.
HOWEVER, the new characters did not replace the underbars but instead
merged with them.  So I get R's that look like funny B's and A's that
look like sick 8's.  

>Try it, it should work if you do it _exactly_ like that and don't
>worry about not being able to see the @, ok?

Well, I think I have followed your instructions to the letter (almost
literally) and it's almost there, but asthetically unpleasing.  Have
I missed something?

>-- 
>--Kenneth "kens" Soohoo			(soohoo@cory.Berkeley.Edu)
>  Atari Hacker (Atari's Hacker...)
>  "It could be worse, you could get hit by a bus..."
>  My opinions are my OWN, _not_ necessarily Atari's. But "hey", who knows?

-c
Chip Roberson	(csrobe@cs.wm.edu)

csrobe@CS.WM.EDU (Chip Roberson) (09/15/89)

Ken,

In <8909142033.AA06916@cory.Berkeley.EDU> you write:

>>Ok, I got into WMC's Resource and first typed in 20 spaces, then
>>moved to the first character postion (in front of those 20 spaces)
>>and inserted an @-sign.  When I inserted the @, the spaces
>>were no longer visible (just underbars).
>>
>>I saved the new .rsc and decompiled it to look at the components
>>in textual form.  The @ + 20 spaces were there, though when it
>>decompiled, all of the CNAMEs for my edit fields had been changed
>>to really helpful names like FTXT_27A!
>
>oh, interesting... Odd... Could you still reference the fields by the
>names _you_ specified?  Do you have a Boxtext or what?

No, I couldn't get it reference the fields by the names I specified.
I had to get back into Resource and replace the generic names with
my original names.  I called MWC about it, and they said it would
be placed in the bug report bin.  What ever that means!  :-)

>>>Ok, the @ ensures you start on the left of the field before
>>>the user enters anything (and it's there, trust me), the blanks
>>>give space for the user to enter something!

>>I loaded the .rsc, that I had just built using Resource, into my program
>>and tried to edit the form.  The cursor cursor was at the beginning
>>of the field as you predicted and I could type in 20 characters of text.
>>HOWEVER, the new characters did not replace the underbars but instead
>>merged with them.  So I get R's that look like funny B's and A's that
>>look like sick 8's.  
>
>Sounds like something is funky with flags elsewhere, you've got the
>principle down for creating editable text fields that are default
>to empty -- You might try re-creating the while shape from scratch...
>Sometimes K-Resource (oh, I mean MWC Resource ;-)) gets confused ;-)

Boy, you must be psychic because that is exactly what I did.  I got
out my unused copy of Compute!'s _ST Applications Guide: Programming
in C_ and copied how that guy rolled his own.  I then inserted this
new TEDINFO in place of mine and the thing worked!  Hmmm.  Where were
they different?  It was in te_color and te_thickness.  I dug around a
little deeper and saw that there is a bit (bit 3 {2^3} the MSB of the
high nybble of the low byte) in te_color that is the TRANSPARENCY
flag.  MWC's Resource defaults to transparent and I had never changed
it to OPAQUE. By flipping it in Resource the form now works exactly
as I originally wanted, w/o having to patch the OBJECTs in my code.  

>>>Try it, it should work if you do it _exactly_ like that and don't
>>>worry about not being able to see the @, ok?
>
>>Well, I think I have followed your instructions to the letter (almost
>>literally) and it's almost there, but asthetically unpleasing.  Have
>>I missed something?
>
>Nope, you got it, something somewhere else is messing this up... I can't
>imagine what it could be... ;-} When I get home I'll see what I can come
>up with, so probably more mail later, OK?

Well your hunch was right on the money.  I want to thank you, Steven
Jacobs (saj@chinet.chi.il.us), and Robert de Vries (robert@duttnph.tudelft.nl) 
for all of the help in getting this fixed!  Thanks!!!n

-c
| Chip Roberson                ARPANET:  csrobe@cs.wm.edu           |
| VA Remote Sensing Study                                           |
| Dept of Comp. Sci.                     csrobe@icase.edu           |
| College of William and Mary                                       |
| Williamsburg, VA 23185       UUCP:     ...!uunet!cs.wm.edu!csrobe |

 -=- The Animal-Rights mailing list is now on the air.           -=-
 -=- Send mail to Animal-Rights-Request@cs.odu.edu to subscribe. -=-