Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the right way of building a long scroll list of button widgets in Motif?

I'm dealing with an old Motif application that needs to load and display a long list of entries (around 1500). It creates and manages an instance of xmFormWidgetClass via XtVaCreateManagedWidget() and then it stuffs it with a bunch of linear hierarchies xmFrameWidgetClass->xmFormWidgetClass->xmFormWidgetClass->xmPushButtonWidgetClass. Each PushButton contains a multi-line label. When this this thing is being populated, it takes a lot of CPU, which it spends doing some geometry calculations inside of X/Motif libraries. The pace at which new buttons are added, degrades very quickly. It looks like there is an O(N) algorithm being used inside of XtVaCreateManagedWidget().

The things get much much better if I do XtUnrealizeWidget() on the original instance of the xmFormWidgetClass. Entries are being added at almost constant speed but then I cannot find a way to display the whole thing that I built. XtRealizeWidget() for the original instance of the xmFormWidgetClass does not render it in the window.

What am I doing wrong? Is there a way to populate the hierarchy and then calculate the geometry and render it to the screen at once?

Redesigning the application is an option but it is a last resort type on an option.

Any advice that keeps me within Motif libraries will be highly appreciated!

Regards, /Sergey

like image 512
evolvah Avatar asked Dec 21 '25 05:12

evolvah


2 Answers

Try calling XtManageChild after XtRealizeWidget.

like image 50
n. 1.8e9-where's-my-share m. Avatar answered Dec 23 '25 22:12

n. 1.8e9-where's-my-share m.


Try creating all widgets unmanaged and place them on a WidgetList, then call XtManageChildren(). Please see the following reference

http://www.s-and-b.su/syshlp/motif_guide/MotifProgGuide/Making_Widgets_Visible.html

Every time an individual widget is managed the parent changed_managed procedure is called. XtManageChildren calls the changed_manage procedure only once. This may help.

like image 38
PaulB Avatar answered Dec 23 '25 23:12

PaulB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!