//----------------------------------------------------------------------------- // Purpose: Sets the text of a control by name //----------------------------------------------------------------------------- void CDialogGameInfo::SetControlText(const char *textEntryName, const char *text) { TextEntry *entry = dynamic_cast<TextEntry *>(FindChildByName(textEntryName)); if (entry) { entry->SetText(text); } }
//----------------------------------------------------------------------------- // Purpose: Sets the text of a control by name //----------------------------------------------------------------------------- void CConfigPanel::SetControlText(const char *textEntryName, const char *text) { TextEntry *entry = dynamic_cast<TextEntry *>(FindChildByName(textEntryName)); if (entry) { entry->SetText(text); } }
//----------------------------------------------------------------------------- // Purpose: When the enter key is pressed we clear the textentry. // To add a newline use ctrl-return. //----------------------------------------------------------------------------- void TextEntryDemo5::OnKeyCodeTyped(KeyCode code) { if (code == KEY_ENTER) { m_pTextEntry->SetText(""); } DemoPage::OnKeyCodeTyped(code); }
static int l_set_text(lua_State *l) { TextEntry *te = LuaObject<UI::TextEntry>::CheckFromLua(1); std::string new_text; pi_lua_generic_pull(l, 2, new_text); te->SetText(new_text); lua_pushvalue(l, 1); return 1; }
virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); TextEntry *pTextEntryUserName = dynamic_cast< TextEntry * >( FindChildByName( "UserNameTextEntry" ) ); if ( pTextEntryUserName ) { pTextEntryUserName->SetText( "" ); pTextEntryUserName->InsertString( youtube_username.GetString() ); } }
//----------------------------------------------------------------------------- // Purpose: // Input : *panelName - // *valueName - //----------------------------------------------------------------------------- void CDialogUserInfo::SetChildText(const char *panelName, const char *valueName) { TextEntry *text = dynamic_cast<TextEntry *>(FindChildByName(panelName)); if (text) { char buf[512]; strncpy(buf, GetDoc()->GetBuddy(m_iUserID)->Data()->GetString(valueName, ""), sizeof(buf) - 1); buf[511] = 0; text->SetText(buf); } }
void CSheet_Array::UpdateArrayBlocks( const int &dest_x, const int &dest_y ) { int old_x, old_y; old_x = old_y = 0; char ***oldEntires = BuildStringSheet( old_x, old_y ); for ( int y = 0; y < old_y; y++ ) { //for ( int x = 0; x < old_x; x++ ) m_hArray_Y_Major[y]->Purge(); delete m_hArray_Y_Major[y]; } m_hArray_Y_Major.Purge(); int iCurItem = m_pArrayPanel->FirstItem(); while ( iCurItem != m_pArrayPanel->InvalidItemID() ) { Panel *pA = m_pArrayPanel->GetItemLabel( iCurItem ); Panel *pB = m_pArrayPanel->GetItemPanel( iCurItem ); if ( pA != NULL ) pA->MarkForDeletion(); if ( pB != NULL ) pB->MarkForDeletion(); iCurItem = m_pArrayPanel->NextItem( iCurItem ); } m_pArrayPanel->DeleteAllItems(); m_pArrayPanel->RemoveAll(); for ( int y = 0; y < dest_y; y++ ) { CUtlVector< TextEntry* > *cur = new CUtlVector< TextEntry* >; m_hArray_Y_Major.AddToTail( cur ); } m_pArrayPanel->SetNumColumns( dest_y ); for ( int x = 0; x < dest_x; x++ ) { for ( int y = 0; y < dest_y; y++ ) { CUtlVector< TextEntry* > *cur = m_hArray_Y_Major[y]; TextEntry *pEntry = new TextEntry( m_pArrayPanel, "arrayslot" ); pEntry->AddActionSignalTarget( this ); cur->AddToTail( pEntry ); if ( x < old_x && y < old_y && oldEntires != NULL ) { pEntry->SetText( oldEntires[x][y] ); } else pEntry->SetText( "0" ); Label *pHeader = NULL; if ( y == 0 ) pHeader = new Label( m_pArrayPanel, "", VarArgs( "%i:", x ) ); m_pArrayPanel->AddItem( pHeader, pEntry ); pEntry->MakeReadyForUse(); pEntry->InvalidateLayout( true, true ); pEntry->SetBgColor( TOKENCHANNELS_SUPPORTED_COLOR ); } } m_pArrayPanel->SetFirstColumnWidth( 20 ); if ( oldEntires != NULL ) DestroyStringSheet( oldEntires, old_x, old_y ); }
//----------------------------------------------------------------------------- // Sets up the shader param editbox //----------------------------------------------------------------------------- void CMaterialEditorPanel::PopulateShaderParameters() { Assert( m_nShaderIndex >= 0 ); m_pEditorPanel->RemoveAll(); int nCount = g_pMaterialSystem->GetNumShaderParams(m_nShaderIndex); for (int i = 0; i < nCount; ++i) { const char *pParamName = g_pMaterialSystem->GetShaderParamName(m_nShaderIndex, i); char tempBuf[512]; Q_strncpy( tempBuf, pParamName, 512 ); Q_strnlwr( tempBuf, 512 ); // build a control & label (strip off '$' prefix) Label *pLabel = new Label( this, NULL, tempBuf + 1 ); pLabel->SetSize(128, 24); // Set up the tooltip for this puppy... pLabel->SetTooltipText( g_pMaterialSystem->GetShaderParamHelp(m_nShaderIndex, i) ); // Get at the material var bool bFound; IMaterialVar *pMaterialVar = m_pMaterial->FindVar( pParamName, &bFound ); Assert( bFound ); Panel *pEditPanel; switch( g_pMaterialSystem->GetShaderParamType(m_nShaderIndex, i) ) { case SHADER_PARAM_TYPE_TEXTURE: pEditPanel = new Label( this, NULL, "texture" ); break; case SHADER_PARAM_TYPE_INTEGER: { TextEntry *pTextEntry = new TextEntry(this, "Shader Param Integer"); Q_snprintf( tempBuf, 512, "%d", pMaterialVar->GetIntValue() ); pTextEntry->SetText( tempBuf ); pTextEntry->SetEditable( true ); pEditPanel = pTextEntry; } break; case SHADER_PARAM_TYPE_COLOR: pEditPanel = new Label( this, NULL, "color" ); break; case SHADER_PARAM_TYPE_VEC2: pEditPanel = new Label( this, NULL, "vec2" ); break; case SHADER_PARAM_TYPE_VEC3: pEditPanel = new Label( this, NULL, "vec3" ); break; case SHADER_PARAM_TYPE_FLOAT: { TextEntry *pTextEntry = new TextEntry(this, "Shader Param Float"); Q_snprintf( tempBuf, 512, "%f", pMaterialVar->GetIntValue() ); pTextEntry->SetText( tempBuf ); pTextEntry->SetEditable( true ); pEditPanel = pTextEntry; } break; default: pEditPanel = new Label( this, NULL, "other" ); break; } pEditPanel->SetSize(128, 24); // pEditPanel->SetContentAlignment( Label::a_east ); m_pEditorPanel->AddItem( pLabel, pEditPanel ); } }