home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17306 < prev    next >
Encoding:
Internet Message Format  |  1992-12-13  |  2.0 KB

  1. Path: sparky!uunet!caen!uvaarpa!adastra!mbs
  2. From: mbs@adastra.cvl.va.us (Michael B. Smith)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Listview selection help!
  5. Distribution: world
  6. Message-ID: <mbs.1g87@adastra.cvl.va.us>
  7. References:  <Bob_Rye.06f0@guru.apana.org.au>
  8. X-NewsSoftware: GRn-beta 1.16g (10.12.92) by Michael B. Smith & Mike Schwartz
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: 8bit
  12. Date: 13 Dec 92 07:36:14 EDT
  13. Organization: Well, I haven't decided on a name yet...
  14. Lines: 37
  15.  
  16. In article <Bob_Rye.06f0@guru.apana.org.au> Bob_Rye@guru.apana.org.au (Bob Rye) writes:
  17. > I have just attached a Listview gadget to a window of mine, and I would
  18. > like to know if it is possible for the user to:
  19. >
  20. > select an item from the list, via a mouse button click, and for the
  21. > selection to remain highlighted in the listview display?
  22. >
  23. > I don't need to have a readonly listview, and I don't need an editable
  24. > selection listview, I only need to receive which entry from the list
  25. > has been selected, and that the selection will remain selected, as in a
  26. > file requester. Any takers?
  27.  
  28. On 2.04 there isn't a legal way to keep the item highlighted/selected (that I
  29. know of anyway).
  30.  
  31. Obviously, you have the { GTLV_ShowSelected, NULL } option, which creates
  32. a readonly box indicating the user's option on 2.04.
  33.  
  34. When the user clicks on a particular line in the listview, the application
  35. should receive an IDCMP_GADGETUP IntuiMessage with the index into the Listview
  36. List in m->Code. Thus, given the List and m->code, this routine will return
  37. the list entry:
  38.  
  39.         struct Node *FindListItem (struct List *list, int num)
  40.         {
  41.                 struct Node *np;
  42.  
  43.                 for (np = list->lh_Head; np->ln_Succ; np = np->ln_Succ) {
  44.                         if (!num)
  45.                                 return np;
  46.                         num--;
  47.                 }
  48.                 return NULL;
  49.         }
  50. --
  51.   //   Michael B. Smith
  52. \X/    mbs@adastra.cvl.va.us  -or-  uunet.uu.net!virginia.edu!adastra!mbs
  53.