KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

RichTextBox: HTML vs Text vs Text that is HTML
Goto page 1, 2  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sun Mar 28, 2004 5:43 pm    Post subject: RichTextBox: HTML vs Text vs Text that is HTML Reply with quote

Before I put out the next build, would like to get some thoughts on something. I am whipping the RichTextBox back into shape. And I want to get the mini-HTML feature going again. RichTextBox will be able to accept text like this:

$RichTextBox.Text = "This is text"

this works just like the old TextBox feature.

$RichTextBox.Text = "<HTML><B>This is bold text</B></HTML>

this will use the "mini-html" parser feature of KF. It basically transforms a tiny subset of HTML into RTF code. If Kixforms "sees" the tag <HTML> at the beginning of string, it will parse the HTML. The question is

What if one wants to put HTML text into the RichTextBox, and not have it translated ... so was thinking things like:

$RichTextBox.Text = "<HTML><HTML>Kixforms</HTML>"

$RichTextBox.Text = "<!><HTML>..."

and a bunch of other ways, basically some kind of flag that escapes the parser ... anybody with better HTML knowledge than I have any ideas ... are there std ways of doing this ? Would HTML comments be better ?

-Shawn
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sun Mar 28, 2004 7:24 pm    Post subject: Reply with quote

Maybe this

$RichTextBox.Text = "<HTML>"+"Whatever..."

means "no matter what follows this tag, parse the HTML" and this:

$RichTextBox.Text = "<!HTML>"+"Whatever..."

means "no matter what follows this tag, dont parse anything". That way, textfiles that already start with <HTML> can be viewed without having to snippoff the front tag. Just thinking out loud.
Back to top
View user's profile Send private message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Sun Mar 28, 2004 8:21 pm    Post subject: Reply with quote

Is there a "standard" way to do this? Since kixforms is modaled after .net, how would .net do it?

As far as you second example, would the html be parsed if I did not put <html> in front of whatever? I assume it would.

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sun Mar 28, 2004 9:16 pm    Post subject: Reply with quote

unfortunately, dotnet doesn't support this feature. I saw it used in java swing my thinks, and thought it was a neat idea. In there, any string that starts with <HTML> gets converted and formatted correctly by the textbox. The whole purpose is to avoid formatting the text via numerous cumbersome method calls and/or RTF coding (which is gawd awful stuff).

So this would just insert text:

$RichTextBox.Text = "hello"

and this would insert text formatted using HTML:

$RichTextBox.Text = "<HTML><b>hello</b>"

but to not parse the HTML and to have the tags included with the text, say this:

$RichTextBox.Text = "<!HTML>..."

Either that or put a space before the <HTML> tag so it doesn't parse ... or manually strip-off the tag yourself - all kinds of ways to specify it ... mostly folk will just be using either Text or formatted HTML, so don't want to make it difficult for these usual cases ... just this one case where you want to have the HTML not parsed (like in an HTML editor window).

-Shawn
Back to top
View user's profile Send private message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Sun Mar 28, 2004 10:16 pm    Post subject: Reply with quote

I have not used this, but if it is like most things, a reason will appear when after you put it in. I like the idea if <!html> to show the actual code. Too make sure I understand, here is an example of bypassing the html parser.

Code:
$RichTextBox.Text = "<!HTML><HTML><b>hello</b></HTML>"


This way you could show all the html source code.

I wonder if you could use this as an HTML stripper?

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sun Mar 28, 2004 10:25 pm    Post subject: Reply with quote

Exactly. Was doing some more research here. Just realized that the string "<!" actually is the beginning of an HTML comment - so not too sure if this <!HTML> thing is a good idea or not. Maybe its an even better idea if it IS a comment because the string could be viewed by a real browser and still work...
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Sun Mar 28, 2004 10:34 pm    Post subject: Reply with quote

I thought that "<!--" was the comment...
Back to top
View user's profile Send private message MSN Messenger
Stevie
KiXforms Supporter
KiXforms Supporter


Joined: 04 Jun 2003
Posts: 109

PostPosted: Mon Mar 29, 2004 1:25 am    Post subject: Reply with quote

Just ran into this a short while back. I believe how it would be handled in dotnet is that anything you do NOT want to be interpreted as HTML code would be HTML-encoded. Then you know that when parsed, any html tags are actual html tags. After rendering it with appropriate html properties, html-decode the actual string data to retrieve its contents.

For example, if I want to display the following as bold:

<b><font size=4>this is a test</font></b>

but only the bold tag should be interpreted, the string becomes the following:

<b>&lt;font size=4&gt;this is a test&lt;/font&gt;</b>

However, including html encode/decode functions seems a little over the top. Instead of working out escape-type codes for all the html, here's a simpler solution.

What if you include a property for the RTBox--'InterpretHTML' as a boolean? Simple, easy and it should cover most people. The only thing it won't cover is someone wanting to display html data as text, while at the same time, wanting to render part of it with interpreted html tags. Shouldn't be a large majority of people. But if it's a need, they can always use standard RTB codes and set InterpretHTML to false.
________
Weed vaporizer


Last edited by Stevie on Fri Feb 18, 2011 8:51 am; edited 1 time in total
Back to top
View user's profile Send private message
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Mon Mar 29, 2004 2:29 am    Post subject: Reply with quote

Why not
Code:

$RichTextBox.Text="<HTML><B>This is HTML-formatted text</b></html>"
$RichTextBox.DisplayHTML=0|1 ; toggle between HTML/non-HTML-view
$RichTextBox.DisplayRaw0|0 ; toggle between raw (binary)/formatted view

_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Rod
KiXforms Webmaster
KiXforms Webmaster


Joined: 22 Feb 2003
Posts: 202
Location: United Kingdom

PostPosted: Mon Mar 29, 2004 5:59 pm    Post subject: Reply with quote

Stevie's approach gets my vote Cunning

Rod.

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Mar 29, 2004 6:20 pm    Post subject: Reply with quote

ja, an InterpretHTML type flag sounds like a good idea. Just out of curiousity, and to stir debate, what would you suppose the default value of this flag would be ? (I have my thoughts on this but won't say until later).
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Mon Mar 29, 2004 6:37 pm    Post subject: Reply with quote

I like Steve's idea as well. I think that the default for InterpretHTML should be to, well, interpret HTML.
Back to top
View user's profile Send private message MSN Messenger
sptomey
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 18 Mar 2003
Posts: 158

PostPosted: Mon Mar 29, 2004 6:41 pm    Post subject: Reply with quote

I would assume the only reason one would use .RichTextBox is because they wanted other than normal text....Therefore I would leave the HTML turned on by default.

Just my opinion.

_________________
-Shane
Back to top
View user's profile Send private message MSN Messenger
Stevie
KiXforms Supporter
KiXforms Supporter


Joined: 04 Jun 2003
Posts: 109

PostPosted: Mon Mar 29, 2004 7:58 pm    Post subject: Reply with quote

Defaulting to on gets my vote too.
________
M119 engine


Last edited by Stevie on Fri Feb 18, 2011 8:51 am; edited 1 time in total
Back to top
View user's profile Send private message
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Mon Mar 29, 2004 10:08 pm    Post subject: Reply with quote

Default should be on.
_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group