Whether a text fits in a text control

Hello,

I have several text controls in windows and dw.
Is there anyway to know if the text itself fits in the length of the text
control
(that is, if I will see the text completely) ?

Thanks in advance

Lena (PB 9.0)


0
lena
1/15/2004 10:23:56 AM
sybase.powerscript 7704 articles. 0 followers. Follow

5 Replies
545 Views

Similar Articles

[PageSpeed] 10

Take a look at this techdoc that I authored:

http://www.sybase.com/detail?id=1024200

it's an example of using the GetTextExtent API to determine whether
text does or does not fit.  I am not certain about using it in the
datawindow though.


On 15 Jan 2004 02:23:56 -0800, "lena" <egarcia@cimkey.es> wrote:

>Hello,
>
>I have several text controls in windows and dw.
>Is there anyway to know if the text itself fits in the length of the text
>control
>(that is, if I will see the text completely) ?
>
>Thanks in advance
>
>Lena (PB 9.0)
>
>

Jim O'Neil
Principal Technical Support Engineer
Sybase, Inc.
Concord, MA
0
joneil
1/15/2004 3:11:07 PM
> Take a look at this techdoc that I authored:
>
> http://www.sybase.com/detail?id=1024200
>
> it's an example of using the GetTextExtent API to
> determine whether text does or does not fit.  I am not
> certain about using it in the datawindow though.

For usage with datawindow objects take a look at PFC or even
better, at this (has an object which allows grid datawindows
to autosize the width of a column to match it's contents
using the same API):
http://www.topwizprogramming.com/freecode/griddemo.zip
0
Philip
1/15/2004 4:32:35 PM
> Take a look at this techdoc that I authored:
>
> http://www.sybase.com/detail?id=1024200
>
> it's an example of using the GetTextExtent API to
> determine whether text does or does not fit.

BTW, Jim maybe it's time to revise this article to use
FUNCTION long PathCompactPathA (long lhDC, ref string
as_Text, long al_Len) LIBRARY "shlwapi.dll"

This loop
// keep truncating letters (and add ellipsis) until string
fits
DO WHILE lb_APIok AND (lstr_size.cx > lstr_clientArea.right)
AND (li_charCount > 1)
			li_charCount = li_charCount - 1
			ll_textForDisplay = Left(ll_textForDisplay, li_charCount)
+ "..."
			lb_APIok = GetTextExtentPoint32(ll_DCHandle,
ll_textForDisplay, li_charCount + 3, lstr_size)
LOOP

seems rather wastefull :-)
0
Philip
1/15/2004 4:39:38 PM
There was a reason I didn't use that but for the life of me I can't
remember why....  I'll try to revisit in my free (ha!) time.

On 15 Jan 2004 08:39:38 -0800, Philip Salgannik wrote:

>> Take a look at this techdoc that I authored:
>>
>> http://www.sybase.com/detail?id=1024200
>>
>> it's an example of using the GetTextExtent API to
>> determine whether text does or does not fit.
>
>BTW, Jim maybe it's time to revise this article to use
>FUNCTION long PathCompactPathA (long lhDC, ref string
>as_Text, long al_Len) LIBRARY "shlwapi.dll"
>
>This loop
>// keep truncating letters (and add ellipsis) until string
>fits
>DO WHILE lb_APIok AND (lstr_size.cx > lstr_clientArea.right)
>AND (li_charCount > 1)
>			li_charCount = li_charCount - 1
>			ll_textForDisplay = Left(ll_textForDisplay, li_charCount)
>+ "..."
>			lb_APIok = GetTextExtentPoint32(ll_DCHandle,
>ll_textForDisplay, li_charCount + 3, lstr_size)
>LOOP
>
>seems rather wastefull :-)

Jim O'Neil
Principal Technical Support Engineer
Sybase, Inc.
Concord, MA
0
joneil
1/16/2004 4:45:15 AM
Jim, where is that downloadable demo located? Can't seem to find it on the
SDN or CodeExchange.

Larry

