Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Ask The Experts

Article

Issue: 2.1 (August/September 2003)
Author: Seth Willits with Thomas Reed
Article Description: No description available.
Article Length (in bytes): 3,577
Starting Page Number: 32
RBD Number: 2115
Resource File(s):

Download Icon 2115.sit Updated: Friday, October 17, 2003 at 12:21 PM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

Q: How can I set the alignment of an Editfield? I can't to work if I select the text and use .SelAlignment, or even if I simply use the Alignment property in the properties window. How do I do it?

An Editfield must be of the multiline variety in order to support text alignment. An annoying limitation, yes, but if you want a single line editfield, it's really easy to work around.

In the KeyDown event of the field (you should probably make an EditField subclass so you can reuse it in many different projects without having to recreate this for every field in every project) place the following code:

Function KeyDown(key as string)

if key = chr(13) or key = chr(3) then

return

end if

End Function

If you were to put both single-line and multiline fields in a window and tab between them, you'd notice that they handle accepting the focus differently. In a single-line field the text of the field is selected when it gets the focus from the keyboard. If you really want this behavior (as it should be expected by your users), you can work around it by using these three lines of code:

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com