It works better.
After the Insert/Delete, nothing is selected and retrieving the
list of selected items correctly reports the same.
However...
Checking a previous version of our software which used
Motif, I see that after the Insert/Add operation, the newly
added item became selected when deleting the selected
item.
This is consistent with the comment about a quirk of Motif
in _XmListDeletePos, however, it's not getting into that bit
of code because position (2) does not == List_LastHLItem(w)
(which is still 1) So it looks like Insert needs to adjust
LastHLItem.
Fixing this would at least visually make it the same as
Motif. I don't know if Motif issues callbacks telling the
program about the change in selection. One would think
that logically it should.
I have another patch to add which I could submit as a diff,
but with other people changing the module, I'd be submitting
a diff on code that's already changed out from under me. So
maybe somebody could just add them while they're at it...
The following code should be added in places that I'll list
...
if (List_SelectionPolicy(w) == XmBROWSE_SELECT ||
List_SelectionPolicy(w) == XmEXTENDED_SELECT)
{
_XmListInvokeCallbacks(w, event, False);
}
Should be added just before the call to _XmListRedraw in
ListNextPage, ListPrevItem, and ListPrevPage. It's already
being called in ListNextItem
----- Original Message -----
From: "Danny Backx" <[EMAIL PROTECTED]>
To: "Martin Simmons" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "LessTif Mailing List"
<[EMAIL PROTECTED]>
Sent: Sunday, August 22, 2004 3:39 AM
Subject: Re: [Lesstif-discuss] Error in XmList
> I expect the problem described in Dave's message to be fixed now.
>
> Dave, can you verify ?
>
> Danny
>
> On Fri, 2004-08-20 at 19:11, Martin Simmons wrote:
> > >>>>> On Fri, 20 Aug 2004 10:56:16 -0500, "Dave Williss"
<[EMAIL PROTECTED]> said:
> >
> > Dave> ----- Original Message -----
> > Dave> From: "Martin Simmons" <[EMAIL PROTECTED]>
> > Dave> To: <[EMAIL PROTECTED]>
> > Dave> Cc: <[EMAIL PROTECTED]>
> > Dave> Sent: Friday, August 20, 2004 4:39 AM
> > Dave> Subject: Re: [Lesstif-discuss] Error in XmList
> >
> >
> > >> >>>>> On Thu, 19 Aug 2004 16:57:07 -0500, "Dave Williss"
> > Dave> <[EMAIL PROTECTED]> said:
> > >>
> > Dave> There is an error in XmList...
> > >>
> > Dave> Starting condition: You have a list with one item and it's
> > Dave> selected.
> > Dave> Call XmListAddItemUnselected() to add another item before it.
> > Dave> Then XmListDeletePos() to delete the old item.
> > >>
> > Dave> Problem: When adding the new item, it does not adjust the
> > Dave> List_SelectedIndices, so the list still thinks item 1 (the first
> > Dave> one) is highlighted when actually it's item 2.
> > >>
> > >> Look like this could be related to bug # 916711
> > >>
> > >>
> > Dave>
http://sourceforge.net/tracker/index.php?func=detail&aid=916711&group_id=8596&atid=108596
> > >>
> >
> > Dave> Could be related, but this one is more nasty. When you add an
item and then
> > Dave> delete the selected item, we're OK with ending up with nothing
selected.
> > Dave> What's nasty here is that even though nothing is selected, when
you call
> > Dave> XmListGetSelectedPos, it still says that there's one item
selected and
> > Dave> returns a list of one random number (unitialized garbage from
the malloc
> > Dave> that was never filled in - if built for debugging, I think it
has the value
> > Dave> of 0xbaadf00d). We then try to use this item to index into an
array of
> > Dave> stuff and KA BOOM!
> >
> > Dave> A solution to this specific problem is pretty simple. In
> > Dave> XmListGetSelectedPos, we add selected items to the return list
using j as an
> > Dave> array index. When we're done, j is the real number of selected
items and
> > Dave> that's what it should return for the count.
> > Dave> That would solve this problem but hide the real problem which is
that
> > Dave> something isn't keeping track of the number of selected items
correctly in
> > Dave> the first place.
> >
> > Right. I think the underlying bug is that changing the items should
retain
> > the selected *items*, not the selected *indices*. If it did that then
adding
> > an item would adjust the selected indices from { 1 } to { 2 } and
deleting
> > item 2 would adjust the selected indices to nothing.
> >
> > I think that's what the Motif spec requires (e.g. the doc for the
> > XmNselectedItems resource mentions it being updated in certain cases).
> >
> > __Martin
> --
> Danny Backx - danny.backx-at-planetinternet.be http://up.to/danny.backx
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Lesstif-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/lesstif-discuss
>
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Lesstif-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/lesstif-discuss