Scrolling Text Field


G

Greg Maxey

I am not sure if this is the correct forum or not.

I use FrontPage to manage my personal website and I am one step above a
novice. On several of my pages I post rather lengthy clips of VBA code. I
would like to display this code in some sort of fixed sized text field where
visitors could scroll to read or select and copy the text.

I have found on the Insert menu a Form>Insert Text Area control that almost
suit the bill if I could only figure out how "lock" it so that the content
cannot be altered by visitors. Can this be done or is there a more
appropriate type of control to use for my purpose.

Thank you.






--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

Arrogance is a weed that grows mostly on a dunghill (Arabic proverb)
 
Ad

Advertisements

R

Ronx

Use a text-area - but why bother to lock it?
If the text area is not within a form changing the contents is only going to
affect the user - not your website. Users can change the code after they
paste it into their applications anyway.

When inserting the text area into the page remove the <form ...> and </form>
tags that go with it to disable any chance of submitting the field back to
the website.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 
R

Ronx

The text area can be made read-only:

<textarea name="TextArea1" style="width: 600px; padding: 5px;"
readonly="readonly" rows="10">code goes here</textarea>


--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 
G

Greg Maxey

Ronx,

Thanks. I will give that a try.
Ronx said:
The text area can be made read-only:

<textarea name="TextArea1" style="width: 600px; padding: 5px;"
readonly="readonly" rows="10">code goes here</textarea>


--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 
G

Greg Maxey

Ronx,

I suppose that I can make this work, but it seems combersome to work with.
Is is possible to insert the text area as you have shown but then be able to
paste in text while I am in designe mode? As it is, I am putting in the
text using the code view:
 
R

Ronx

No - A form field area can only be pre-populated in Code view.
You could try a scrollable HTML container instead, for example:

<pre style="height: 300px; border: 1px solid red; width: 600px; overflow:
scroll;">
Code goes here
</pre>
The CSS would be best placed in an external style sheet which can be
accessed by multiple pages.
The border is only for decoration.

I use a similar method on my pages , for example:
http://www.rxs-enterprises.org/fp/articles/2008/01/03/02/Validating_Email_Addresses.aspx
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 
Ad

Advertisements

G

Greg Maxey

Ronx,

One more question. If I elect to go with the scrollable HTML container how
do I modify the border color, weight, style, etc.? I mean where do I go to
learned how and what to type in the code to define this sort of thing?
 
G

Greg Maxey

Ronx,

The scrollable HTML container works fine. I am using:

<pre style="height: 150px; border: 2px solid orange; padding: 5px; width:
875px; overflow:
scroll;>Code goes here</pre>

I don't know that much about HTML so "CSS" and "External Style Sheet" are
terms that I don't fully understand.

Right now when I need a HTML contrainer at a new location in the same or a
different page, I am simply copying and pasting the string of code shown
above.

There is probable some way that I could define one of these containers and
then add it to the menu. I would place my cursor in the a the point I
wanted to insert an empty container and click Insert>HTML container.

Any ideas or suggestions as to how to go about doing that? Thanks.
 
Ad

Advertisements

G

Greg Maxey

Ronx,

There may be a better way, but I scratched together my first FrontPage VBA
procedure which seems to do the trick. I added the macro to the Insert
menu:

Sub InsertHTMLContainer()
Dim objRange As IHTMLTxtRange
Set objRange = ActiveDocument.Selection.createRange
objRange.collapse False
objRange.pasteHTML "<pre style=""height: 150px; border: 2px solid orange;" _
& "padding: 5px; width: 875px;
overflow:scroll;"">&nbsp;</pre>"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top