Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28445 Discussions

Suggestion for improving IFLOGM features for List & Combo Boxes

dannycat
New Contributor I
228 Views
I have recently attempted to use the iflogm function DlgSet(dlg,IDC_...,n,DLG_NUMITEMS) to define the number of items in a listbox control. When the value on n gets larger than a couple of hundred the program takes an age to fillin the listbox. Thisseems to bebecausewithin IFLOGM the codeis constantly allocating/deallocating the storage required to hold the string information as the strings are inserted. I could understand this if the DLG_ADDSTRING option was apdopted to populate the listboxbut if the size is specified first and the strings are added by index the process should be much quicker than it is.
I also noticed that the string buffers are given a size of 256 bytes even if the maximum length of strings is less. (This is of less significance with regard to speed but uses up lots of memory unnecessarily).

I've used the native Windows API functions to get around this problem in my application. Using the LB_INITSTORAGE message you can specify the number of items and maximum size of each. There is a limit of 32767 to the number of items but for my case this is not an issue. The same logic can be applied to Combo boxes where the CB_INITSTORAGE will perform a similar role.

A typical example is that for 20000 entries the list box is populated in a few seconds using APIas opposed to twenty minutes using IFLOGM DlgSet functions.

Could I suggest that the function DlgSet(dlg,IDC...,n,DLG_NUMITEMS) could have an option to specify the max length of strings and that the storage is allocated using the value of n (already provided)in a single allocation rather than incrementally?

Perhaps there is already a way to do this but I could see anything in documentation.

Thanks

Steve
0 Kudos
2 Replies
Steven_L_Intel1
Employee
228 Views
I will pass this suggestion on to the developers, though I think I'd suggest that a listbox with hundreds of entries could be difficult to use.
0 Kudos
dannycat
New Contributor I
228 Views
Thanks Steve,

I totally agree that list boxes with hundreds of entries could be difficult to use but I need to cover the possiblity that a large number of entries may exist. I have a combo box on the same dialog that can be used just select a sub set of the full list. However 99% of the time the number of items would be less than 100.
0 Kudos
Reply