--
[ Picked text/plain from multipart/alternative ]
Thanks for the help!
I've got the server browser working by using these methods:
vgui::VPANEL GetChildByName(vgui::VPANEL parent, const char *name)
{
for(int i=0;i<vgui::ipanel()->GetChildCount(parent);i++)
{
vgui::VPANEL child = vgui::ipanel()->GetChild(parent, i);
if(Q_strcmp(name, vgui::ipanel()->GetName(child)) == 0) return
child;
}
return NULL;
}
vgui::VPANEL GetServerBrowser()
{
vgui::VPANEL root = enginevgui->GetPanel(PANEL_ROOT);
vgui::VPANEL GameUI = GetChildByName(root, "GameUI Panel");
if(GameUI)
{
vgui::VPANEL BaseGameUI = GetChildByName(GameUI, "BaseGameUIPanel");
if(BaseGameUI)
{
vgui::VPANEL ServerBrowser = GetChildByName(BaseGameUI,
"CServerBrowserDialog");
if(ServerBrowser) return ServerBrowser;
}
}
return NULL;
}
void ToggleServerPanel()
{
vgui::VPANEL server = GetServerBrowser();
vgui::ipanel()->SetVisible(server, !vgui::ipanel()->IsVisible(server));
if(vgui::ipanel()->IsVisible(server))
vgui::ipanel()->MoveToFront(server);
}
Now I'm working on the options menu. I can get access to the GameMenu
VPANEL, but SendMessage is defined as: SendMessage(VPANEL vguiPanel,
KeyValues *params, VPANEL ifromPanel).
I'm guessing vguiPanel and ifromPanel are the GameMenu. I'm not sure of the
correct format for the params KeyValues. I tried this without success:
KeyValues *kv = new KeyValues();
kv->SetString("command", "OpenOptionsDialog")
vgui::ipanel()->SendMessage(gameMenu, kv, gameMenu);
Any ideas?
--
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders