Simple List Box Mystery (OpenInsight Specific)
At 18 SEP 1998 05:10:09AM Oystein Reigem wrote:
A simple mystery? Is that a contradiction in terms? What I mean is I have this very simple case where this unexplicable thing happens, or perhaps a case of a very simple programming errror on my behalf that I cannot seem to spot. I'd be grateful if somebody else could explain or reproduce the behaviour. Thank you in advance.
I have a non-aware window with a list box and a button. The list box has been populated at design time with three items
BBBBB
CC
AAA
The button has a CLICK script that inserts a new item:
declare function Send_Message
InsPos=Send_Message( @Window : ".LIST", "INSERT", 1, "XXX" )
RETURN 0
Why is it that the new item is always inserted before the last item (see below)? That happens no matter what the row index parameter is. I've tried both 1, 2 and -1. And I always end up with
BBBBB
CC
XXX
AAA
if I do it twice I get
BBBBB
CC
XXX
XXX
AAA
I cannot see which of the XXX's is the newest one, but InsPos is always returned as 3, so I guess the new line is always inserted between the current item 2 and 3.
I run OI 3.61.
- Oystein -
At 18 SEP 1998 08:31AM Aaron Kaplan wrote:
I know it doesn't match with examples given, but is the list box set to sort?
At 18 SEP 1998 10:45AM Oystein Reigem wrote:
Aaron,
Yeah, that's it!
If you say that having the sorted property set completely explains this behaviour I'll just accept that for now. I'll wait to think this one through until I need a sorted list box. It wasn't my intention to have a sorted list box now.
So thanks for sorting this problem out for me (lame pun alert!).
- Oystein -