Discussion:
[Foxgui-users] FXListBox
Julia Dudascik (Contractor)
2016-08-05 21:02:36 UTC
Permalink
I am trying to add an array of items (type char*) to FXListBox. I think the
function I want is fillItems?

When I pass it my char* array, however, the list box only shows the first
item in the array. I have also tried FXString arrays, etc. Each ends with
the same result. The only way I can get it to work is if I do this
"fillItems("item1\nitem2"). The problem is that most of my lists will have
char * arrays and it would be easier if I could use those existing arrays.

1.) How do I add a char* array for my list of items to FXListBox?

Thanks
Julia
JVZ
2016-08-05 21:47:53 UTC
Permalink
On Fri, 5 Aug 2016 17:02:36 -0400
Post by Julia Dudascik (Contractor)
I am trying to add an array of items (type char*) to FXListBox. I think the
function I want is fillItems?
When I pass it my char* array, however, the list box only shows the first
item in the array. I have also tried FXString arrays, etc. Each ends with
the same result. The only way I can get it to work is if I do this
"fillItems("item1\nitem2"). The problem is that most of my lists will have
char * arrays and it would be easier if I could use those existing arrays.
1.) How do I add a char* array for my list of items to FXListBox?
Thanks
Julia
Listbox fillItems() taks const char**, not const char*. So pass array
of pointers to characters, with last one being NULL.

Something like:

const char* elements[]={
"first",
"second",
"third",
NULL
};

that would do the job.


-- JVZ



+----------------------------------------------------------------------------+
| Copyright (C) 16:40 08/ 5/2016 Jeroen van der Zijp. All Rights Reserved. |
+----------------------------------------------------------------------------+

------------------------------------------------------------------------------
Loading...