procedural C help! text-input box problems...

takeo

Registered
I am writing a carbon application where i want to log data to a text input box in another window. The program i included below works if it's called from main. but if it is called from an Action Handler (like clicking a button), then nothing is displayed. The Action Handler function is passed the WindowRef's so that shouldn't be it... I'd appreciate any help! thanks!




CFMutableStringRef theGlobalLogString;


void LogDriver(WindowRef window, WindowRef window2)
{
CFStringRef AppendString;
char c_string[100];

AppendString = CFStringCreateWithCString(NULL, "BLAH....\r", kCFStringEncodingMacRoman);

InitializeLog(window, window2);
AddStringToLog(window, window2, AppendString);
}



void AddStringToLog(WindowRef window, WindowRef window2, CFStringRef theString)
{
ControlHandle stringOutTextEdit;
ControlID stringOutControlID = { kLogsSignature, kLogsControlID };

SetPortWindowPort(window2);

GetControlByID(window2, &stringOutControlID, &stringOutTextEdit);


CFStringAppend(theGlobalLogString, theString);

SetControlData(stringOutTextEdit,
kControlEntireControl,
kControlEditTextCFStringTag,
sizeof(CFStringRef),
&theGlobalLogString);

DrawOneControl(stringOutTextEdit);
}
 
Back
Top