git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40738
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
menuFont->AppendSeparator();
menuFont->Append(Font_CheckNativeToFromString,
menuFont->AppendSeparator();
menuFont->Append(Font_CheckNativeToFromString,
- wxT("Check Native Font Info To/From String"));
+ wxT("Set native font &description\tShift-Ctrl-D"));
menuFont->Append(Font_CheckNativeToFromUserString,
menuFont->Append(Font_CheckNativeToFromUserString,
- wxT("Check Native Font Info User String"));
+ wxT("Set &user font description\tShift-Ctrl-U"));
menuFont->Append(Font_CheckFaceName,
wxT("Check font face name"));
menuFont->Append(Font_CheckFaceName,
wxT("Check font face name"));
void MyFrame::OnCheckNativeToFromString(wxCommandEvent& WXUNUSED(event))
{
void MyFrame::OnCheckNativeToFromString(wxCommandEvent& WXUNUSED(event))
{
- wxString fontInfo = m_canvas->GetTextFont().GetNativeFontInfoDesc();
-
+ wxString fontInfo = wxGetTextFromUser
+ (
+ wxT("Enter native font string"),
+ wxT("Input font description"),
+ m_canvas->GetTextFont().GetNativeFontInfoDesc(),
+ this
+ );
+ return; // user clicked "Cancel" - do nothing
+
+ wxFont font;
+ font.SetNativeFontInfo(fontInfo);
+ if ( !font.Ok() )
- wxLogError(wxT("Native font info string is empty!"));
+ wxLogError(wxT("Font info string \"%s\" is invalid."),
+ fontInfo.c_str());
+ return;
- else
- {
- wxFont *font = wxFont::New(fontInfo);
- if ( fontInfo != font->GetNativeFontInfoDesc() )
- wxLogError(wxT("wxNativeFontInfo ToString()/FromString() broken!"));
- else
- wxLogMessage(wxT("wxNativeFontInfo works: %s"), fontInfo.c_str());
}
void MyFrame::OnCheckFaceName(wxCommandEvent& WXUNUSED(event))
}
void MyFrame::OnCheckFaceName(wxCommandEvent& WXUNUSED(event))