Re: Creating a new selection box.

new topic     » goto parent     » topic index » view thread      » older message » newer message

I think this demo accomplishes what you need. Make sure you're using wxEVT_COMMAND_COMBOBOX_SELECTED to detect when the list selection changes. Then as euphoric said, create the listbox immediately, hide it, then show it again later.

Hope this helps,

-Greg

 
include "wxeu/wxeud.e" 
without warning 
 
constant  
    frmMain     = create( wxFrame, {0, -1, "Combo Demo", -1, -1, 320, 240} ), 
    pnlMain     = create( wxPanel, {frmMain} ), 
    lblList1    = create( wxStaticText, {pnlMain, -1, "Furniture:", 10, 14, 60, 16} ), 
    cmbList1    = create( wxComboBox, {pnlMain, -1, "", 80, 10, 120, 20} ), 
    lblList2    = create( wxStaticText, {pnlMain, -1, "Details:", 10, 44, 60, 16} ), 
    lstList2    = create( wxListBox, {pnlMain, -1, 80, 40, 120, 120} ), 
    $ 
 
-- populate the combobox 
for i = 1 to 24 do 
    add_item( cmbList1, sprintf("Group %d", i) ) 
end for 
 
-- hide the details 
show_window( lblList2, wxFalse ) 
show_window( lstList2, wxFalse ) 
 
procedure combobox_handler( atom this, atom event_type, atom id, atom event ) 
     
    integer index = get_selection( this ) 
    sequence item = get_combo_item_string( this, index ) 
     
    -- clear any existing details 
    clear_list( lstList2 ) 
     
    -- populate the details 
    for i = 1 to 20 do 
        add_item( lstList2, sprintf("%s Item %d", {item, i}) ) 
    end for 
     
    -- show the details 
    show_window( lblList2, wxTrue ) 
    show_window( lstList2, wxTrue ) 
 
end procedure 
set_event_handler( cmbList1, -1, wxEVT_COMMAND_COMBOBOX_SELECTED, routine_id("combobox_handler") ) 
 
wxMain( frmMain ) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu