Talk:VGUI Documentation

From Valve Developer Community
Revision as of 09:48, 10 January 2014 by Davecb 42 (talk | contribs) (Event Messaging Caveat)
Jump to: navigation, search

What is the shortcut or console command to reload the menu resource files while in-game?


--tantoedge 04:03, 30 Jun 2005 (PDT)

Anyone know how to remove textures when they've been finished with? I know normally you would want to keep any textures loaded to cut load time between maps, but I found an unusual case. After working on the OVERVIEW_PANEL for some time, I've managed to get it to load different player icons depending on the team they've joined. Unfortunately it only does this when the server is first started, and keeps the textures loaded through each map change. The down side is that if a player changed teams between map changes he'll end up displaying the wrong icon on the next round, as his previous texture is still loaded. Ideally I'd like it to flush the icons, sos each time the panel is invoked, it reloads the correct ones. (Fallen)


In my programming, I found that you must set DrawSetColor before calling DrawTexturedRect, or you don't get anything on the screen if the texture has any transparency. I've added a line in the example to reflect this. Please remove it if I am wrong.


This is correct...this is the fallout of previous calls to DrawSetColor—ts2do 18:20, 6 Oct 2006 (PDT)

For those who want to know, the localization file is preferred to be encoded UTF-16 (Unicode).

ImaTard 17:59, 19 Nov 2006 (PST)

Code Typo

Under the Event Messaging section, the code sample describing how to catch new lines in a text entry seems to have a typo. The MESSAGE_FUNC_PARAMS macro defines the callback to be OnMyMessage() but the handler is called NewLineMessage(). Correct? Reacher 09:07, 4 Jan 2007 (PST)

Event Handlers

Just a suggestion that came to mind when working with event handlers such as

void C_NewGameMenu::OnKeyCodePressed( KeyCode code )
   if ( doSomethingKey == code )
      BaseClass::OnKeyCodePressed( code );

I think it would be more robust & cleaner to instead return a bool indicating whether the event was handled instead calling the BaseClass's respective event handler at the end of your switch/if clause. It would be more robust because one couldn't forget to add the BaseClass call at the end.

Event Messaging Caveat

I made the mistake of reusing or deleteThis()-ing a KeyValues* I'd new'd, expecting to avoid a leak. Instead I got a series of crashes at random locations in the KeyValues code. Issue #1625 on, now closed.

The idiom appears to be PostActionSignal(new KeyValues( some args )); and let someone else dispose it.