Closed siddharth99 closed 1 year ago
I think you want to use a FListView widget in tree view mode. You can expand and collapse sub-lines by clicking the triangle, double-clicking a line, or using the +, -, →, or ← keyboard keys.
Here is a small code example:
#include <final/final.h>
using namespace finalcut;
int main (int argc, char* argv[])
{
FApplication app(argc, argv);
FDialog dialog ("Expand and collapse data", &app);
dialog.setGeometry (FPoint(30, 6), FSize(33, 10));
FListView list (&dialog);
list.ignorePadding();
list.setGeometry (FPoint(1, 2), FSize(33, 9));
// Add columns to the view
list.addColumn ("id", 5);
list.addColumn ("mode", 5);
list.addColumn ("A", 5);
list.addColumn ("B", 5);
list.addColumn ("C", 5);
// Activate tree view
list.setTreeView();
auto iter1 = list.insert ({"X", "*", "2", "2", "2"});
list.insert ({"X", "x1", "1", "1", "1"}, iter1);
list.insert ({"X", "x2", "1", "1", "1"}, iter1);
auto iter2 = list.insert ({"Y", "*", "3", "3", "3"});
list.insert ({"Y", "y1", "1", "1", "1"}, iter2);
list.insert ({"Y", "y2", "2", "2", "2"}, iter2);
app.setMainWidget(&dialog);
dialog.show();
return app.exec();
}
PS: Removing the ID in the sub-lines would emphasize the togetherness.
@siddharth99:
I have not received any further feedback from you. Can I assume that this is a working solution for you?
@siddharth99:
Is this a workable solution for you?
Based on the absence of feedback, I will be closing this issue.
I'm printing very simple pre-formatted text in a tabular format; I am tabulating myself using snprintf(..) etc. In below example I have a (X, *) that is the summation of (X, x1) and (X, x2). I am wondering if there's a way to support a expand section / contract section type syntax with some minor effort or reasonably achieve the same thing by placing buttons to the left of each expanding section and clicking on them.
My widget architecture is FDialog -> FScrollView -> FLabel and I just call FLabel::setText(..) to update the text.
Thanks in advance!