Results 1 to 5 of 5

Thread: pointers, base classes, derived classes [resolved]

  1. #1

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Resolved pointers, base classes, derived classes [resolved]

    Sorry about the title, couldn't think of anything informative to put.

    I have a base class CGUIBase. CGUIBasicWindow inherits from this and CGUIButton inherits from CGUIBasicWindow.
    In all three i have virtual 'Render' functions.

    In CGUIBase render simply draws a frame, and shadow, then it loops through it's children (stored as a list containing pointers to CGUIBase), calling their Render functions.
    CGUIBasicWindow renders a texture, then calls CGUIBase::Render
    CGUIButtonWindow render's it's stuff, then calls CGUIBasicWindow::Render

    In my CGUIBase class i've defined a protected variable as follows:

    CGUIBase *m_pParent

    Also in CGUIBase i've made a function (AddWindow) that adds a pointer to a CGUIBase variable to it's childwindow list then i set m_pParent = this (via a public function in CGUIBase that alters m_pParent).

    Now my CGUIButton class doesn't render even if i call it's render function directly (as opposed to letting it's parent window render it).

    If i don't set m_pParent in the AddWindow function, rendering works OK.

    I've spent AGES puzzling over this, but can't find out why, or think of a reason for this to happen.
    I'm only assigning a pointer variable, i'm not initializing a class, then assigning or anything like that so what's wrong.


    I greatly appreciate any replies whatsoever, as i'm quite irritated by this problem.
    Last edited by SLH; Sep 20th, 2004 at 05:01 PM.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  2. #2
    Hyperactive Member Comreak's Avatar
    Join Date
    Feb 2001
    Location
    Dis
    Posts
    319
    I don't have a solution but you might want to post some code from the various portions of your app that you mentioned. It would make it easier to figure out what's going on.
    C.O.M.R.E.A.K.: Cybernetic Obedient Machine Responsible for Exploration and Accurate Killing

  3. #3

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Thank's for the reply.

    I just really wanted to say what i'd done incase anyone replied with "You can't do that! No wonder your app is mucking up!!".

    I'll look into other aspects to see whether it's something else that's causing the problem.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  4. #4
    Lively Member rekcus's Avatar
    Join Date
    Jan 1999
    Location
    Kuala Lumpur
    Posts
    122
    Did you hook onto the OnPaint event?
    penyou!

    "The code bytes.."

  5. #5

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Originally posted by rekcus
    Did you hook onto the OnPaint event?
    No, i'm using DX9 to render things, and i think that must be where the problem lies. Thanks for the reply though.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


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