| 689 | } |
| 690 | |
| 691 | wxTextCtrl * ShuttleGuiBase::AddTextBox( |
| 692 | const TranslatableString &Caption, const wxString &Value, const int nChars) |
| 693 | { |
| 694 | const auto translated = Caption.Translation(); |
| 695 | HandleOptionality( Caption ); |
| 696 | AddPrompt( Caption ); |
| 697 | UseUpId(); |
| 698 | if( mShuttleMode != eIsCreating ) |
| 699 | return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl); |
| 700 | wxTextCtrl * pTextCtrl; |
| 701 | wxSize Size(wxDefaultSize); |
| 702 | if( nChars > 0 ) |
| 703 | { |
| 704 | int width; |
| 705 | mpDlg->GetTextExtent( wxT("9"), &width, nullptr ); |
| 706 | Size.SetWidth( nChars * width ); |
| 707 | } |
| 708 | miProp=0; |
| 709 | |
| 710 | #ifdef EXPERIMENTAL_RIGHT_ALIGNED_TEXTBOXES |
| 711 | long flags = wxTE_RIGHT; |
| 712 | #else |
| 713 | long flags = wxTE_LEFT; |
| 714 | #endif |
| 715 | |
| 716 | mpWind = pTextCtrl = safenew wxTextCtrlWrapper(GetParent(), miId, Value, |
| 717 | wxDefaultPosition, Size, GetStyle( flags )); |
| 718 | #if wxUSE_ACCESSIBILITY |
| 719 | // so that name can be set on a standard control |
| 720 | mpWind->SetAccessible(safenew WindowAccessible(mpWind)); |
| 721 | #endif |
| 722 | mpWind->SetName(wxStripMenuCodes(translated)); |
| 723 | UpdateSizers(); |
| 724 | return pTextCtrl; |
| 725 | } |
| 726 | |
| 727 | wxTextCtrl * ShuttleGuiBase::AddNumericTextBox( |
| 728 | const TranslatableString& Caption, const wxString& Value, const int nChars, |
no test coverage detected