Page 1 of 1

Rich text - inject html

Posted: Fri Oct 06, 2017 7:39 pm
by mdp
Which gadgets allow for displaying rich text? Preferably not 2DDrawing: selectable text.
In PB, I think of at least the Console (the colors and position) and the ScintillaGadget (everything but making coffee).

As a possible way: can SetGadgetText inject HTML?

Re: Rich text - inject html

Posted: Fri Oct 06, 2017 8:10 pm
by falsam
mdp wrote:As a possible way: can SetGadgetText inject HTML?
You're talking about HTML injection, so I'll assume you know the subject.

Code: Select all

Define Buffer.s
OpenWindow(0, 0, 0, 0, 0, "", #PB_Window_Background)
TextGadget(1, 10, 10, 400, 500, "")

Buffer = "<h1>can SetGadgetText inject HTML?</h1>"
Buffer + "<h1 style='color:blue;'><em>Yes you can<em></h1>"
Buffer + "<br>" 
Buffer + "<p style='border:2px solid powderblue;padding: 30px;'>"
Buffer + "This is a paragraph.</p>"
SetGadgetText(1, Buffer)

Re: Rich text - inject html

Posted: Fri Oct 06, 2017 8:50 pm
by mdp
Excellent, this should be enough to provide the flexibility.

Do you happen to know what the "code area" of the "SB online example showcase" is? I would guess a TextGadget with html content through a "rich" SetGadgetText.

Re: Rich text - inject html

Posted: Fri Oct 06, 2017 8:55 pm
by falsam