wxRadioBox in Custom Dialog

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

Hello All,
Is this strange behavior, or am I doing something stupid?  I'm guessing
it's me.  When I add a wxRadioBox (D1RadioBox) to the custom dialog
(Dialog1) in the code below, it affects whether the main frame (MainFrame)
is active when I return from Dialog2.  If I remove the radio box from
dialog 1, both dialogs return to an active main frame.  With the radio box
in dialog 1,  dialog 1 returns to an active main frame and dialog 2 returns
to an inactive main frame.
Perplexed,
Gnu-B

without warning
with trace

include     print.e
include     wxEuphoria.e
include     wxButton.e
include     wxText.e
include     wxMenu.e
include     wxSizer.e
include     wxStatusBar.e
include     wxScrollBar.e
include     wxCheckBox.e
include     wxStatic.e
include wxDialog.e

atom void

constant
MainFrame= create( wxFrame, {0, -1, "Main", 10, 10, 300, 200}),
StatusBar= create( wxStatusBar, {MainFrame,1,-1}),
MenuBar= create( wxMenuBar, MainFrame ),
FileMenu= create( wxMenu, { MenuBar, "&File"}),
FileExit= create( wxMenuItem, {FileMenu, wxID_EXIT, "&Exit"}),
SettingsMenu= create( wxMenu, { MenuBar, "&Settings"}),
Dialog1= create( wxMenuItem, {SettingsMenu, 2, "&Dialog 1"}),
SettingsMenuSep= create( wxMenuItem,{ SettingsMenu, wxID_SEPARATOR, "-"}),
Dialog2     = create( wxMenuItem, {SettingsMenu, 3, "&Dialog2"}),

MainPanel= create( wxPanel, {MainFrame, 1, "Main"}),

D1Dialog= create( wxDialog, {MainFrame, -1, "Dialog 1", 10, 10, 200, 160}),
D1Label= create( wxStaticText, {D1Dialog, -1, "Dialog 1", -1,-1,180,25}),
D1RadioBox= create( wxRadioBox, {D1Dialog, -1, "Dialog 1", -1, -1, -1, -1,
{"Choice 1", "Choice 2"}, 0, -1 }),
D1DoneBtn= create( wxButton, {D1Dialog, -1, "Done"}),

D2Dialog= create( wxDialog, {MainFrame, -1, "Dialog 2", 10, 10, 200, 120}),
D2Label= create( wxStaticText, {D2Dialog, -1, "Dialog 2", -1,-1,180,25}),
D2Text= create( wxTextCtrl, {D2Dialog, -1, "Dialog 2", -1, -1, 180, 20}),
D2DoneBtn= create( wxButton, {D2Dialog, -1, "Done"})

procedure init( )
      atom vs, hs
      vs = create( wxBoxSizer, wxVERTICAL )
      add_window_to_sizer( vs, D1Label, 0, wxLEFT + wxTOP, 5 )
      add_window_to_sizer( vs, D1RadioBox, 0, wxTOP, 5 )
      add_window_to_sizer( vs, D1DoneBtn, 0, wxTOP, 5 )
      set_sizer(D1Dialog, vs )

      vs = create( wxBoxSizer, wxVERTICAL )
      add_window_to_sizer( vs, D2Label, 0, wxLEFT + wxTOP, 5 )
      add_window_to_sizer( vs, D2Text, 0, wxLEFT + wxTOP, 5 )
      hs = create( wxBoxSizer, wxHORIZONTAL )
      add_window_to_sizer( hs, D2DoneBtn, 0, wxLEFT + wxTOP, 5 )
      add_sizer_to_sizer( vs, hs, 0, wxTOP, 1  )
      set_sizer( D2Dialog, vs )
end procedure

init()

procedure show_dialog1( atom this, atom event_type, atom id, atom event )
      void = show_modal( D1Dialog )
end procedure
set_event_handler({MainFrame, Dialog1}, 2, wxEVT_COMMAND_MENU_SELECTED,
routine_id("show_dialog1"))

procedure un_load_dialog1( atom this, atom event_type, atom id, atom event
)
      end_modal ( D1Dialog, -1 )
end procedure
set_event_handler(D1DoneBtn, -1, wxEVT_COMMAND_BUTTON_CLICKED, routine_id(
"un_load_dialog1" ))
set_event_handler(D1Dialog, get_id(D1Dialog), wxEVT_CLOSE_WINDOW,
routine_id( "un_load_dialog1" ))

procedure show_data_dir( atom this, atom event_type, atom id, atom event )
      void = show_modal( D2Dialog )
end procedure
set_event_handler({MainFrame, Dialog2}, 3, wxEVT_COMMAND_MENU_SELECTED,
routine_id("show_data_dir"))

procedure un_load_data_dir( atom this, atom event_type, atom id, atom event
)
      end_modal ( D2Dialog, -1 )
end procedure
set_event_handler(D2DoneBtn, -1, wxEVT_COMMAND_BUTTON_CLICKED, routine_id(
"un_load_data_dir" ))
set_event_handler(D2Dialog, get_id(D2Dialog), wxEVT_CLOSE_WINDOW,
routine_id( "un_load_data_dir" ))

procedure term_opt( atom this, atom event_type, atom id, atom event )
      cleanup()
      abort(0)
end procedure
set_event_handler({MainFrame, FileMenu}, wxID_EXIT,
wxEVT_COMMAND_MENU_SELECTED, routine_id("term_opt"))

wxMain( MainFrame )


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

Search



Quick Links

User menu

Not signed in.

Misc Menu