"Jim O'Neil [Sybase]" <joneil@sybase.com> wrote in message
news:4006a9be.4882781@forums.sybase.com...
> Take a look at this techdoc that I authored:
>
> http://www.sybase.com/detail?id=1024200
>
> it's an example of using the GetTextExtent API to determine whether
> text does or does not fit.  I am not certain about using it in the
> datawindow though.
>
>
> On 15 Jan 2004 02:23:56 -0800, "lena" <egarcia@cimkey.es> wrote:
>
> >Hello,
> >
> >I have several text controls in windows and dw.
> >Is there anyway to know if the text itself fits in the length of the text
> >control
> >(that is, if I will see the text completely) ?
> >
> >Thanks in advance
> >
> >Lena (PB 9.0)
> >
> >
>
> Jim O'Neil
> Principal Technical Support Engineer
> Sybase, Inc.
> Concord, MA


0
Larry
1/16/2004 9:31:14 PM
Reply:

Similar Artilces:

Text as text
Name: JohnA Boice Email: jaboiceathughesdotnet Product: Firefox Summary: Text as text Comments: You need to do as Safari does and make ALL text, including buttons, links, bookmarks, and general page text actual text so screen readers can interpret and voice the text. Until this occurs, your products are a real pain to use. And I have limited sight. What about those with less or no sight? Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 ...

chinese character in rich text control and text control
I have a chinese character in either rich text control or text control. The character is look fine if it is a small size (10, 12), however when the font size is changed bigger (36 or 72), the character is out of shape(many dot, not smooth). Is anyone has any idea to print a bigger chinese character from pb7.03. ...

Pasting text from Mac apps into rich text controls pastes plain text
Name: Bob Product: Firefox Summary: Pasting text from Mac apps into rich text controls pastes plain text Comments: Using: Mac OS X 10.6 and Firefox 3.5 and 3.6 beta 1 Steps to reproduce: * Write text in Text Edit, Yojimbo, etc using rich text (e.g. font sizes, bold, italics) * Open Gmail in Firefox and compose an email * Copy and paste the text you created from the other Mac app into Firefox Observed: text is pasted in as plain text Expected: converts the rich text to appropriate rich text in the control, like Safari does This is a huge pain when e.g. writing release n...

How to populate other text controls by losing focus of one text control
 Hi All,Iam new to ASP.net. Here is a small illustration about my prob. I have 3 text controls in a page i.e which represents zip,city,state. I want to populate city and state after entering zipcode into zip text control i.e something like focus lost event on zip text control. Any solution regarding this thanks and regards,vijaycanaan How about OnTextChange: http://msdn.microsoft.com/en-us/library/aa710190(VS.71).aspx EricPascarello.com | Twitter epascarello | LinkedIn Hi vijaycanaan We can capture the following event when TextBox  lost focus: On Server-Side:We...

