on 21-05-2012 04:58 AM
I can't change MessageDialog font
can I only create a Dialog scene?
Solved! Go to Solution.
on 21-05-2012 04:55 PM
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
22-05-2012 04:39 AM - edited 22-05-2012 04:44 AM
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();
}
}
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を一度ログアウトし、再度ログインしてください。


Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]
%%http://community.eu.playstation.com/t5/Announcements/Beta-Trial-Information/td-p/11386362
best_shooter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_driver.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_performer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_footballer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_fighter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_creator.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_action_player.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
dev2.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Producer-and-Developer-Ranks/td-p/18407352
trophy.gif%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/The-Community-Awards-FAQ/td-p/18407096
PSlogoSM.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Online-Support-Coordinator-rank/td-p/18414870