Submitted by Anonymous on Mon, 12/22/2003 - 07:36. General Questions
I am using openmotif 2.2.2-5 and XFree86 4.2.0-8 on RedHat 7.3. I am debugging a problem with some legacy code. It seems openmotif is doing things by default that the original coding does not anticipate. There is a list widget containing strings starting with digits (items starting with alphabetic characters work ok for some reason). As the user enters a digit the list is supposed to scroll to the list entry that matches all the keystrokes to that point. The implementation searches the list widget, iterates through the strings in the list widget, uses XmStringGetLtoR() to extract list widget strings, and a simple strncmp() to match the strings. The result is a list position if there is match against what has been entered so far. XmListSelectPos() is then used to position at the matched item. The code does what it should up to the point where XmListSelectPos() returns. However, some other actions take place that make me believe there is something called "matchBehavior" occurring and that I have turned on XmQUICK_NAVIGATE by default. I'm looking at the openmotif source code, file List.c, function QuickListNavigate(), and see a return that is triggered iat line 7305 by the if expression "lw->list.matchBehavior != XmQUICK_NAVIGATE". My trouble begins after the if, so how do I change the behavior of the list widget in question so either the match behavior is not XmQUICK_NAVIGATE or so there is never a consideration for list search behavior in the first place?
Here's a backtrace from the line 7305 in List.c for what it may be worth:
(gdb) bt
#0 ListQuickNavigate (wid=0x8229da0, event=0xbffff760, params=0x0, num_params=0x402728e4) at List.c:7305
#1 0x40261a7f in HandleActions (w=0x8229da0, event=0xbffff760, stateTree=0x822d750, accelWidget=0x0, procs=0x82de7d4, actions=0x402728dc) at TMstate.c:632
#2 0x40262102 in HandleSimpleState (w=0x8229da0, tmRecPtr=0x8229dd0, curEventPtr=0xbffff5e0) at TMstate.c:870
#3 0x402627cc in _XtTranslateEvent (w=0x8229da0, event=0xbffff760) at TMstate.c:1088
#4 0x40235281 in XtDispatchEventToWidget (widget=0x8229da0, event=0xbffff760) at Event.c:980
#5 0x40235ed2 in _XtDefaultDispatcher (event=0xbffff760) at Event.c:1441
#6 0x40236193 in XtDispatchEvent (event=0xbffff760) at Event.c:1497
#7 0x0804b6de in main (argc=1, argv=0xbffff844) at Main.c:495
#8 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)
Thank you in advance for any help you may be able to give toward resolving this pesky problem!
I used XtSetArg(..., XmNmatchBehavior, 0) as one of the arguments to create the list widget via XmCreateScrolledList(). The current solution has the desired result. My only question is this: Is there is a correct value to use other than zero for setting the match behavior?
I found XmNONE is the proper value to use to disable list match behavior. Ciao!