andlabs / andlabs/libui

Grid issues on Cocoa

未关闭
#435 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C
星标
10.9k
派生
612
PR 合并指标
30 天内没有已合并 PR

描述

There seem to be some bugs regarding uiGrid on macOS

Cocoa:
![bildschirmfoto 2018-11-01 um 17 28 28](https://user-images.githubusercontent.com/4586894/47865161-c49db600-ddfb-11e8-9d9b-255e3003422b.png)
GTK:
![bildschirmfoto 2018-11-01 um 17 28 22](https://user-images.githubusercontent.com/4586894/47865162-c49db600-ddfb-11e8-9095-20cc71910e9e.png)

```c
#include
#include
#include
#include
#include "ui.h"

int onClosing(uiWindow *w, void *data)
{
uiQuit();
return 1;
}

int main(void)
{
uiInitOptions o;
const char *err;
uiWindow *w;

memset(&o, 0, sizeof (uiInitOptions));
err = uiInit(&o);
if (err != NULL) {
fprintf(stderr, "error initializing ui: %s\n", err);
uiFreeInitError(err);
return 1;
}

w = uiNewWindow("Grid Test", 500, 400, 0);
uiWindowSetMargined(w, 1);

uiGrid *grid = uiNewGrid();
uiGridSetPadded(grid, 1);
uiWindowSetChild(w, uiControl(grid));

uiEntry *name = uiNewEntry();
uiEntry *surname = uiNewEntry();
uiSlider *age = uiNewSlider(0, 100);
uiMultilineEntry *data = uiNewMultilineEntry();
uiMultilineEntrySetText(data, "This is a text.This is a text.\nThis is a text.\nThis is a text.This is a text.\nThis is a text.\n");

uiGridAppend(grid, uiControl(uiNewLabel("name")), 0, 0, 2, 1, 0, uiAlignFill, 0, uiAlignStart);
uiGridAppend(grid, uiControl(uiNewLabel("surname")), 0, 1, 2, 1, 0, uiAlignFill, 0, uiAlignStart);
uiGridAppend(grid, uiControl(uiNewLabel("age")), 0, 2, 2, 1, 0, uiAlignFill, 0, uiAlignStart);

uiGridAppend(grid, uiControl(name), 2, 0, 2, 1, 0, uiAlignFill, 0, uiAlignStart);
uiGridAppend(grid, uiControl(surname), 2, 1, 2, 1, 0, uiAlignFill, 0, uiAlignStart);
uiGridAppend(grid, uiControl(age), 2, 2, 2, 1, 0, uiAlignFill, 0, uiAlignStart);

uiGridAppend(grid, uiControl(data), 4, 0, 1, 3, 1, uiAlignFill, 1, uiAlignFill);

uiWindowOnClosing(w, onClosing, NULL);
uiControlShow(uiControl(w));
uiMain();
return 0;
}
```

----
https://github.com/kusti8/proton-native/issues/55
https://github.com/parro-it/libui-node/issues/63

> Grid does work on macOS; it's just insanely buggy because either Auto Layout is hard or my attempt at making a grid with it is poor (probably the latter), so it only works under specific circumstances... This is an active problem.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。