wxEuphoria: get_string_selection() Not Working
- Posted by euphoric (admin) Apr 01, 2015
- 1754 views
In my own code, get_string_selection() is not working. I did a search and found this example using get_string_selection(). The program runs fine, but the selection doesn't work as expected.
-- example6-a.exw -- This opens a window with a list in it. without warning include wxeu/wxeud.e constant WINFRAME = create( wxFrame,{ 0,-1, "List", -1, -1,300,220} ) ,WINPANEL = create( wxPanel,{WINFRAME } ) ,LIST1 = create(wxListBox,{WINPANEL,-1, 10,010,300,140} ) ,BUTTON1 = create( wxButton,{WINPANEL,-1,"Info...", 10,150,060,032} ) ----------------------------------------------------------------------------------------------- procedure Click_BUTTON1(atom this, atom event_type, atom id, atom event) sequence index index = get_selection( LIST1 )+1 -- get index if length(index)=0 then return end if event_type = message_box( sprintf( "List Count = %d \n", {list_count( LIST1 ) } ) &sprintf( "Selected Item Index = %d \n", { index[1] } ) &sprintf( "Selected Item Text = %s ",{get_string_selection( LIST1 )} ),"List Information", 0 ) end procedure ----------------------------------------------------------------------------------------------- set_event_handler(BUTTON1, get_id(BUTTON1), wxEVT_COMMAND_BUTTON_CLICKED, routine_id( "Click_BUTTON1" )) ----------------------------------------------------------------------------------------------- procedure Drop_LIST1() sequence files files={"aaa a aaa","bbb bb bbbb","ccc c cccccccccc","ddd dd ddddd dddd","eeee ee eeeeee"} for i = 1 to length(files) do add_item( LIST1, files[i] ) end for end procedure ----------------------------------------------------------------------------------------------- Drop_LIST1() wxMain( WINFRAME )