Wix Installer conditional code at run time - wix

In a Wix Installer, I have a checkbox on a custom screen.
I have to invoke a DoAction code when a check box is checked and another DoAction when it is unchecked.
All the searches on Stack Overflow are referring to build time conditional code. But I want it for runtime when Wix Installer is running and the user checks the checkbox. Also I don't want it inside the Custom Action dll.
e.g code.
if (Checkbox is checked)
{
Set property GLOBALAUTHOR = property LOCALAUTHOR
set property phonenumber to ""
}
else
{
Set property GLOBALAUTHOR = ""
}
Any pointers will help.

Checkboxes are an associated property and a value when checked (customizable) and a value when not checked (null)
You don't need a DoAction for what you show here. Just use a series of mutually exclusive events.
SetProperty GLOBALAUTHOR = [LOCALAUTHOR] condition CHECKBOXPROPERTY
SetProperty PHONENUMBER {} condition CHECKBOXPROPERTY
SetProperty GLOBALAUTHOR = {} condition Not CHECKBOXPROPERTY
{} means to set the property to an null value.

Related

Validate if checkbox is checked depending on another validation in vuelidate

I'm just starting with Vue and vuelidate. I have a form which shall work in the following way:
The form shows a Yes/No radio button group.
If the radio button "Yes" is selected then the form shows a checkbox.
The submit button for the form shall be enabled if one of the following conditions is true:
The radio button is set to "No". OR
The radio button is set to "Yes" AND the checkbox is checked.
I'm having trouble with the conditions described in 3. My current validation looks like this:
termsAccepted: { checked: value => value === true }
This basically works for case 3.2 but not for 3.1. In that case the form is still disabled.
b-form-checkbox#termsAccepted(
v-model="termsAccepted"
:state="!$v.termsAccepted.$invalid"
:disabled="disableForm"
)
Thats sound like a computed property should to the job:
Computed Property Documentation
You could do something like:
computed: {
isEnabled() {
return !radiobutton || (radiobutton && checkbox.checked)
}
}

Changing MDI background affects child form background [duplicate]

How can I change the BACKGROUND color of the MDI FORM in C#?
I changed it using the background color property but the color is not changed.
What should I do to perform this task?
The actual BackGround colour of the MDI control is based on the colour in the Windows current Theme. You have to physically set the MdiClient control's background inside the WinForm.
// #1
foreach (Control control in this.Controls)
{
// #2
MdiClient client = control as MdiClient;
if (!(client == null))
{
// #3
client.BackColor = GetYourColour();
// 4#
break;
}
}
Edit - Added comments:
We need to loop through the controls in the MdiParent form to find the MdiClient control that gets added when you set the Form to be an MdiParent. Foreach is just a simple iteration of a type through a collection.
We need to find the MdiClient control within the form, so to do this we cast the current control within the loop using the 'as' keyword. Using the 'as' keyword means that if the cast is invalid then the variable being set will be null. Therefore we check to see if 'client' is null. If it is, the current control in the loop is not the MdiClient control. As soon as the variable 'client' is not null, then the control we've got hold of is the MdiClient and we can set its background colour.
Set the backcolour to anything you want. Just replace "GetYourColour()" with whatever colour you want, i.e. Color.White, Color.Blue, Colour.FromArgb(etc)...
As there is only ever 1 MdiClient, there's no point continuing the loop as it's just a waste of processing time. Therefore we call 'break' to exit the loop.
Let me know if you want anything else explaining.
Write this in your load method of your MDI form.
Controls.OfType<MdiClient>().FirstOrDefault().BackColor = Color.Purple;

Failing to select or set focus to a custom control

I have the following code to select a custom control. But it does not want to set the active control to 'uPnlEntryOptions'. I have tried using control.select as well, same result. I have also tried
ActiveControl = uPnlEntryOptions
Code
uPnlEntryOptions.Visible = True
uPnlEntryOptions.Refresh()
uPnlEntryOptions.Select()
uPnlEntryOptions.Focus()
Debug.Print(CStr(uPnlEntryOptions.Focused))
Debug.Print(CStr(uPnlEntryOptions.CanFocus))
Output
False
True
The Focused property is true only if the control has the focus, not a sub-control.
Calling Select (or Focus?) on a UserControl will select the first child control. Afterwards the UserControl.ContainsFocus = True since the focus is WITHIN the UserControl, but the UserControl.Focused = False, since the UserControl itself isn't the focused control.

