3

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

Kingsley
  • 14,398
  • 5
  • 31
  • 53
evolvah
  • 625
  • 4
  • 15

2 Answers2

1

Try calling XtManageChild after XtRealizeWidget.

n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243
  • Thank you for the answer! However, when I do that on the parent widget, which I unrealize before, it still does not render on the screen... – evolvah Jul 20 '11 at 15:06
1

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.

PaulB
  • 357
  • 2
  • 2