From 4f5978c3230e454daa5d8ad4ef8a18f8b0a8b09a Mon Sep 17 00:00:00 2001 From: Armando Rivera Date: Sun, 1 Aug 2021 17:36:16 -0400 Subject: [PATCH] Fixed GetText to correctly retrieve the contents of a TextEdit object --- src/cocoa/widgets/functions.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cocoa/widgets/functions.m b/src/cocoa/widgets/functions.m index a54ef42..8cb4753 100644 --- a/src/cocoa/widgets/functions.m +++ b/src/cocoa/widgets/functions.m @@ -24,7 +24,7 @@ void AddItem(id widget, const char* txt ){ NSString *widgetClass = [[widget class] description]; /* ListBox */ - if ([widgetClass isEqualToString:@"CocoaListBox"]) + if ([widgetClass isEqualToString:@"CocoaListBox"] || [widgetClass isEqualToString:@"CocoaTableView"]) { [[widget db] addObject: [NSString stringWithUTF8String: txt]]; [[widget tbl] reloadData]; @@ -46,8 +46,8 @@ const char* GetText(id widget) { /* TextEdit */ }else if ([widgetClass isEqualToString:@"CocoaTextEdit"]) { - if ( [[[widget textStorage] string] length] > 0) { - return [[[widget textStorage] string] UTF8String]; + if ( [[[widget documentView] string] length] > 0) { + return [[[widget documentView] string] UTF8String]; }else{ return @"".UTF8String; } @@ -167,4 +167,4 @@ void addToParent(id parent, id child) { void setToolTip(id widget, const char *tooltip) { [widget setToolTip: [NSString stringWithUTF8String: tooltip]]; -} \ No newline at end of file +}