Having some issues with PostMessage().  Application crashes with complaint
about calling a pure virtual function; I think it's localized to the message
system because (1) the crash does not occur when the PostMessage(...) call is
commented, and (2) a breakpoint set on the recipient function never triggers.

Relevant code:

* The PostMessage(...) call:  (yeah, I know, it's ugly)

PostMessage( (Panel *)(gViewPortInterface->FindPanelByName( PANEL_BASE )), new
KeyValues( "SetShowPanel", "panel", PANEL_CLASS ) );

* The message handler declared: (in the header file of recipient object)

MESSAGE_FUNC_CHARPTR( SetShowPanel, "SetShowPanel", panel );

* A section of relevant code from the implementation:
static char *m_szPanelNames[] = { PANEL_CLASS };

void CBaseMenu::SetShowPanel( const char *panel )
{
        for ( int i = 0; i < sizeof( m_szPanelNames ); i++ ) {
                if ( Q_strcmp( panel, m_szPanelNames[i] ) )  //  No match
                        PostMessage( (Panel 
*)(gViewPortInterface->FindPanelByName
(m_szPanelNames[i] )), new KeyValues( "SetShade", "state", 0 ) );
                else
                        PostMessage( (Panel *)
(gViewPortInterface->FindPanelByName( m_szPanelNames[i] )), new KeyValues
( "SetShade", "state", 1 ) );
        }
}

---------------

Please excuse the poor formatting.  Any obvious problems with the code?
Thanks.

--
                                I
            think                                poem
   that              never               as                a
I       shall    see        a     lovely      as     binary   tree

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to