1. wxEuphoria add items to list box
- Posted by buzzo Nov 17, 2014
- 1448 views
Having a difficult time adding items to a wxListBox. Latest ver of wxEuphoria.. under Win7.
Here is code to create the list box. It behaves as expected.
constant db_group = create(wxStaticBox, {Win,-1,"",dbGX,dbGY,dbGW,dbGH}), label_db_group = create(wxStaticText,{db_group,-1," Databases ", (140-56)*.5,1,56,14,0}), list2 = create(wxListBox,{db_group,-1,5,24,130,268})
This is the code to populate the list box.. see coments
procedure open_a_DB() --startfold integer result object dbName = {} result = db_open(pathTodbList) if result != DB_OK then message_box("Unable to open a Database .... none exist." & CR & "Close this message box, and select Create A New Family/Surname Database. ", "No Database(s) Exist", #0 ) else db_select_table("databases") x = db_table_size() for i = 1 to x do dbName = db_record_data(i) puts(1,to_string(dbName) & CrLf) -- prints correctly insert_item( list2, i, dbName ) -- nothing is placed in the list box --insert_listctrl_item( list2,i,dbName,0) -- nothing is placed in the list box --set_first_list_item(list2,dbName) -- nothing is placed in the list box --add_item( list2,{dbName}) -- error message indicates add_item does not exist end for refresh_window ( Win) -- nothing changes show_window(db_group,1) -- displays correctly end if end procedure --endfold
Help appreciated
2. Re: wxEuphoria add items to list box
- Posted by ghaberek (admin) Nov 17, 2014
- 1439 views
A wxListBox is a simple list of string items. It looks like you are confusing it with a wxListCtrl (a.k.a. "ListView"). Try this instead...
add_item( list2, dbName )
-Greg
3. Re: wxEuphoria add items to list box
- Posted by buzzo Nov 17, 2014
- 1394 views
tried add_item ( list2,dbName )
have this error message when using add_item: errors resolving the reference.... add_item
did a search for add_item in wxeud.e.. found this at line 229:
WX_ADD_ITEM = wx_define_c_proc( "add_item", {dll:C_POINTER,dll:E_OBJECT} ),
and these, starting at line 6441:
--Inserts the item into the /i list before /i position. Not valid for /b wxLB_SORT or /b wxCB_SORT styles, use /add_item instead. public procedure insert_item( atom list, integer position, sequence text ) c_proc( WX_INSERT_ITEM, {list, position, text} ) end procedure --/topic List Controls --/proc add_item( atom combo, sequence text ) -- --Used to add one or more strings into a /wxListBox, /wxComboBox, or /wxChoice. -- /i text can be either a string, or a sequence of strings, in which case all of the -- items will be added. -- --This is also used to enter one or more string, bitmap sequences into a /wxBitmapComboBox. public procedure add_item( atom list, sequence text ) c_proc( WX_ADD_ITEM, {list, text} ) end procedure
Could there be a duplicate routine, add_item, in some other include ????
4. Re: wxEuphoria add items to list box
- Posted by buzzo Nov 17, 2014
- 1396 views
found probable name conflict in euphoria
in the manual, 8.16.4.7 add_item
5. Re: wxEuphoria add items to list box
- Posted by ghaberek (admin) Nov 17, 2014
- 1373 views
Strange... shouldn't the interpreter be providing some sort of useful error about the conflict then?
I certainly get an error using the following code...
include std/sequence.e include wxeu/wxeud.e constant Main = create( wxFrame, {0, -1, "Test", -1, -1, 640, 480} ), List = create( wxListBox, {Main, -1} ), $ add_item( List, "Item One" ) wxMain( Main )
<0074>:: Errors resolving the following references: 'add_item' (test.exw:10) has been declared more than once. in C:/Euphoria/include/std/sequence.e in C:/Euphoria/include/wxeu/wxeud.e add_item( List, "Testing" )
In any case, the issue is resolved thusly...
include std/sequence.e include wxeu/wxeud.e as wx -- ADD 'wx' NAMESPACE HERE constant Main = create( wxFrame, {0, -1, "Test", -1, -1, 640, 480} ), List = create( wxListBox, {Main, -1} ), $ -- ADD 'wx' NAMESPACE HERE TOO wx:add_item( List, "Item One" ) wxMain( Main )
-Greg
6. Re: wxEuphoria add items to list box
- Posted by buzzo Nov 17, 2014
- 1413 views
Thanks for the namespace fix...
I get an error message.. bot not as detailed as yours..
I choose to use the wxListCtrl..
list2 = create(wxListCtrl,{db_group,-1,5,24,130,268}) void = insert_list_column( list2, 0," Family/Surname",0,130)