Fix broken text wrapping and control input text length in TextBox control
Hi! I'm developing a(nother; it's my second!) ASP.NET application that right now is giving me fits. On one of my screens, the user needs to be able to enter large amounts of text into three database fields. The database fields are all char(350). I'm having two problems with this. First of all, I found that when editing an existing record, text in the fields would wrap in a manner similar to this: Wow, what a sorryperformance! The text box is much wider than the text "Wow, what a sorry", so I couldn't figure out why the text was wrapping. I tried setting the Columns property to 90 (which...

Changing the text of an input (text) control
Hi everyone, please answer the following: I have a html input control as follows  <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords %>" name="newSearch_keywords""/>    When the page loads I need to look at the text of this input field and remove any * chars that are in the text. Thanks for your help <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords.Re...

text cut off in static text control
I have a window that needs to display a path in an uneditable field. THe problem is that if the text is longer than the the field it makes the last word disapear so c:\Program is display instead of C:\Program Files\etc... Is there a way to stop the static text from doing this or to make a single line edit unselectable (so the text can't be highlighted)? You have several choices. If the UI element where this static text is displayed is fixed in size, then you are probably better off implementing a tooltip - see http://www.migmag.pair.com/pb/files/tooltip.zip On the other h...

changing text in static text control
Hello PB 11 build 8123 I have a window with a dwcontrol. When I am updating the dw control I want one of the column names (static text controls) to change based on a value I select in another column. So far I have the code in the itemchanged to capture the value of my selection in the field I first select. How do I take this value, (it can only be Y or N) and program one of the column headings (static text) to display a certain text? I can't seem to get it to work with setitem or settext. Those two funcs don't really work with column headings as far as I can see. A...

MS Publisher / Word-like textframe web control... flowing text between text controls
Does anyone know of an ASP.Net web control capable of linking text boxes/frames together similarly to the Publisher & Word textframe objects (via the NextLinkedTextFrame property in Publisher or the TextFrame.Next property in Word)? The goal is to have text flow from one textbox into another. Thx.....

How to programmatically add user control to the middle of text inside Literal text control ? Pls help...
Greetings fellow programmers,I greatly appreciate all the help I can get. Here is the problem.I have a function that pulls content from the database and put the content into a literal control. Somewhere in that content, I need to insert a user control (bla.ascx). Ideally, I want to use string.replace to find the location where I want to insert the user control. But I can't... there is no such option on the literal control methods and properties.Do I have to overwrite render method? I'd normally use loadcontrol and add it to the placeholder control, but in this case, I can't dynamically ...

Bold Text For Selected text in Text Box
Hi EveryoneI have a small thing to do [at this time , very big for me]. I want to make some text string as bold which appears in a text box control for the web. It means some of the portion of the string will be bold and some will be in the normal font style. Can anyone suggest any idea to accomplish this task. [I know that we can set the font weight property for the whole text box and all the text appears in the selected font-weight]Any suggestions.BaberBaber SaeedSoftware EngineerPalmChip, Pakistan Toll Free: 0800-000-13 Ext:494Cell: 0300-6438634 Standard TextBox that comes with ASP.NET ...

Text not appearing when typing the text into text field
Name: Maadhavan Email: madhavan_t_patyahoodotcom Product: Firefox Summary: Text not appearing when typing the text into text field Comments: Text not appearing when typing the text into text field or any other field Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.9 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Rich Text DataWindow In Rich Text Control
Hi, is there a way to take the contents of a rich text data window and put it into a rich text edit control? Thanks, Cliff ...

Validation Control
I've been building a web form-to-email type application over the past couple of days and am currently tweaking the validation controls. I've done all the RequiredFieldValidators and added a regular expression to the email field to check for the @ but how do I write an expression for something like a "Name" field where it finds any number values entered as invalid? Pete try this: ^[a-zA-Z]$ also, have a look at : RegExLib regards.Bilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP Thanks for the link...I saw that earlier. For some reason the regular expres...

Web resources about - Whether a text fits in a text control - sybase.powerscript

Trump Makes Sexually Derogatory Remark About Hillary Clinton
In one of his most vicious attacks yet against former Secretary of State Hillary Clinton, Donald Trump used a sexually derogatory remark in reference ...

Kim Kardashian’s Butt Gets Its Own Emoji
When Kim Kardashian launched her new emoji app Monday, the reality star’s band of devoted, emoji-fluent fans responded accordingly — by overpopulating ...

The Known and Unknown Unknowns in the Republican Race Ahead
Some observations on the 2016 presidential race as we head into the dark period, i.e., the two weeks of Christmas and New Year's holidays in ...

NYPD Detective Among 6 U.S. Troops Killed in Afghanistan Suicide Bombing
One of the six American troops killed in a suicide attack in Afghanistan on Monday was Joseph Lemm, a New York City police detective, the Associated ...

SpaceX launches rocket 6 months after accident, then lands
It was the first time an unmanned rocket returned to land vertically at Cape Canaveral, Florida, and represented a tremendous success for SpaceX. ...

Big data's billion-dollar quality problem: 3 tips for sidestepping it
The costs of working with dirty data are staggering. Save money and time by following these tips on how to improve the quality of your company ...

Blatter, Platini affair marks 'new low point' in football
Leading figures in football hit out at the disgraced Sepp Blatter and Michel Platini after they were handed eight-year bans from the sport. FIFA ...

Oregon woman held in Las Vegas Strip sidewalk rampage drove with license suspended
Reuters Oregon woman held in Las Vegas Strip sidewalk rampage drove with license suspended Reuters LAS VEGAS An Oregon woman who killed one ...

FDA lifts lifetime ban on gay men donating blood
CNN FDA lifts lifetime ban on gay men donating blood CNN (CNN) The Food and Drug Administration has lifted its lifetime ban on accepting blood ...

Martin Shkreli fired from another pharma company after arrest
Martin Shkreli's bad month continues. After being arrested last week on charges of securities fraud, the infamous Shkreli — who came to public ...

Resources last updated: 12/22/2015 6:37:12 AM