Is it possible to convert a simple radtextbox to radnumeric-textbox - textbox

Is it possible to convert a simple radtextbox to radnumeric-textbox from codebehind or javascript? I have a dropdown list where i can decide whether the text box should allow only numbers or any character.

You can utilize RadMasked Textbox for that purpose.
Simply take RadMaskedTextbox and manipulate the mask according to your requirement in code behind or in javascript.

Related

Issue with masked textbox for website address using kendo ui

I am using kendo ui to for the masked textbox. I am done with phone number and fax number. but i want to put "http://_________________" for website textbox which should be variable length string. How can i achieve that?
I used following way to achieve phone number.
#(Html.Kendo().MaskedTextBox()
.Name("phone_number")
.Mask("(999) 000-0000")
.Value("555 123 4567")
)
For the time being, the MaskedTextBox widget works only with strict mask length. In other words, the widget's mask defines the length of the input, which cannot be dynamic.
I am afraid that this is a limitation with the widget and there is no feasible workaround for it.
You can vote for this functionality here:
Kendo UserVoice discussion

Excluding place holder texts from localisations

When I design a cell layout I usually assign a sample text, e.g. 'John Appleseed' to a 'name' label so I can easily see where the field is on the layout and check the composition. Otherwise there is an empty label on a white background. Obviously this text does not need to be translated as it will be always replaced by another value at runtime.
Is there any property I can set in the Object Inspector to exclude this text from .strings / XLIFF file? Translators usually charge per word, so I don't want to send those texts for translation.
For the time being I use '~' prefix and then remove those texts using a Ruby script, but I was wondering whether there is an easier way to do it.
Unfortunately, if you are using ibtool (and you do not really have an alternative) you cannot exclude words directly.
What you can do, is to edit the XLIFF file after you export it and add the attribute translate="no" on the strings you want to exclude. You should make sure that your translators use a XLIFF-compatible tool to translate.
But, imho, this is not any better than your way.
Also see question 1, question 2 and ibtool's manual.

FormatFloat in Livebinding

I'm currently trying to use XE5 livebindings to bind a TTrackBar.Value property to a TLabel.text property. The TrackBar has a frequency of 0.1. Unfortunately, what I'm finding is that with the binding in place, the label is displaying increments that aren't exactly 0.1.
For example, if I set the livebinding links 'CustomFormat' property to %s+'x', the label will sometimes display the extended float value, so instead of say displaying 0.6, it'll display something like 0.6004874613100 which makes the UI look messy.
I am aware of the FormatFloat routine, but unfortunately this isn't accepted by the CustomFormat field in the link itself.
Is there any way to format the value so it only displays the short version (i.e. 0.6) instead of the extended value? I know I could manually code it in, but I've got several components in a similar situation and I'd like to use livebindings where possible.
You can use something like Format('%%.1f',%s)
See Mike Sutton's answer here on SO: Using Format in a livebindings CustomFormat

Delphi FormatFloat and Format functions

I have an application where users can set how values are displayed. The users enter a formatting string and the component uses FormatFloat to display the value.
But now we are using a new third-party component which formats values using the Format function and of course none of our user formats work as the Format & FormatFloat functions use a different syntax.
So does anyone know of a way of converting between the two? Or maybe someone has code to do it?
Thanks,
AJ
Though the format strings for FormatFloat can be more or less transformed to ones for Format, you may only get real similarity for positive values. The Format method simply doesn't offer enough flexibility to incorperate the features and fine-grained control that the format strings for the FormatFloat method offers.
For example, the FormatFloat method allows for three different formats for positive, negative and zero values. Also, the FormatFloat format strings allow for string literals, e.g. '#,##0.00;;Zero'; (which means that zero values are printed as "Zero").
To get something similar using the Format function, you yourself would need to do all the grunt work that FormatFloat is doing for you through the format string.
So, although I am as opposed to changing third party control's sources as I am opposed to changing the vcl sources, I am with David on this one: find a way to make the third party control use the FormatFloat function. Preferably through a custom descendant or through an interposer class (also known as an interceptor class), but if that fails, by all means change the third party control's source. Just make sure that you mark the changed sections properly so you can easily redo it when switching to a new version of that control.
Far and away the simplest solution will be to take the source of the 3rd party component (you should only consider using 3rd party Delphi components that come with source) and modify it to call FormatFloat rather than Format.

How does one change the text on the clipboard without altering the format information?

Another clipboard question:
When text is put onto the clipboard, it frequently goes in multiple ways, usually with and without formatting information. What I want to know is this -- how do you change the text on the clipboard without altering the formatting. In other words, I want to change the text side of things, but keep the formatting exactly the same.
This is again for my "TextScrubber" application where I want to remove line breaks from the text on the clipboard, but I don't want to alter the format info about that text.
I'm hoping that I don't have to "brute force" it by iterating over all the formats present, storing each, and then reinserting them after the text has been scrubbed.
I think the "brute force" is precisely what you'll have to do - according to MSDN Win32 API there is no way to do otherwise.
Yep, Nick. I think in this case you're going to be stuck with the solution already suggested. The clipboard is one area that hasn't really gotten much attention in the enhancement department throughout the years. That is probably because it does need to be simple, ubiquitous, and functional.
Why not simply load from the clipboard, change the text, and write back to the clipboard?
Maybe something simple like Sergey Tkachenko's TBin Clipboard: http://delphi32.org/vcl/2889/
Eric Rosenberger's answer to "Can not round trip html format to clipboard" might also be of use.

Resources