Article View: comp.sys.mac
Article #16439Re: SetIText in LightSpeed C DA
From: scott
Date: Fri, 29 May 1987 18:59
Date: Fri, 29 May 1987 18:59
40 lines
1993 bytes
1993 bytes
In article <5278@ut-ngp.UUCP> jdm@ut-ngp.UUCP (Jim Meiss) writes:
>
> I'm writing a desk accessory in Lightspeed C...
> For some reason SetIText does not draw the new text,...
>
> Thanks for your help
>
> Jim Meiss
> jdm@ut-npg.UTEXAS.EDU
The reason is that the WindowKind of the window has been set to indicate that
the window belongs to the DA rather than to indicate that the window is a
dialog. The best fix is to save, set and restore the WindowKind around the
SetIText call -- like this (pardon if my C is a bit rutsy):
SetNo(theNo,itemNo) /* set the Dialog Item "itemNo" to the number "theNo" */
int itemNo;
double theNo;
{
Str255 theText;
int oldkind;
ftoa(theText,theNo); /* convert theNo to a Pstring */
oldkind = dce->dCtlWindow->windowKind;
dce->dCtlWindow->windowKind = dialogKind;
SetIText(DItemHandle(itemNo),theText);
dce->dCtlWindow->windowKind = oldkind;
}
Just for fun I'll give another approch (not as good as above but better
than calling DrawDialog) is to InvalRect the item's rectangle and let
the normal update mechanism handle it.
I hope that there aren't too many lies here...
--
--scott douglass, Apple Computer
CSNet: scott@Apple.CSNet UUCP: {nsc, sun, voder, well, dual}!apple!scott
AppleLink: Douglass1
Any opinions above are mine and not necessarily those of Apple Computer.
Technical Details
Message-ID:
<858@apple.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!husc6!think!ames!amdahl!pyramid!voder!apple!scottReferences:
<5278@ut-ngp.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!husc6!think!ames!amdahl!pyramid!voder!apple!scott From: scott@apple.UUCP Newsgroups: comp.sys.mac Subject: Re: SetIText in LightSpeed C DA Message-ID: <858@apple.UUCP> Date: Fri, 29-May-87 14:59:11 EDT Article-I.D.: apple.858 Posted: Fri May 29 14:59:11 1987 Date-Received: Sat, 30-May-87 11:40:51 EDT References: <5278@ut-ngp.UUCP> Reply-To: scott@apple.UUCP (scott douglass) Organization: Apple Computer Inc., Cupertino, USA Lines: 40 Keywords: How do you get SetIText to Update the Text?