-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Master issue for Table discussion #310
Comments
@andlabs: I've just brought my branch up-to-date: https://github.com/bcampbell/libui/tree/table All three platforms support:
The windows version supports only text columns (being based on the rather limited win32 commctl listview). For me, the outstanding issues are:
But I'm sure everyone would have their own wishlist here... Would opening a pull request against the main |
Sure! The other features you named can always be added later. I also wonder what your stance on the "part" system currently is. |
Regarding the part system, we probably need to step back and see what is possible. The ideal case: You can define custom layouts for use in cells. QML's listview delegate is the one I've used. But In the meantime, the existing parts API will certainly scratch a few people's itches.
|
(just to keep everything linked up...) I'll move back on to selection handling etc when the dust settles. |
https://www.codeproject.com/Articles/35197/Undocumented-List-View-Features I am seriously tempted to say "screw it, this is too valuable to be ignored just because it's undocumented" and use it anyway. I'm not sure if I'll be able to use this directly because it seems to take over entire subitems and for the current parts system wouldn't allow that, but it's still miles better than the alternatives (change libui to LGPL for mCtrl or spend a lot of time rewriting my own table control again)! I wonder how this interacts with @bcampbell's suggestions about the parts system. Now if only there was an equivalent that also supported tree views with multiple columns and full accessibility support... |
(cc @GerbilSoft) |
Wow. The ListView Control seems to be the control that just keeps on growing. I fully expect it to gain support for it's own process management, scheduling and device drivers... Anyway. At a very brief reading, it looks to me like their ListView can now support arbitrary control layouts, via the I'd guess that this 'undocumented' stuff is already in so much use that it may as well be an ABI. My suspicion is that it is, in fact, more-or-less documented, but only from the .NET (and maybe WinRT) point of view. Microsoft seem to be actively discouraging win32 development these days. Lots more speculation follows: There are a whole heap of existing If So. How does this all affect the libui table API? Firstly, 'appending' multiple parts to a column probably isn't the right model any more. I think a full custom-cell-layout system is a great goal to aim for, if it's possible. |
All right. I'm still not taking any immediate action on the parts system; after I get this PR merged in, I want to go back through both this and your main criticism and see what to do about it. The factory idea is something I've been thinking about when I do eventually get to headerbar-type controls, because on Windows if I use rebars and on Mac OS X with layout entirely I would be breaking the current rule that each control has a single handle made when created. It's something I'll need to think about for those. As for this being undocumented, my only theory is that the interface is a mess that did change in COM-violating ways. It just makes me wonder what kept exposing this functionality some other way from beng considered worth exposing (such as via the -100 point system...). |
Also GTK+ uses cell renderers, not real widgets, and cell layouts that operate like GtkBox/uiBox. Cocoa has something like this, but most things now use view-based table views, where you can just shove a bunch of controls into a table cell. You do have to create the controls for every visible row in the table, but the system is smart and lets you reuse existing rows if they aren't in use. Interface Builder has some helpers for all this, but I forget what they are. |
Just for reference: discussion about the Gtk+ cell layouts, and the (future) possibility to extend them to handle generic widget layouts: https://wiki.gnome.org/Projects/GTK+/GtkTreeView/Ideas#Renderer_objects |
Okay, tested accessibility of that demo program in the CodeProject link. Keyboard accessibility shows we can navigate through subitems, but not interact with them? Assistive technologies accessibility (aka automation) is even weirder: Inspect.exe acts as if the subitems aren't there unless we have already started editing one, but UI Spy does but we can't do anything with them? Definitely needs investigation. I wonder if it's a 32-bit vs 64-bit issue, since the download included is 32-bit. Would need to build another 64-bit version with some changes I made locally reverted. Perhaps I could also test the 32-bit version of Inspect.exe and UI Spy, though I doubt they would affect things... |
Okay, going to analyze and respond to @bcampbell's stuff on table parts now, because I'm trying to redo the messy OS X table implementation and the parts system is inconsistent in ways that will affect the implementation changes I want to make, so maybe instead of making it consistent there's something better in these suggestions. They are
(I thought there was another page somewhere...) My response will be the next comment. Sorry for the delay in this! |
Oh sorry, I missed the link... on GH I only see half window header, but on imgur it's ok... |
It was Kotlin version: import libui.*
fun main(args: Array<String>) = appWindow(
title = "Table",
width = 800,
height = 480
) {
val model = TableModel {
var row9text = "Part"
var yellowRow = -1
var checkStates = IntArray(15)
val image0 = Image(16.0, 16.0) {
add(image0_16x16, 16, 16, 64)
add(image0_32x32, 32, 32, 128)
}
val image1 = Image(16.0, 16.0) {
add(image1_16x16, 16, 16, 64)
add(image1_32x32, 32, 32, 128)
}
numColumns { 9 }
columnType { when (it) {
3, 4 -> uiTableDataTypeColor
5 -> uiTableDataTypeImage
7, 8 -> uiTableDataTypeInt
else -> uiTableDataTypeString
}}
numRows { 15 }
getCellValue { row, col -> when (col) {
0 -> TableDataString("Row $row")
1 -> TableDataString("Part")
2 -> TableDataString(if (row == 9) row9text else "Part")
3 -> when (row) {
yellowRow -> TableDataColor(RGBA(1.0, 1.0, 0.0))
3 -> TableDataColor(RGBA(1.0, 0.0, 0.0))
11 -> TableDataColor(RGBA(0.0, 0.5, 1.0, 0.5))
else -> null
}
4 -> if ((row % 2) == 1) TableDataColor(RGBA(0.5, 0.0, 0.75)) else null
5 -> if (row < 8) TableDataImage(image0) else TableDataImage(image1)
6 -> TableDataString("Make Yellow")
7 -> TableDataInt(checkStates[row])
8 -> when (row) {
0 -> TableDataInt(0)
13 -> TableDataInt(100)
14 -> TableDataInt(-1)
else -> TableDataInt(50)
}
else -> null
}}
setCellValue { row, col, value -> when (col) {
2 -> if (row == 9) row9text = value!!.string
6 -> {
val prevYellowRow = yellowRow
yellowRow = row
if (prevYellowRow != -1)
rowChanged(prevYellowRow)
rowChanged(yellowRow)
}
7 -> checkStates[row] = value!!.int
}}
}
add(widget = VerticalBox {
padded = true
add(stretchy = true, widget = Table(model, {
textColumn("Column 1", 0, uiTableModelColumnNeverEditable)
imageTextColumn("Column 2", 5, 1, uiTableModelColumnNeverEditable, 4)
textColumn("Editable", 2, uiTableModelColumnAlwaysEditable)
setRowBackgroundColorModelColumn(3)
checkboxColumn("Checkboxes", 7, uiTableModelColumnAlwaysEditable)
buttonColumn("Buttons", 6, uiTableModelColumnAlwaysEditable)
progressBarColumn("Progress Bar", 8)
}))
})
} But libui |
Well,
|
Yes, the crash is the test program not being fully updated yet. The proper size of the edit on Windows is a TODO. The real listview has a lot more space at the right edge than I do, but I can't figure out the source of that space. (Also remember that libui still has DPI awareness turned off. I want to do the changes in this and Also I wonder if the icons in 125% mode should still be 16x16 or not. Not sure about column headers on Mac; need to check both that code and Interface Builder again. And yes, totally need to run asan on all this :D |
Trying to fix memory leak, ran into another bug - |
Will there be handlers for |
At some point in the future, yes. |
Has any thought gone into sorting and filtering API wise? GTK has GtkTreeModelSort and GtkTreeModelFilter, abstracting sorting and filtering from the underlying data model. It however seems to me that using these interfaces would just complicate things and make the implementation less flexible. On macOS the mechanism seem to operate directly on the data. Ideas for sorting:
The interface for 2 and 3 might seem a little odd at first, but quite often more than once column is needed to sort properly. Possibly even data that is not shown in the table? Ideas for filtering
Again here for 2 and 3 I would go with a filter by row and not elements necessarily displayed in the table to allow for pre-processing. Comments? |
I could merge this as is now, apart from documentation (which hopefully shouldn't take long to write). However, I can slightly optimize things on GTK+ if I split the model Int type into a ModelBool and ModelProgress types. I'm not sure if I should now, should later (breaking things), or not at all... |
If you ask for personal opinions - it should be merged, if test-page16 works on all platforms. And one more very personal opinion - |
Tables are now in master. |
I forget, did I mark anything else as blocking Alpha 4? Because I might just go ahead and push that out now. I want to make some deeper changes next, which will make the Windows code (and hopefully all the other code too) more stable and responsive, and then I can do fun stuff like High DPI and text input =P I'll get to the PRs I've been sitting on tomorrow. |
For me blocking is only #395 |
The only one (sort of) blocking for me is #364, and you have that one marked as blocking also. |
For CI I might change it to "will test live". It shouldn't hurt if I quickly remove bad files and manually upload fixed ones anyway. AppVeyor being slow can be dealt with separately. For timer destruction I could just patch up |
But if it not called - some global system resources can be not disposed, at least on windows. |
Which global system resources stick around after the program exits? That doesn't seem right to me... Either way, fixing it now. |
I know it's still a maybe, but I'd really love a stripped down table that I can use as a listbox. My use case also involves frequently replacing the entire data set and that's proven to be somewhat tricky. Any ideas about when/if either of those things might be possible? |
consider nonheader style table as TableParams? |
SetCellValue is not called on state change of an editable checkbox column in a table on OSX (whether a checkbox column or checkbox text dual-column). Originally reported in Go UI (andlabs/ui#357), but I also encountered in Ruby LibUI, so it is a general libui issue. |
Fixed in #509 not merged though. I actually have a collection of table related fixes table-fixes for anyone who might be interested. I have also continued adding some new table related APIs in table-ng. This includes a more complete tester, row double click, header visible/invisible, header width get/set, and header sort indicators. All not breaking the existing API, although I would like to add an ID to All of these should be in separate PRs, seems @andlabs is sadly busy with other things these days though... Any chance some of us could help with merging PRs and resolving issues via commit access? I know this does require a fair amount of trust but it would be amazing to get this project rolling again. Thanks for all the great work so far! |
This thread exists to collect all the requests for Table and coordinate merging the feature back into master now that I'm ready to focus attention on it.
This thread includes by proxy the discussion in #159.
@bcampbell what's your current status on your Table Windows code, and what does it do currently?
Table will include Tree eventually, but not initially.
Requests from the Go side:
Other requests:
The text was updated successfully, but these errors were encountered: