mirror of
https://github.com/Airr/nim-cocoa.git
synced 2024-11-24 09:45:30 +00:00
Fixed GetText to correctly retrieve the contents of a TextEdit object
This commit is contained in:
parent
c945a6cb86
commit
4f5978c323
@ -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]];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user