🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.indesign.sdk
Article #26

CS4 Crashes when attempting to change color of characters in story

#26
From: Rick_Schachter
Date: Thu, 02 Apr 2009 16:47
42 lines
2138 bytes
Below is a function that we have been using since forever. It changes the color of a specified number of characters in a story starting at a specific position in the textmodel.

The crash happens when processing the command (immediately after "11" is displayed).

classID is kTextAttrColorBoss.

Any help would be greatly appreciated.

ErrorCode ApplyTextAttributes(ITextModel * pTextModel, int32 position, int32 length, UID swatchUID, ClassID classID)
{
	ErrorCode rc = kFailure;
	do
	{
		InterfacePtr<ITextAttrUID> textAttrUID_Color(::CreateObject2<ITextAttrUID>(classID));
		if (textAttrUID_Color == nil)
		{
//			ASSERT_FAIL("TSCore::CreateCharStyle: color invalid");
//			CAlert::ErrorAlert("textAttrUID obj is nuil");
			break;
		}

		if (swatchUID == kInvalidUID)
		{
			ASSERT_FAIL("TSCore::CreateCharStyle: ResolveRGBColorSwatch failed");
//			CAlert::ErrorAlert("Invalid color UID");
			break;
		}

		// Set our color attribute and store it:
		textAttrUID_Color->SetUIDData(swatchUID);

		InterfacePtr<ICommand> pApplyTextAttrCmd ( Utils<ITextAttrUtils>()->BuildApplyTextAttrCmd(pTextModel, position, length, textAttrUID_Color, kCharAttrStrandBoss) );
		//pApplyTextAttrCmd->SetUndoability(ICommand::kUndoNotRequired);	
CAlert::WarningAlert("11");
		rc = CmdUtils::ProcessCommand(pApplyTextAttrCmd);
CAlert::WarningAlert("12");
		if (rc != kSuccess)
			CAlert::WarningAlert("Error on ApplyTextAttrCmd");
	}while(false);

	return rc;			
}
Technical Details
Message-ID: <59b87b96.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f63e9,70b32850ff4ff819,start
X-Google-Attributes: gidf63e9,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Rick_Schachter@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.indesign.sdk
Subject: CS4 Crashes when attempting to change color of characters in story
Message-ID: <59b87b96.-1@webcrossing.la2eafNXanI>
Date: Thu, 2 Apr 2009 09:47:35 -0700
Lines: 50
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit