CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 1999
    Location
    malaysia
    Posts
    191

    Displaying same view in multi frames

    Hi gurus,

    Have a small problem which I believe is quite easy for those who are proficient in CViews.....I had been looking around but doesnt seem to help me much in what I am trying to do.

    I have an SDI with a few splitters. Each pane are filled with different views. Information on these views are updated via socket from a server application.

    Recently I had a small request by a user. That is, if the SDI is minimized,and information arrives via socket and update the minimized view, a window should pop-up displaying the view that has been updated. I thought that should be a no brainer.... I was wrong... have not done this before.

    I chose CMiniframeWnd to pop-up and to hold the updated minimized view. I can get the pointer to the updated view from CMainFrame but during OnCreate() function of the CMiniframeWnd, I tried toying with CCreateContext within this function, obviously it failed. I am not sure what to do there... I am not so into doc/view...been avoiding it..

    Any help please......

    Regards

    Mustafa
    Last edited by Mustafa; August 17th, 2008 at 03:19 AM.
    ______________________________
    To err is human, it's the computer that causes blunders !!!

    DO: Dazzle me with your intelligence
    DON'T : Confuse me with your bullshit

  2. #2
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863

    Re: Multi instance of the same view

    I can't quite figure out exactly what your problem is. It sounds like you made some poor design decisions, in that your data is overly coupled with your view.
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  3. #3
    Join Date
    Sep 1999
    Location
    malaysia
    Posts
    191

    Re: Displaying same view in multi frames

    Hi souldog,

    Thanks for the quick reply...I think I know why you got confused, I just changed the title...Incase its not the title...errrrr...how shall I put it...

    Whenever new data arrives via socket to my application it will update a CTreeView. But if the application is minimized, the user is unaware so the solution is for a window to pop-up and display the minimized CTreeView showing the updated tree....

    I just dont know how to use the pointer to the minimized CTreeView to now display it in the pop-up CMiniframeWnd window.

    Oh I forgot to mention, the same CMiniframeWnd also need to display a CListView or CScrollView...it depends on the change. Hence the CMiniframeWnd has to be generic to hold any view that it is instructed to display.

    Hope I word it correctly this time......

    Mustafa
    ______________________________
    To err is human, it's the computer that causes blunders !!!

    DO: Dazzle me with your intelligence
    DON'T : Confuse me with your bullshit

  4. #4
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863

    Re: Multi instance of the same view

    If you mean you want to display the same view (literally the same) in more than one frame, then you are out of luck.

    The proper way to handle this is to have the data separate from the view, then you just create a new view in the mini frame window and have it display the same data that the original view is displaying. The document view architecture provides such a framework, although there are much better designs one could use to implement this pattern. http://en.wikipedia.org/wiki/Model-view-controller

    If you are currently holding your data in the actual view class, then you have problem. This is what I meant when I said you may have made some poor design decisions.

    So where is the data these views are displaying?

    By the way it seems like a strange request. What happens if you get lots of updates on several of the views. Your going to have these views popping up all the time. You should make it possible to disable this feature, so the user can avoid it once he/she realizes how annoying it is.
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  5. #5
    Join Date
    Sep 1999
    Location
    malaysia
    Posts
    191

    Re: Multi instance of the same view

    Gulp......yup thats exactly what I meant....... . You mean CViews were not designed to do that?

    And again yes...data are stored in the CTreeView.... It served it's purpose till now...

    Have not check out the link yet...will do soon after replying to you...

    Thanks again for your help...have some serious thinking to do now....

    Need to scream first...hahaha


    If you have any way around it please give me a shout...

    Have a nice day......

    Mustafa
    ______________________________
    To err is human, it's the computer that causes blunders !!!

    DO: Dazzle me with your intelligence
    DON'T : Confuse me with your bullshit

  6. #6
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863

    Re: Multi instance of the same view

    yes I have a workaround. In the newly created view, in OnInitialUpdate, get a pointer to the original view and pull the data out of it and display it in the new view.
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  7. #7
    Join Date
    Sep 1999
    Location
    malaysia
    Posts
    191

    Re: Multi instance of the same view

    How ironic, my original title was actually the way around...don't u think so??

    Apart from just displaying data in the tree view, it is also used to accept user's dbl-click events to open dialog windows to input data in response to the change. Also the look and feel has to be the same. So declaring another instance of the same view may be the answer.

    If you have the time, why can't a view located somewhere in memory can't draw itself in some other frame? Whats the limitation or conflicts if that was allowed?

    The article is actually sounding like my mother nagging at me right now....hahahaha

    Grrrrrrrr..........
    ______________________________
    To err is human, it's the computer that causes blunders !!!

    DO: Dazzle me with your intelligence
    DON'T : Confuse me with your bullshit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured