Creating Motif widgets dynamically??

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

Questions about motif? Contact us

3 posts / 0 new
Last post
Creating Motif widgets dynamically??

Submitted by Anonymous on Mon, 10/29/2001 - 08:06. General Questions
I am currently working on an enhancement wherein
I want to create buttons dynamically in my applicaton (wdbgui).
To implement the above feature, I created a Rowcolum
widget in the wdbgui form for placing the buttons(created using XmPushButtonWidget). The
maximum number of buttons that the user can create is 15.

The problem I am currently facing is, with one new rowcolumn
widget in the form, I could place only 8 buttons with label
length of 15. The 9th button is not getting wrapped up in to the
next column but goes invisible . Also, because of this the wdbgui
main window is getting resized. I want neither of them to happen.

Is there a way in motif wherein the button will wrap itself
down if it cannot fit in the first column with the current GUI
dimension ? Say the main window is 500 x 500, without
changing this dimension, is there a way to wrap the buttons
into multiple columns ?
And also the size of the button becomes very small while we reduce the
size of the button a little ...
Any kind of help would be highly appreciated.

ICS_support

You could certainly use an XmForm and handle the attachments yourself.

But it is easier to use the XmRowColumn. I think this particular problem appears in the old Motif Puzzle Book. The XmNorientation resource on XmRowColumn isn`t as powerful as it needs to be i.e. it is hard to say "fill by rows, then columns, up until a maximum of N rows or M columns".

The general solution is to use several XmRowColumns within the original. That is, the outer XmRowColumn has orientation XmHORIZONTAL; several inner ones, as many as you want columns, have orientation XmVERTICAL. Assuming their visual characteristics are the same, you should have the appearance of an NxM set of buttons.

Of course, all of this begs the question about why you have so many buttons, as that isn`t a great interface. Perhaps the items can be put into another form that is more appropriate. If they are really actions, then organizing them into a menu would be better. If they are data choices, an XmList or one of the other choice widgets would be good.

Anonymous

Yes,

You shouldn`t have to force RowColumn to do what it does not do well by passing adjustments to X and motif.

But more likely you should use a higher level widget that is closer to what you expect - or at least a widget that manages the lower rowcolumn widget.

You might use a scrollable form so the button page can be scrolled, or use a dropdown box to select button pages.

But I`m sure you can find free code that has a niftier solution already coded.