Serenity.ComponentModel.RadioButtonEditor using a const string value - serenity-platform

I have a class of constant (string). I would like to use as radio button but it only accept a lookup (database) and enum (int). Is there any workaround to have a radio button for a string value?

Serenity doesn't have editor for this. You can write your own radio button editor which get id as string with same value of text and string value.
Check editor samples in basic samples > editors. You can inherit radio button editor and override functions as you expect.

Related

powerapps Radio button control

I have a gallery and a radio button.
In the gallery where the user has to answer questions.
Each question can be a radio button with multiple choice answers, for example one could be a yes no response another could be a yes no unknown choice.
These choices are determined from the list field called answerchoice .
In the answerchoice field it might be populated with
yes\no or yes\no\unknown or 1\2\3\4.
Therefore in the items of the radio button I need to pass the values of the answerchoice field
Thank you
If the separator for the options is the \ character, then you can use the Split function to convert that into a collection that you can set to the Items property of the radio button control:
Split(ThisItem.Value, "\")

MS Visual Studio - How do I use a button to Sort my combobox variables?

I searched and only found how to sort combobox variables through the Properties sidebar. This will not work for what I'm trying to do.
I have a textbox where the user will type in a name. They click the Add button, and the name is added to the combobox options. Let's say I add "Bob" then "Andy" then "Carl". In the combobox it would list them in that order.
I need to use a button that will sort these names alphabetically. How would I do that?
Instead of changing the "Sorted" in properties to true, I set it so that when you click the button, it would do this. So the "Sort" button code would look like this:
ComboBox1.Sorted = True
Put them in an array and use Array.Sort then back into the combobox

Formatting Dojo TextBox on the fly

I want to format the value of any type of TextBox, based on a pattern, on the fly. So basicly I mean when the user is typing '123' and my pattern is '0.00' it has to be converted directly to '1.23'. I know I can do this with the onChange function, but I guess there is already a Dojo based solution(not the onChange of a TextBox). Could someone tell me which property I have to use?
I've tried to use constraints and filter, but both only work after a blur event.
Widgets fire events on themselves that emulate the events of their DOM elements. For example a text box dijit will fire a change event on the object called "change".
There is also an replaceable function called "format" which, as the name suggests, formats the value of the text box.
see: http://dojotoolkit.org/api/?qs=1.9/dijit/form/_TextBoxMixin
As such you can do:
widget.format = function(value, constraints){ //my formatting fnc}
widget.on('change', function(){
widget.format();
});

How to save Id for dijit.form.ComboBox

I'm writing my first dijit control for EPiServer. In my template I am using the dijit.form.ComboBox.
I have attached an event handler to the "onChange" event like so:
postCreate: function () {
// call base implementation
this.inherited(arguments);
// Init textarea and bind event
this.inputWidget.set("intermediateChanges", this.intermediateChanges);
this.inputWidget.set("store", this.store);
this.connect(this.inputWidget, "onChange", this._onInputWidgetChanged);
},
Then in my event handler I have:
_onInputWidgetChanged: function (e) {
alert(e.id);
this._updateValue(value);
},
My issue is that as with a typical dropdown list, I want to store the Value rather than the Text. The options in my combobox look like so:
Value | Text
1 | "Test"
2 | "A different test"
The problem is that the value passed into the _onInputWidgetChanged handler is always the text value of the combobox i.e. "Test" or "A different test"
How can I get access to the Value instead? As I said, this is the first time I have ever worked with dojo and dijit so I may be missing something fundamental here.
Thanks in advance
Al
The thing about ComboBox is that its value is not required to be an entry in the drop-down menu (and thus, not guaranteed to be one either). Think of it as a textbox with autosuggest - users can use the menu to expedite the process, but the value of the textbox is freeform and is reported as whatever the user types into it.
If you want users to be required to choose an entry from the menu, you should be using FilteringSelect instead, which will report the associated store item's ID (or associated option tag's value) as its value. As opposed to the free-form nature of ComboBox, FilteringSelect can be thought of as a menu with type-ahead functionality.

setting textbox text equal to textbox text on a different form?

is it possible in design mode to set the textbox text property to the text property of a textbox in a different form in vb.net?
You could use the ApplicationSettings.PropertyBinding property of the text box to accomplish what you want. If you sort the text box properties A-Z, it should be the first one in the list in parenthesis. Just create a shared application value and it will apply to each control that binds to the value.