0

I need to have two IconListView in same form. I created a second class for displaying the second listview but while using the AddControl() in the second class it shows an 'undeclared identifier error AddControl'. While the same code works if AddControl() is used in Form class, but my application requires me to use AddControl() in the second class itself. What change should be added to make it usable.

 __pIconListView = new IconListView();
 result r=__pIconListView->Construct(Rectangle(0,300, 600, 300),Dimension(200,200),      ICON_LIST_VIEW_STYLE_NORMAL, ICON_LIST_VIEW_SCROLL_DIRECTION_HORIZONTAL);
 __pIconListView->SetItemProvider(*this);
 __pIconListView->AddIconListViewItemEventListener(*this);
 r=AddControl(__pIconListView);

Made some changes in the code.

And the above code is given in the second class and the AddControl() is in red color meaning its valid. But soon after executing the code, when the execution reaches the AddControl(__pIconListView) the program crashes. The Log says 'Construct should be called before use'. But the above Construct() doesn't make any errors it works fine, I checked the log. So where is this bug comming from! The GetClientAreaBounds() also hits error.

Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179
Rohith Murali
  • 5,551
  • 2
  • 25
  • 26
  • Hello, can you post code from header file where you declare second class? It seems like, there is something wrong with inheritance. – Wert1go Nov 22 '13 at 10:44
  • Yes, you are right I didn't inherit the Form class. Thanks :) – Rohith Murali Nov 25 '13 at 03:10
  • @Wert1go I have edited the question and added more information. Hope you can help me with the crash issue of AddControl() in second class. I have inherited Form,IHttpTransactionEventListener,IIconListViewItemProvider,IIconListViewItemEventListener and IImageDecodeUrlEventListener classes to the second class. – Rohith Murali Nov 25 '13 at 11:26

1 Answers1

0

I found a solution by using AddControl(secondclassObject) in the initial class itself. But with an over head of checking each second whether the required images for the iconlistview has been completely fetched!

But still not found a way to use AddControl() in the second class.

Rohith Murali
  • 5,551
  • 2
  • 25
  • 26