IonicWind Software

IWBasic => General Questions => Topic started by: Andy on November 18, 2017, 01:15:58 AM

Title: Linked lists (use of)
Post by: Andy on November 18, 2017, 01:15:58 AM
Most of the commands in IWB I know by now, but there are a few I've never tried - one of which is Linked lists.

Reading the help file I get the idea of them - but does any one use them? - and for what purpose?

I've never used them, so am I missing out not doing so?  ???

Thanks,
Andy.
Title: Re: Linked lists (use of)
Post by: Egil on November 18, 2017, 10:13:59 AM
Andy,
Here is a crash course on Linked Lists with C/C++ and Java examples:  http://www.geeksforgeeks.org/data-structures/linked-list/ (http://www.geeksforgeeks.org/data-structures/linked-list/).

Converting the examples to IWB should be relatively problem free...


Good luck!
Egil
Title: Re: Linked lists (use of)
Post by: aurelCB on November 18, 2017, 10:40:06 AM
I use them in Aurel Basic with a big help of LarryMc
and work like a charm,also you may try indirect functions using pointers too.
Title: Re: Linked lists (use of)
Post by: LarryMc on November 18, 2017, 10:56:22 AM

You may want to look at my Enhanced Linked List Class  located here:
http://www.ionicwind.com/forums/index.php?topic=2613.msg22185#msg22185
which gives more control over your list when you build it

Includes full set of examples and Help File

Methods in Class:
     _LList              Class destructor
      AddAfter        Adds node after current node
      AddBefore      Adds node before current node
      AddEnd          Adds node to end.
      AddHead        Adds node to beginning
      ClearAll           Deletes all list nodes
      Count            Number of nodes in list
      Create           Creates an instance of the class
      DelCurrent      Delete current node
      ErrMsg           Description of error code
      GetFirst          Get the first node
      GetLast          Get the last node
      GetNext         Get the next node
      GetPrev         Get the previous node
      LList              Class constructor
      ReadData       Check current node's data
      ReadDataPos  Reads data pointer from a specific node     <- New in version 1.1

Maybe the simple examples will get you started.
Title: Re: Linked lists (use of)
Post by: LarryMc on November 18, 2017, 01:27:59 PM
you asked, "Does anyone use them?"
You bet your a$$.
I could never have built the form editor without them.
When a user builds a form I have no idea what control a user is  going to add,  where it is going to be added, the order they are going to be added/removed.

You wind up with linked list with the basic control id info.  You can use additional LL to store location and other parameters in another LL, if you want (not saying I did in this instance)

BUT, with my visual designer, which involves a parent window/dialog and then multiple child dialog/windows all capable of having controls(all capable of having styles\exstyles\messages) and the windows/dialogs themselves having messages to be handled in CASE routines along with tracking styles\exstyles. I use a TON of LINKEDLISTs.

And even LinkedList trees where the LL's data are Structures and one element in the Structure is a pointer to another LL where the data is a Structure and one element is a pointer to  another LL where the data is a Structure and one element is a pointer to another List which is a Structure. Do-Da!


Title: Re: Linked lists (use of)
Post by: aurelCB on November 18, 2017, 01:40:38 PM
Yes LarryMc have a right
almost there is no better data container when we talk about dynamic range of container 8)
Title: Re: Linked lists (use of)
Post by: Andy on November 18, 2017, 11:51:57 PM
Thanks guys for the explanation and links.

Seems they can be very useful so a bit of reading / experiment is in order.

Thanks!

Andy.
:)