Hi Scuri,

Just an update of my investigation before I go to bed.

If I change the line in iListGetNaturalItemsSize() from

*h += 2*ih->data->spacing;

to

*h += 2*ih->data->spacing + 1;

which means one more pixel as a spacing in the custom area, 30 lines in the list means 30 pixels. The result looks good. I'm not only seeing the last line, but also getting almost 10 more pixel lines.

I don't think it's a problem in item size, otherwise we have to use fraction spacing, I think the custom area is somehow smaller than expected. I'll update to you when I find more.

Kind regards
Andy

On 3 April 2014 11:56, Andy Xiyue <xiyue077@gmail.com> wrote:
Hi Scuri,

Here I am again :-)

When I was studying the IupList control, I found the exposed area of SCROLLBAR=NO is slightly smaller than SCROLLBAR=YES. Please find the attached screenshots. The example list has 30 items. Please find the source code in the mail.

In IupList_scrollbar_yes.png, which applied SCROLLBAR=YES, gcc -Wall -DSCROLLBAR -o list list.c ... , there were 30 lines.

In IupList_scrollbar_no.png on the other hand, which applied SCROLLBAR=NO, gcc -Wall -o list list.c ... , there were 29 lines.

The difference seems trivial because the 30th line could be exposed by moving the borderline of window. However it would cause a crippled situation when I'd managed to wrap two or more lists with a scrollbox. In IupList_scrollbox.png, gcc -Wall -DSCROLLBOX -o list list.c ... , when the scrollbar of the scrollbox roll down to the end, there were still 29 lines.

I have tried to adjust the lines of list and found the missing lines would be increased along with lines. For example, if there were 100 lines in the list, the scrollbox would display 96 lines. But if there were 20 lines, only 1/2 line would be missed.

If looks like an error was accumulating in the list when SCROLLBAR=NO. Another test showed the error is different between windows and gtk, smaller in windows. But the error always exists.

I'm not sure if it's a bug or designed to be like this. After all the scrollbox hasn't been stated as a standard control. Would you mind to have a look at this anyway please? I need to find a way around this to make my listview work.

Kind regards
Andy

--------------- example of list.c ----------------
#include <stdlib.h>
#include <stdio.h>
#include <iup.h>
#include <iupkey.h>

static Ihandle *generate_workarea(void)
{
    Ihandle    *lb_main, *vb_main, *lst_main, *lb_size, *vb_size, *lst_size, *hbox;
    char    *p;
    int    i;

    lb_main = IupLabel("Files");
    //IupSetAttribute(lb_main, "RASTERSIZE", "200");
    lst_main = IupList(NULL);
    IupSetAttribute(lst_main, "EXPAND", "YES");
    IupSetAttribute(lst_main, "MULTIPLE", "YES");
#ifdef    SCROLLBAR
    IupSetAttribute(lst_main, "SCROLLBAR", "YES");
#else
    IupSetAttribute(lst_main, "SCROLLBAR", "NO");
#endif
    vb_main = IupVbox(lb_main, lst_main, NULL);

    lb_size = IupLabel("Size");
    lst_size = IupList(NULL);
    IupSetAttribute(lst_size, "EXPAND", "VERTICAL");
    IupSetAttribute(lst_size, "SCROLLBAR", "NO");
    vb_size = IupVbox(lb_size, lst_size, NULL);

    for (i = 1; i <= 30; i++) {
        p = malloc(32);
        sprintf(p, "Mytestfile%03d.txt", i);
        IupSetAttributeId(lst_main, "", i, p);
        IupSetAttributeId(lst_size, "", i, "10.997GB");
    }

    hbox = IupHbox(vb_main, vb_size, NULL);
    return hbox;
}

int main(int argc, char* argv[])
{
    Ihandle    *mbox, *dlg;

    IupOpen(&argc, &argv);

    //mbox = IupButton("Remove", NULL);
#ifdef    SCROLLBOX
    mbox = IupScrollBox(generate_workarea());
    IupSetAttribute(mbox, "RASTERSIZE", "400x400");
#else
    mbox = generate_workarea();
#endif
   
    dlg = IupDialog(mbox);
    IupSetAttribute(dlg, "TITLE", "IupList Test");
    IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

    IupMainLoop();
    IupClose();
    return 0;
}