April 18, 2024, 12:52:11 AM

News:

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


Linked List Issue

Started by Bruce Peaslee, January 26, 2007, 09:42:25 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruce Peaslee

This works fine:


class MoveItemDialog:CDialog
{

   // Overridden Methods
   declare OnClose(),int;
   declare OnControl(int nID, int nNotifyCode, unsigned int hControl),int;
   declare OnInitDialog(),int;
   // Public Methods
   declare SetSelectedText(string sText);
   // Member Variables
   string m_sSelectedItem;
}
...
MoveItemDialog::OnInitDialog(),int
{
   TREE_ITEM *node;
   TREE_ITEM *item;
   CListBox  *pListBox = GetControl(MD_LST_NODELIST);

   for(node = g_List.GetFirst(); node <> 0; node = g_List.GetNext(node))
   {
      item = g_List.GetData(node);
      pListBox->AddString(item->sText);
   }
   CenterWindow();
   return true;
}

MoveItemDialog::SetSelectedText(string sText)
{
   m_sSelectedItem = sText;
}


But if I try this (to reduce clutter), node = g_List.GetFirst() returns zero:


class MoveItemDialog:CDialog
{
   // Member Variables
   string m_sSelectedItem;
   // Overridden Methods
   declare OnClose(),int;
   declare OnControl(int nID, int nNotifyCode, unsigned int hControl),int;
   declare OnInitDialog(),int;
   // Public Methods
   declare SetSelectedText(string sText) {m_sSelectedItem = sText;}
}
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

I don't see a correlation myself.  How about the rest of the code?
Ionic Wind Support Team

Bruce Peaslee

It's now almost 1300 lines. I could send it to you if you want.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles