473,789 Members | 3,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

textarea automatic resize and proportional fonts

Hi,

I have been experimenting with some textarea automatic resize scripts.
Most that I have found count the number of characters in the textarea
and divide by the number of columns. This works will with monospaced
fonts or with just wide letters like 'M'. However if I fill the text
area with proportional font 'i' characters then a lot of white space
builds up at the end of the text area. Is there a way to account for
proportional fonts to avoid this whitespace?

Thanks,
Peter

Jul 12 '06 #1
1 3710
Ivo
<pe**********@g mail.comschreef
I have been experimenting with some textarea automatic resize scripts.
Most that I have found count the number of characters in the textarea
and divide by the number of columns. This works will with monospaced
fonts or with just wide letters like 'M'. However if I fill the text
area with proportional font 'i' characters then a lot of white space
builds up at the end of the text area. Is there a way to account for
proportional fonts to avoid this whitespace?
Sounds not very userfriendly to me. You could try creating a selection of
the text in the area, read the boundingwidth, -height, -left and -top of the
selection range object thing, that would give you the exact dimension of the
textblock, at least in some browsers, but I 'd rather you leave my textarea
alone, frankly. Or provide a means for me to drag it to the size I like.
Like some other scripts out there demonstrate.
hth
ivo
Jul 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5090
by: Mark Roseman | last post by:
The following script is intended to grow the textarea when the user first gives it focus. This seems to work on most browsers, but does nothing on Safari on the Mac (the rows and columns are updated internally, but the textarea does not expand onscreen). Any ideas why it doesn't work, or if there are any workarounds? Thanks
2
15487
by: bdwise | last post by:
Can anyone recommend a way to dynamically resize a textarea? I already have it inside a <div> for positioning on a page, but I would like to have the textarea always fill the div so I can resize according to the div as well. Or any other option. Thanks.
4
23731
by: Chris Sharman | last post by:
I haven't specified fonts, leaving the user to have their chosen font. However, different tags render in different default fonts: text, input, & textarea all different from one another. I guess this is normal behaviour, but it looks poor, and I don't want our website to look that way (to out of the box browsers). How would I set textarea's 'like' input, or how would I determine (Javascript?) what's being used by an input field, to set...
258
8756
by: Terry Andersen | last post by:
If I have: struct one_{ unsigned int one_1; unsigned short one_2; unsigned short one_3; }; struct two_{ unsigned int two_1;
0
1035
by: Tina | last post by:
I need to do some left alignment in code and I need to use a fixed space (nonproportional) font. I know that Courier is such a font, but what other fonts are also non proportional. How can I tell which ones are so? Thanks, Tina
1
3487
by: Stan SR | last post by:
Hi, I have some tiff images that I need to use for pdf files. I need to resize them, but I get a very bad quality. I would like to know what is the trick to keep the high quality ? Here's my current code private System.Drawing.Image Resize(System.Drawing.Image myPic) {
1
2794
by: Nick | last post by:
Hi, I have created a html page from Java and I have added a .js file which can resize a TextArea inside the html on mousedown event. <script src="C:\temp\resize.js"</script> <table<tr><td onmousedown="javascript:resize('trinput',event)"> <TEXTAREA NAME="input" id="trinput" COLS=40 ROWS=60> my textarea here </TEXTAREA>
3
7526
by: Justin | last post by:
What is the difference between automatic and DMS Auto-resize tablespace?
10
44087
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their screen. I used to write code in Java a few years ago (2005), and you could stretch a form with the mouse and all the controls and fonts would resize to larger or smaller size. Does .Net framework 3.5 support this kind of functionality? Or -...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.