General

Reply
Accepted Solution

MessageDialog Font!

I can't change MessageDialog font

can  I only create a Dialog scene?

Please use plain text.

Re: MessageDialog Font!

Hi lydotnet,

 

You cannot change the font applied to a MessageDialog straight out of the box, however an alternative way to change the font from the displayed text is to leave the Title and Message properties empty and use your own Labels on the MessageDialog. You can then apply your own font to the Label. I have pasted an example below.

 

MessageDialog diag = new MessageDialog();
diag.SetSize(400f, 300f);

Font my_font = new Font("/Application/pirulen.ttf", 23, FontStyle.Regular);

Label my_title = new Label();
my_title.Text = "My Title";
my_title.Font = my_font;
my_title.SetPosition(10, 20);
my_title.HorizontalAlignment = HorizontalAlignment.Center;
my_title.SetSize(diag.Width - 10, 30);

Label my_message = new Label();
my_message.Text = "Message text";
my_message.Font = my_font;
my_message.SetPosition(25, 100);
my_message.HorizontalAlignment = HorizontalAlignment.Left;
my_message.SetSize(diag.Width - 25, 30);


diag.AddChildLast(my_message);
diag.AddChildLast(my_title);
diag.Show();

To have just a dialog scene, you can call the SetSize() method of the Dialog and then make it the size of the whole screen, if this is what you are after. You can then listen in to the users response, and then move onto another scene from there. 

 

Thanks

PlayStation®Mobile Dev Team
Please use plain text.

Re: MessageDialog Font!

[ Edited ]

 

thank you for your post

and i find another way to  solve the problem

 

 

 

public class ShowMessage  {

  public ShowMessage ()   {      }  

    public static void Show(MessageDialogStyle style,string title,string message)   {  

      MessageDialog test = new MessageDialog ();   

   test.Message = message;    

test.Style = style;   

 test.Title = title;

   foreach (Sce.Pss.HighLevel.UI.Widget temp in test.Children) {    

      if (temp is Label) {     

 ((Label)temp).Font = new Font ("/Application/font/msyh.ttf", 25, FontStyle.Regular);    

       }    

 if (temp is ScrollPanel) {

     foreach (Sce.Pss.HighLevel.UI.Widget temp2 in ((ScrollPanel)temp).Children) {

      if (temp2 is Label) {    

    ((Label)temp2).Font = new Font ("/Application/font/msyh.ttf", 25, FontStyle.Regular);    

         }   

   }

    }     

         }   

 test.Show();    

      }

    }



Please use plain text.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。