fix textview creation (Cocoa)

2 days ago

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 30 Mar 2025 16:52:33 +0200 (2 days ago)
changeset 539
96f466ceaf23
parent 538
5004b4a9b16d
child 540
d8b86f66721c

fix textview creation (Cocoa)

make/xcode/toolkit/toolkit/main.m file | annotate | diff | comparison | revisions
ui/cocoa/text.m file | annotate | diff | comparison | revisions
--- a/make/xcode/toolkit/toolkit/main.m	Sun Mar 30 16:38:27 2025 +0200
+++ b/make/xcode/toolkit/toolkit/main.m	Sun Mar 30 16:52:33 2025 +0200
@@ -38,7 +38,7 @@
     UiObject *obj = ui_window("My Window", NULL);
     
     
-    ui_grid(obj, .columnspacing = 0, .rowspacing = 0) {
+    ui_grid(obj, .columnspacing = 10, .rowspacing = 10) {
         ui_textarea(obj, .fill = UI_ON);
     }
     
--- a/ui/cocoa/text.m	Sun Mar 30 16:38:27 2025 +0200
+++ b/ui/cocoa/text.m	Sun Mar 30 16:52:33 2025 +0200
@@ -32,8 +32,12 @@
 #import <objc/runtime.h>
 
 UIWIDGET ui_textarea_create(UiObject *obj, UiTextAreaArgs args) {
+    NSTextView *textview = [[NSTextView alloc] init];
+    textview.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
+    
     NSScrollView *scrollview = [[NSScrollView alloc] init];
-    NSTextView *textview = [[NSTextView alloc] init];
+    scrollview.translatesAutoresizingMaskIntoConstraints = NO;
+    scrollview.hasVerticalScroller = YES;
     scrollview.documentView = textview;
     
     UiLayout layout = UI_INIT_LAYOUT(args);

mercurial