Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
Hello. I am trying to code a simple List Box that can be added to, deleted from and is finally accepted and processed. Problem is that my logic for AddItem and DeleteItem rely on using the routine, DwtListBoxItemExists as below... text_value = DwtSTextGetString (txtwid); list_entry = DwtLatin1String (text_value); item_exists = DwtListBoxItemExists (listwid,list_entry); if (item_exists == TRUE) DwtListBoxDeleteItem (listwid,list_entry); else Panic ("Item doesn't exist in list"); The problem is that only the first item in the list ever returns as true to allow itself to be deleted. The same logic inverted to see if an item already exists to disallow duplicates works fine. Am I doing something wrong and, if so what? Thanks for any help, George
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
2831.1 | DwtListBoxItemExists returns the position, not a boolean | R2ME2::VANGILDER | Jim V., DECwindows Toolkits | Tue May 29 1990 20:00 | 16 |
> > item_exists = DwtListBoxItemExists (listwid,list_entry); > if (item_exists == TRUE) > DwtListBoxDeleteItem (listwid,list_entry); > else > Panic ("Item doesn't exist in list"); DwtListBoxItemExists returns the position of the item in the list (or 0 if not found). You are then comparing that position to TRUE (whose value is 1), so you'll only get a match on the first item. Change the if to: if (item_exists > 0) |