XPages - why are Dojo Filtering Select controls obligatory? Can they be customised?

I am using some Dojo Filtering Select controls on my XPage. Despite having set the required property to false, when I attempt to save the XPage document, I see the message "This value is required" in the Dojo Filtering Select control. I would like to know
1/ is it possible to make a Dojo Filtering Select control NOT obligatory?
2/ Is it possible to customize the error message which appears when the control is obligatory?
1) You get the message "This value is required" at client side validation. So, in addition to property required="false" which is responsible for server side validation only you have to set a dojoAttribute "required" to "false". Then you don't get the message anymore.
<xe:djFilteringSelect
id="djFilteringSelect1"
value="#{...}"
required="false">
<xe:this.dojoAttributes>
<xp:dojoAttribute
name="required"
value="false">
</xp:dojoAttribute>
</xe:this.dojoAttributes>
</xe:djFilteringSelect>
2) The same way you can set the dojoAttribute "missingMessage" to the string you like in case your control stays obligatory.
you can customized these parameters (They are in the parent ValidationTextBox of FilteringSelect):
// required: Boolean
// User is required to enter data into this field.
required: false,
// promptMessage: String
// If defined, display this hint string immediately on focus to the textbox, if empty.
// Also displays if the textbox value is Incomplete (not yet valid but will be with additional input).
// Think of this like a tooltip that tells the user what to do, not an error message
// that tells the user what they've done wrong.
//
// Message disappears when user starts typing.
promptMessage: "",
// invalidMessage: String
// The message to display if value is invalid.
// The translated string value is read from the message file by default.
// Set to "" to use the promptMessage instead.
invalidMessage: "$_unset_$",
// missingMessage: String
// The message to display if value is empty and the field is required.
// The translated string value is read from the message file by default.
// Set to "" to use the invalidMessage instead.
missingMessage: "$_unset_$",
// message: String
// Currently error/prompt message.
// When using the default tooltip implementation, this will only be
// displayed when the field is focused.
message: "",
If you set required to false, it should not prompt message, can you post you code.

Binding Custom object to Checkbox in VB.NET

I am trying to bind a checkbox to a custom object boolean property as follows:
chkTableIsReadonly.DataBindings.Add(New Binding("Checked", objectBindingSource, "ApplyforVisa", True, DataSourceUpdateMode.OnPropertyChanged, False))
The custom class supports the INotifyPropertyChanged interface.
Everything works find when I initially bind the checkbox to a new object:
objectBindingSource.Datasource = new objectToBindTo
Here is the odd part:
If I check the box, the property Set gets called and the INotifyPropertyChanged event gets called and everyone is happy.
If I uncheck the same box, the property Set doesn't get called, the INotifyPropertyChanged event never gets called and (the worse part), I cannot navigate to another record.
I have tried capturing the CheckedChanged event to set the object.ApplyForVisa property manually, but no success. The property Set gets called and the INotifyPropertyChanged event gets called, but I am still locked on control and can't navigate.
I have tried calling bindingsource.endedit in the CheckedChanged event, no success.
It only matters if I uncheck the box. The checkbox is two-state - true or false.
All of my other bindings work just fine - text boxes, combo boxes, datagrid. Just not checkbox.
My only thought is that is seems to act like a binding source data error, but no error is thrown. If I add the data error event handler for the binding source, it never gets called.
Assuming the ApplyForVisa property is a Boolean, you can just fix this by setting formattingEnabled parameter for the Binding to False.
chkTableIsReadonly.DataBindings.Add( _
New Binding("Checked", objectBindingSource, "ApplyforVisa", _
False, DataSourceUpdateMode.OnPropertyChanged, False))