[comp.sys.mac.programmer] LSC 4.0 cdev and editText items!!

moyman@ecn.purdue.edu (12/15/90)

What's the deal with textEdit items inside the cdev dialog!! TextEdit acts
*real wierd on these items... Reading in strings ('STR ' resource ) and setting
them to editText (boxes) items results in the first item (SysTextID) to be
invisible (it's is there, you just can't see it), the rest come out correctly.
But clicking inside the editText box (the first, the invisible one) does
nothing, only until you click inside one of the other editText boxes does it
become *active*. All of the edit boxes act *weird*... I do something like the
following (at init time of the cdev) to set the initial values of my 4 editText
boxes...

	/* Setting the initial text in all of the editable text fields */
	aStr = GetString(SysStrID);
	GetDItem(dp,lastItem+SysTextID,&itemType,&itemHandle,&itemRect);
	SetIText( itemHandle, *aStr);
	
	aStr = GetString(ClosedStrID);
	GetDItem(dp,lastItem+ClosedTextID,&itemType,&itemHandle,&itemRect);
	SetIText( itemHandle, *aStr);
	
	aStr = GetString(OpenStrID);
	GetDItem(dp,lastItem+OpenTextID,&itemType,&itemHandle,&itemRect);
	SetIText( itemHandle, *aStr);
	
	aStr = GetString(ChooserStrID);
	GetDItem(dp,lastItem+ChooserTextID,&itemType,&itemHandle,&itemRect);
	SetIText( itemHandle, *aStr);

Anybody know what the deal is...Am I not able to treat/code (the items) the
cdev dialog like a *regular* dialog??... All of my other titem seem to work
perfectly fine... I am using LSC 4.0...

Mike Moya
Engineering Computer Network
Purdue University

resnick@cogsci.uiuc.edu (Pete Resnick) (12/15/90)

moyman@ecn.purdue.edu writes:

>What's the deal with textEdit items inside the cdev dialog!!

>	/* Setting the initial text in all of the editable text fields */
>	aStr = GetString(SysStrID);
>	GetDItem(dp,lastItem+SysTextID,&itemType,&itemHandle,&itemRect);
>	SetIText( itemHandle, *aStr);

I always do a SelIText(CPDialog, myItem+numItems, 0, 32767) on the first
editText item in my DITL. Also, remember to do an InvalRect if you change
the text after initialization. Other than that, it should work fine.

pr
--
Pete Resnick             (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD

volaski@acsu.buffalo.edu (Maurice Volaski) (12/15/90)

In article <1990Dec14.220133.8499@ux1.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes:
>moyman@ecn.purdue.edu writes:
>
>>What's the deal with textEdit items inside the cdev dialog!!
>
>>	/* Setting the initial text in all of the editable text fields */
>>	aStr = GetString(SysStrID);
>>	GetDItem(dp,lastItem+SysTextID,&itemType,&itemHandle,&itemRect);
>>	SetIText( itemHandle, *aStr);
>
>I always do a SelIText(CPDialog, myItem+numItems, 0, 32767) on the first
>editText item in my DITL. Also, remember to do an InvalRect if you change
>the text after initialization. Other than that, it should work fine.


In addition, you should not be passing a master pointer to SetIText. It might 
move memory, including your string data. Copy it to a Str255 variable and 
pass that instead. 
 
Maurice Volaski