Search code examples
csplitoverflowexpandiup

IUP split overflowing dialog?


The gui I'm trying to create follows this simple logic:

  • IupDialog:
    • IupVbox
      • IupSplit
        • IupList
        • IupList

The lists are supposed to fill the split, and have scrollbars if needed. This is working, however, if I resize the window just a bit, the IupVbox becomes so big as to not fit the dialog and you can't see it's margins or the list's scrollbars. I'm probably doing something wrong, but I can't figure it out.

Here's a simplified version of what I'm doing:

Ihandle *page, *box_options, *split, *btn_work, *dlg;
{
    list_entries = IupList(NULL);
    IupSetAttribute(list_entries, "EXPAND", "YES");
}
{
    list_log = IupList (NULL);
    IupSetAttribute(list_log, "EXPAND", "YES");
}

split = IupSplit(list_entries, list_log);
IupSetAttribute(split, "ORIENTATION", "VERTICAL");

page = IupVbox(split, NULL);
IupSetAttribute(page, "GAP", "20");
dlg = IupDialog(page);
IupShowXY (dlg, IUP_CENTER, IUP_CENTER);

Solution

  • It occurs only when the list has many items, or an item is very large.

    The problem is that the natural size of the list by default considers all its items. So it is larger than the actual size of the dialog, even when using expand=yes and inside the split. This is a historic behavior and cannot be changed.

    To avoid that we have two attributes: VISIBLECOLUMNS and VISIBLELINES, that when set will disable this behavior of the natural size. For instance:

    IupSetAttribute(list_entries, "VISIBLECOLUMNS", "10"); IupSetAttribute(list_entries, "VISIBLELINES", "3");

    Then your sample should work as you expected.