|
-
October 8th, 2012, 01:20 PM
#8
Re: Working multiple forms using Visual C++ 2008
How did you know I am using backgroundWorker? and you are not wrong about the difficulties however:-
My tree view has pre-defined root nodes. My method sorts file names into the root nodes according to type. Another method then builds a composite image and passes it back to Form1 for display/save. I use a backgroundWorker to display the image files because it takes a few seconds to display each image when I select a file so scrolling through the list of files is otherwise too slow. I put the file processing in the background worker and display the resulting bitmaps from b/w completed event. If the selected file has changed in this time it then starts over. Is there a way of achieving this without using threads?
BTW I used a method of accessing Form1 which uses a "this" pointer passed from form1 during instantiation. I later changed the form1 access method to the "correct"(???) method using the Parent/ParentForm property and it stopped working in bizarre way!
The original calling method which works:-
Code:
// in modeless form .h
#define form1 safe_cast<Form1 ^>(form1V)
Form^ form1V; // form1V set from "this" passed from Form1 to constructor
this allows me to access Form1 from modeless form, i.e.:-
form1->ShowStack();
//The "correct" method which doesn't work (causes exception to be raised in "unrelated" code):-
Code:
#define form1 safe_cast<Form1 ^>(this->ParentForm)
// but this seems to work:
#define form1 safe_cast<Form1 ^>(Owner)
Using "Owner" instead of parent/parentform seems to work but I am not very clear about what the difference in these three properties.
Thanks RD
Last edited by RogerD; October 8th, 2012 at 01:22 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|