Fixed GetText to correctly retrieve the contents of a TextEdit object

This commit is contained in:
Armando Rivera 2021-08-01 17:36:16 -04:00
parent c945a6cb86
commit 4f5978c323

View File

@ -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]];
}
}