Group Abstract Group Abstract

Message Boards Message Boards

2
|
4.7K Views
|
5 Replies
|
8 Total Likes
View groups...
Share
Share this post:

Highlighting selected text in MessageDialog

POSTED BY: andy ilachinski
5 Replies
POSTED BY: Vitaliy Kaurov

Nasser, that did it! Thank you very much for the quick answers and follow-up. Much appreciated :-)

POSTED BY: andy ilachinski

But, since message is now a Row[...], the concatenation can't go through since it's no longer a string

You can try Join, like this, to see if it works for you

nextMessage = Style["the oven is getting hot!", Red];
message = Row[{"Would like to say that ", importantMsg, " and needs cooling"}];
MessageDialog[message];

and now

nextMessage = {"..please hurry"};
message = Row[Join[First@message, nextMessage]];
MessageDialog[message];

and now

nextMessage = {Style["..I am still waiting..", Red]};
message = Row[Join[First@message, nextMessage]];
MessageDialog[message];

enter image description here

POSTED BY: Nasser M. Abbasi

Nasser, thanks for the quick reply!

That's already a help, but with still this lingering issue...as the main program keeps running, it keeps track of a cumulative message string (continually updated): i.e., if the current message (to be printed via MessageDialog) is your message = Row[{"Would like to say that ", importantMsg, " and needs cooling"}];, I still need - at some later point - to have something like message <> "here is another string (possibly with its own highlighting)" to be available to MessageDialog. But, since message is now a Row[...], the concatenation can't go through since it's no longer a string.

Hope that makes sense, and my problem is clear. Essentially I need what your great suggestion does for this one message, but I need to be able to keep concatenating strings to this (some of which may have highlights, some not).

POSTED BY: andy ilachinski

May be you can use Styled strings? Need to use Row to build styled strings. Something like

enter image description here

importantMsg = Style["the oven is getting hot!", Red];
message = Row[{"Would like to say that ", importantMsg, " and needs cooling"}];
MessageDialog[message]
POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard