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):
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.
|











