Replacing parts of text with images?

TAFKAM

New Member
Licensed User
Longtime User
What would be my best option to achieve the following:

  1. I have objects that have properties
  2. Each property is described by a text-strings that can contain {placeholders}
  3. I need to be able to show the text itself formatted (e.g. bold or italic or bold-italic or maybe even in color)
  4. The {placeholders} should be replaced by either images and/or hyperlinks
  5. Since each object has multiple properties, these properties must be shown in a list-like fashion

Let's try to make my problem a little bit more clear with a fictitious example, using some Smilies from this Forum:
  • original text: "{signOops} I really have {B}{COLOR="Red"}NO{/COLOR}{/B} clue how to do {B}this{/B}, since I'm a {sign0104} at B4A, {sign0013}. Can {U}anyone{/U} on {URL="http://www.b4x.com/forum/"}http://www.b4x.com/forum/{/URL} help me out, please {sign0163}"

  • Should be converted to: :signOops: I really have NO clue how to do this, since I'm a :sign0104: at B4A, :sign0013:. Can anyone on http://www.b4x.com/forum/ help me out, please :sign0163:

So basically I'm looking for a View or (a way of composing) a set of Views that allow to show text, images and hyperlinks in the same line. I have spent a few hours checking the documentation as well as the forum, but I could not find a similar request/example (please point me elsewhere if you know any such).
 

joseluis

Active Member
Licensed User
Longtime User
Two Ideas:

1) Use an embedded WebView & 2 and do all that in html, or build a custom parser that translate your code to html. This is probably easier.

2) Do not use webview. Build a custom parser that draws images on canvas, and uses the richstring library for drawing the text. This would need a lot of work. And also build a system to manage the links.
 
Last edited:
Upvote 0

TAFKAM

New Member
Licensed User
Longtime User
Two Ideas:

1) Use an embedded WebView & 2 and do all that in html, or build a custom parser that translate your code to html. This is probably easier.

2) Do not use webview. Build a custom parser that draws images on canvas, and uses the richstring library for drawing the text. This would need a lot of work. And also build a system to manage the links.


Thanks joseluis, your suggestions confirm the options I came up with after going through the docs and forums. I think I'll go and try implement the first option you suggest.

Any other suggestions are welcome of course.
 
Upvote 0
Top