General XMetaL Discussion
pooh2583 November 23, 2012 at 3:20 am
Xmetal to check numeric value and alphanumeric valueNovember 23, 2012 at 3:20 amParticipants 3Replies 4Last Activity 9 years, 10 months ago
I am using xft form in which I have to validate whether the string entered in a textbox is a number or not?
I have managed to capture the string I just want to check whether that is a no.(/d) or not using Xmetal Jscript.
and also how to check whether it is an alphanumeric i.e [a-z][A-Z]
Also after capturing the string I want to split it into two parts having different lengths each,
How to get the 2 substring in Xmetal?
could you please explain more about this?
RegardsDerek Read November 23, 2012 at 6:52 pm
Reply to: Xmetal to check numeric value and alphanumeric valueNovember 23, 2012 at 6:52 pm
This isn't really an XMetaL or XFT question, it is more a JScript question (for which there are lots of different answers and resources). There is no “XMetaL JScript”. XMetaL uses the standard JScript engine installed with your copy of Windows, so you can use any of the resources that talk about using JScript on Windows (including Microsoft's documentation), the same engine used by Internet Explorer.
To start, JScript has a function called isNaN() that you can use to check for “non numbers”, however, it is quite simplistic and possibly won't meet your needs. Its main use is to check if something is a number before feeding it into some JScript math expression so that the expression won't fail. However, JScript can convert some things into numbers that you might not expect.
Your best bet is a regular expression. You might start here:Derek Read November 23, 2012 at 9:11 pm
Reply to: Xmetal to check numeric value and alphanumeric valueNovember 23, 2012 at 9:11 pm
Sorry, I missed the part about substrings. JScript has lots of different string manipulation methods. Here are some you might use by themselves or in combination, depending on what you need to do:
The length property might also be useful in some cases.pooh2583 November 27, 2012 at 10:44 am
Reply to: Xmetal to check numeric value and alphanumeric valueNovember 27, 2012 at 10:44 am
Thanks for a reply.
In .xft form I have made use of a Text, which displays text like this
and I want to display st2 as bold in xft form in that Text1,
I have used an EditBox when we enter any character in it ,it is diplayed in the Text.Text on OnChange() event of EditBox
Is there any way to Expand the display size of Text as we enter the characters, and when the length of the string entered in the EditBox cant be entirely seen in Text which displays it.
How can I achieve this?
RegardsDerek Read November 28, 2012 at 6:25 am
Reply to: Xmetal to check numeric value and alphanumeric valueNovember 28, 2012 at 6:25 am
I'm not sure I completely understand your bold text requirement but the EditBox doesn't allow you to control how portions of the text inside it appear. For that you will need to use another control. Have a look at Microsoft RichEdit control. You can turn bold/italic/underline and also use colours inside it for different portions as it supports “rich text” (essentially the RTF format).
You should be able to change the size of the EditBox on the fly. How big to make it will be tricky to figure out though, unless you use a fixed-width font. You should be able change the top,bottom,left,right properties to do that. THat seems like it would make for an odd UI though. Perhaps what you should look at in this case is the MultiEditBox control. It supports multiple lines, line wrapping and has a scrollbar.
- You must be logged in to reply to this topic.