How to get the mainwindow widget? (with msg?)

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

4 posts / 0 new
Last post
How to get the mainwindow widget? (with msg?)

Submitted by Anonymous on Wed, 11/07/2001 - 09:53. Developers
Hello,

I`m programming against the API of a Motif application without having the source for this application. I would like to add additional widgets (eg. dialogs) lauched from the API methods.
To do this I require a parent widget (ideally the main application window). Is there a way to find the root of the widget tree at runtime?

Guido.

ICS_support

Oh! you don`t have the source (see the answer to your other question).

You can do this only if the application exports this information and can process queries in a way that is useful to you -- because the addresses you`d obtain are useless in the address space of the second application.

That is, you need for the first application to support something like the editres protocol (http//www.motifzone.com/tmd/articles/Editres2/Editres2.html) so that you can get widget addresses but then also to support a request such as "add a dialog to this widget). But the protocols don`t support that sort of addition.

Just what do you imagine that these dialogs would do?

Anonymous

(sorry for posting twice, the msg window was empty just after posting)

To be more precise I would stay in the same address space because the application provides empty callbacks in a separate library (eg. callMeBeforeSaveDocument()) that I can simply override with a new implementation. In this implementation I can communicate with the application using it`s api and of course I can use api-provided pointers to application data. I would simply like to create a dialog in the callbacks (eg. Yes/No/Abort "would you really like to save"). But for this I need a parent widget, which is not in the api. Is it possible get hold of the root of the widget hierachy? Or to create a new application context, display, (invisible) toplevel shell and use this as a parent?

Guido.

ICS_support

Oh! so your code is compiled in. That`s a horse of a different color. Yes, in that case, you can operate as you outline. And you`ll find the code in the comp.windows.x FAQ useful for doing a dialog "in-line"; see www.faqs.org and look for the code for "Answer".