Non-modal dialogs. They work!


Subject: Non-modal dialogs. They work!
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Thu May 11 2000 - 02:03:52 CDT


Sorry can't contain myself. I just implemented a simple framework for
non-modal dialogs, tested it with "insert Symbol" and it works! Yay! I can
direct "insert Symbol" output to any of 9 different frames by focussing
that frame. I can keep "insert symbol" up and keep typing then grab a
symbol and insert it whenever I need it.

Hopefully I'll get this all nice and clean and into abi within a few days.
Monday at the latest. Thanks very much to Bruce Pearson, who implenetented
a nice listener scheme for insert_symbol, and hj for his great work with
tracking the focus.

The idea is really simple and really easy to extend to other platforms.
A focus event gets shunted down to fv_view which decides if it's cursor
should blink. hj implemented this. I just snuck in a call back to xap_app
to remember the xap_frame the focus event comes from. The insert Symbol
dialog then goes back to xap_app to find the most recently focussed frame,
uses that to work out the view attached to the frame then sends that view
to the "Insert Symbol" listener to insert the character back in the view.
I commented out the gtk calls that block control flow back to the
main body of abi of course.

I remember frames rather than views for robustness reasons. xap_app keeps
a vector of all running frames. When requesting a frame, the code checks
to see if it is in the vector. If it isn't it returns a valid frame
pointer from the vector.

The next thing to do is to put in code to check to see if a dialog is
currently running. These will be recorded in xap_App as a hash table based
on the dialog id. If the id of dialog is present, it will look up a
pointer to the widget stored in a vector in xap_App, then use the
"activate window" framework to activate it. Otherwise the dialog is
constructed as usual. Upon leaving the dialog the entires in the id hash
table and widget pointer vector are removed.

I may need some help from the C++ experts to get all this nicely
encapsulated into RunModeless methods.

But I'm sure this will all work and be in the tree soon :-)

Cheers

Martin



This archive was generated by hypermail 2b25 : Thu May 11 2000 - 02:04:00 CDT