March 28, 2024, 07:14:52 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Linked lists (use of)

Started by Andy, November 18, 2017, 01:15:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Andy,
Here is a crash course on Linked Lists with C/C++ and Java examples:  http://www.geeksforgeeks.org/data-structures/linked-list/.

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


Good luck!
Egil
Support Amateur Radio  -  Have a ham  for dinner!

aurelCB

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.

LarryMc


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.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

November 18, 2017, 01:27:59 PM #4 Last Edit: November 18, 2017, 01:35:05 PM by LarryMc
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!


LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

aurelCB

Yes LarryMc have a right
almost there is no better data container when we talk about dynamic range of container 8)

Andy

Thanks guys for the explanation and links.

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

Thanks!

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.