April 19, 2024, 09:20:03 PM

News:

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


ListGetPrev

Started by Allan, July 07, 2007, 05:27:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Allan

REQUEST?
I am using the Linked List in Emergence with my own databases and would find it very handy if two more functions were added to the Linked List module.

ListGetPrev or ListGetPrior
and also
ListGetLast

It would be useful for navigating with one to many table connections.

LarryMc

You might want to try my LList object which contains that functionality.

http://www.ionicwind.com/forums/index.php/topic,1632.msg15203.html#msg15203

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

Allan

Larry, I have followed your posts on the LL and have downloaded and read up the Help file.
Really great work. Thank you.

Will it also work with EBasic Linux?

I requested the extra functions hoping for portability and compact code in EBasic.

Ionic Wind Support Team

The linked list in Emergence are doubly linked lists.  It's a simple matter to get the previous node:


SUB ListGetPrev(pos as POINTER),POINTER
DEF pReturn as POINTER:pReturn = NULL
IF pos <> 0
RETURN #<LINKEDLIST>pos.pPrev
ENDIF
RETURN pReturn
ENDSUB


Lists don't have a definitive 'end' so a ListGetLast would have to iterate through the entire list to find the last node. 


SUB ListGetLast(list as POINTER),POINTER
DEF pTemp as POINTER
IF list <> 0
pTemp = list
WHILE #<LINKEDLIST>pTemp.pNext <> 0
pTemp = #<LINKEDLIST>pTemp.pNext
ENDWHILE
        ENDIF
RETURN pTemp
ENDSUB


The LINKEDLIST type is automatically defined for you.

Paul.
Ionic Wind Support Team

Allan

Thanks for the code Paul.

LarryMc

Allan,
My LList was an exercise I went through to really practice with pointers.  "Pointers were not my friend".
It was also an exercise in writing a Class.

If I was going to have any success with my xml efforts I was going to need to be comfortable with all the code in my LList class.

I needed the "missing" functions that Paul provided below.  And my little LList effort put it all together for me.

It was not intended to replace Paul's LinkList fuctions or to compete with them in any way.

Just like my XML class.

I figure some day that Paul (or Sapero) will be looking for something to do and will write a XML Class that blows my pitiful little efforts plum out of the water.  Until then mine is there for anyone who is interested to use.

Will it also work with EBasic Linux?
It is my understanding that the source probably will but the current  .lib file won't.

But that's a question for Paul to answer.

Larry

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

Allan

Larry, I followed your work on XML Posts also. Great.

Have not had need of XML in Windows as of yet though I have used it on PocketPC with the same prog that I am building with EBasic for Windows and....

If you are interested here is a link that has some info on XML CLASS stuff.

http://www.codeproject.com/cpp/FlexibleParser.asp

Thanks for your advice and help.