Thanks for the tip. If I wanted to have these sub-windows created automatically (and not rely on a particular event), would it be better to create the windows from within the "initially" method or the "init_dialog"method?

Robert Parlett wrote:

On Saturday 30 October 2004 04:05, Daniel Boulet wrote:


What's the best way to open multiple modeless windows (_Dialog class)
and polls them for events?  I tried a couple of different techniques but
neither works.  My first attempt involved open all windows "modeless"
except the last "modal" but this did not work.  Events in the last
window were captured but events in the first were not.  This seems to
contradict the comments in the gui.icn source file.



This is right - opening a modal dialog will block input to all other dialogs (including "modeless" ones).



I then tried a technique discussed in the "Graphics Programming in Icon"
book (see code stub below). This didn't work either because I'm not
passing the correct information to the window's event handler or I'm not
calling the correct handler. Any suggestions would be appreciated.
....



I don't know if this helps, but perphaps what you want to do is to open the first dialog as modal - that is essentially your app's main window - and from within that modal dialog open other modeless dialogs as required. Then all windows will accept input concurrently. For example, try the following.


class dialog : _Dialog(text_button_1, text_field_1)
  method handle_text_button_1(ev)
     if ev.code=1 then {
        d := dialog()
        d.show_modeless()
     }
  end

  method handle_text_field_1(ev)
  end

  method handle_default(ev)
  end

  method dialog_event(ev)
     case ev.get_component() of {
        text_button_1 : handle_text_button_1(ev)
        text_field_1 : handle_text_field_1(ev)
        default : handle_default(ev)
     }
  end

  method init_dialog()
  end

  method end_dialog()
  end

  method setup()
     self.set_attribs("size=151,113", "bg=pale gray")
     text_button_1 := TextButton()
     text_button_1$set_pos("50%", 63)
     text_button_1$set_align("c", "t")
     text_button_1$set_label("Open another...")
     text_button_1$set_internal_alignment("c")
     self$add(text_button_1)
     text_field_1 := TextField()
     text_field_1$set_pos("50%", 20)
     text_field_1$set_size(60, )
     text_field_1$set_align("c", "t")
     text_field_1$set_draw_border()
     text_field_1$set_contents("")
     self$add(text_field_1)
  end

  method component_setup()
     self.setup()
  end

  initially
     self$_Dialog.initially()
end

procedure main()
d := dialog()
# must be modal or it will just return and fall off the end of main and
# exit
d.show_modal()
end



------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ Unicon-group mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/unicon-group






------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ Unicon-group mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to