Discussion:
Using wxList
Tim Burgess
2014-07-05 16:35:03 UTC
Permalink
Hi,

I'm converting a QT4 application to use WX in order to improve its
accessibility. For this reason I'm trying to use wxList as the nearest
equivalent to the qlist class. However, I'm doing something wrong, as I get
the following compilation error from VS2010:

1>clipboard.cpp(242): error C2679: binary '=' : no operator found which
takes a right-hand operand of type 'wxObjectList::iterator' (or there is no
acceptable conversion)

I have the following in my header file:

...
#include "EWI4000SPatch.h" // class definition for the list members
#include <wx/list.h>

WX_DECLARE_LIST(patch_t, clipboard_list);

Class clipboard
{
...
Private:
wxList clipboard_list;
};

In my .cpp I have:

#include "clipboard.h"
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(clipboard_list);
...

In one of my members, I try to iterate through the members of the list in
order to locate one of them based on its position:

...
clipboard_list::iterator it;
patch_t * pPatch;
unsigned int i = 0;

for (it = clipboard_list.begin(); it != clipboard_list.end(); it++)
{
if (i = nSelection)
{
pPatch = *it;
}
i++;
}


The error refers to the line containing the "for".

Can anybody advise me as to where I'm going wrong, please? I thought I'd
followed the example in the .chm help file topic on wxList, but I must have
missed something.

Best wishes.
Tim Burgess
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Igor Korot
2014-07-05 18:27:35 UTC
Permalink
Hi, Tim,
Post by Tim Burgess
Hi,
I'm converting a QT4 application to use WX in order to improve its
accessibility. For this reason I'm trying to use wxList as the nearest
equivalent to the qlist class. However, I'm doing something wrong, as I get
1>clipboard.cpp(242): error C2679: binary '=' : no operator found which
takes a right-hand operand of type 'wxObjectList::iterator' (or there is no
acceptable conversion)
...
#include "EWI4000SPatch.h" // class definition for the list members
#include <wx/list.h>
WX_DECLARE_LIST(patch_t, clipboard_list);
Class clipboard
{
...
wxList clipboard_list;
};
#include "clipboard.h"
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(clipboard_list);
...
In one of my members, I try to iterate through the members of the list in
...
clipboard_list::iterator it;
patch_t * pPatch;
unsigned int i = 0;
for (it = clipboard_list.begin(); it != clipboard_list.end(); it++)
{
if (i = nSelection)
{
pPatch = *it;
}
i++;
}
The error refers to the line containing the "for".
Can anybody advise me as to where I'm going wrong, please? I thought I'd
followed the example in the .chm help file topic on wxList, but I must have
missed something.
Why not use std::list<T> or maybe even std::vector<T>?

Thank you.
Post by Tim Burgess
Best wishes.
Tim Burgess
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Tim Burgess
2014-07-05 22:49:17 UTC
Permalink
Hi,

I must admit that std::vector would be more convenient and probably easier to access, though I found my error anyway:)

I'll see how the port progresses with what I've got and maybe try another class if I hit a brick wall or the performance is poor.

Thanks for the reply in any case.

Best wishes.
Tim Burgess


-----Original Message-----
From: wx-***@googlegroups.com [mailto:wx-***@googlegroups.com] On Behalf Of Igor Korot
Sent: 05 July 2014 19:28
To: wx-***@googlegroups.com
Subject: Re: Using wxList

Hi, Tim,
Post by Tim Burgess
Hi,
I'm converting a QT4 application to use WX in order to improve its
accessibility. For this reason I'm trying to use wxList as the nearest
equivalent to the qlist class. However, I'm doing something wrong, as
1>clipboard.cpp(242): error C2679: binary '=' : no operator found
1>which
takes a right-hand operand of type 'wxObjectList::iterator' (or there
is no acceptable conversion)
...
#include "EWI4000SPatch.h" // class definition for the list members
#include <wx/list.h>
WX_DECLARE_LIST(patch_t, clipboard_list);
Class clipboard
{
...
wxList clipboard_list;
};
#include "clipboard.h"
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(clipboard_list);
...
In one of my members, I try to iterate through the members of the list
...
clipboard_list::iterator it;
patch_t * pPatch;
unsigned int i = 0;
for (it = clipboard_list.begin(); it != clipboard_list.end(); it++) {
if (i = nSelection)
{
pPatch = *it;
}
i++;
}
The error refers to the line containing the "for".
Can anybody advise me as to where I'm going wrong, please? I thought
I'd followed the example in the .chm help file topic on wxList, but I
must have missed something.
Why not use std::list<T> or maybe even std::vector<T>?

Thank you.
Post by Tim Burgess
Best wishes.
Tim Burgess
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Steve Barnes
2014-07-06 07:43:43 UTC
Permalink
Post by Tim Burgess
Hi,
I must admit that std::vector would be more convenient and probably easier to access, though I found my error anyway:)
I'll see how the port progresses with what I've got and maybe try another class if I hit a brick wall or the performance is poor.
Thanks for the reply in any case.
Best wishes.
Tim Burgess
Tim,

Do you think that you could find the time to post the corrected code or
a line on what the problem was so that anybody with the same problem
searching the list will benefit?

Gadget/Steve
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Tim Burgess
2014-07-06 14:51:01 UTC
Permalink
Apologies - I should have done this without having to be reminded.

In my header file:

#include "EWI4000SPatch.h" // Contains the class to be used as list members

WX_DECLARE_LIST(patch_t, myListClass); // this is the first place that I goofed

Class clipboard
{
...
Private:
...
myListClass clipboard_list; // I used wxList clipboard_list previously (goof #2)
};

In my .cpp, before any constructors/destructors/methods:

#include "clipboard.h"
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(myListClass); // Goof #3

In my member, to iterate through the list:

...
for (myListClass::Node * node = clipboard_list.GetFirst(); node; node = node->GetNext() )
{
if (i == nIndex)
{
pPatch = node->GetData();
}
i++;
...

Overall, I managed a comedy of errors, but I'm older and wiser now (well, older anyhow).

Best wishes.
Tim Burgess

-----Original Message-----
From: wx-***@googlegroups.com [mailto:wx-***@googlegroups.com] On Behalf Of Steve Barnes
Sent: 06 July 2014 08:44
To: wx-***@googlegroups.com
Subject: Re: Using wxList
Post by Tim Burgess
Hi,
I must admit that std::vector would be more convenient and probably
easier to access, though I found my error anyway:)
I'll see how the port progresses with what I've got and maybe try another class if I hit a brick wall or the performance is poor.
Thanks for the reply in any case.
Best wishes.
Tim Burgess
Tim,

Do you think that you could find the time to post the corrected code or a line on what the problem was so that anybody with the same problem searching the list will benefit?

Gadget/Steve

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...