Bug in Breeze 1.01 with boolean field and canceling changes - breeze

I have an issue in BreezeJs 1.01 when canceling changes on a Boolean property. The property is bound using KnockoutJs:
<input type="checkbox" value="IsDeleted" data-bind="checked: IsDeleted" />
It has the following behavior:
If the initial value is true, and I set it to false, then cancel changes, the value reverts to true. (correct behavior)
If the initial value is false, and I set it to true, then cancel changes, the value reverts to false. (correct behavior)
If the initial value is true, and I set it to false and then back to true, then cancel changes, the value stays true. (correct behavior)
If the initial value is false, and I set it to true and then back to false, then cancel changes, the value reverts to true. (incorrect behavior)

Ok, sorry this took so long. This was a bug and is now fixed in breeze v 1.1.0. and thanks for finding it :)

Related

MS Access -- Yes/No statement

I want to create a Yes/No row in a table, the row would be called 'prepayment'. So, if there is one, and you check 'Yes' in the form, I want some textbox to appear -- so you could type in the sum of prepayment. Is there some way to do it the way that textbox to type in the sum wouldn't be visible in the form unless you check 'Yes'?
I didn't really try anything yet. Just have no idea how to do it...
Solomon,
Set the Visible property on the Textbox to No.
Create an On_Click event for the Checkbox.
The code for the On_Click event should change the Textbox Visible property to Yes. You might also want to check the current setting of the Textbox Visible property so you can hide it if they uncheck the Checkbox.

AllowAllUp property for TToolButton Is Not Working

I am using Delphi XE5.
I am trying to workout as per the Delphi's help about TToolButton component.
Delphi Help Says about TToolButton.AllowAllUp property:
Indicates whether all the tool buttons in a group can be un-selected at the same time.
If AllowAllUp is set to true, all of the tool buttons in the group can be unselected. If AllowAllUp is set to false, at least one tool button in the group must be selected at any time. (Determine which tool button is initially selected by setting its Down property to true.)
AllowAllUp is effective only when Grouped is true and Style is set to tbsCheck. Changing the value of AllowAllUp for one button in a group automatically changes the value for all buttons in the group.
What I have done is I have placed a TToolBar on the form and created three TToolButtons in it. Then AllowAllUp and Grouped property is set to True. Also, set Style property to tbsCheck.
When I run the application, and when I go on clicking all buttons one by one, then any one button is showing as selected, if i try to select or click on other TToolButton previous one becomes un-selected.
How to make AllowAllUp property working?
These properties all work as intended. It seems that you are misunderstanding the intent of these properties.
The documentation for the Grouped property says:
When an unbroken sequence of adjacent tool buttons each has its Grouped property set to true and Style set to tbsCheck, then no more than one of the buttons can be selected at the same time.
The AllowAllUp property is related and described like so:
Indicates whether all the tool buttons in a group can be unselected at
the same time.
If AllowAllUp is set to true, all of the tool buttons in the group can
be unselected. If AllowAllUp is set to false, at least one tool button
in the group must be selected at any time. (Determine which tool
button is initially selected by setting its Down property to true.)
AllowAllUp is effective only when Grouped is true and Style is set to
tbsCheck. Changing the value of AllowAllUp for one button in a group
automatically changes the value for all buttons in the group.
This property only has an impact when you group buttons, and what it does is control whether or not you can have zero buttons down. But once you have grouped buttons, never more than one of the group can be down at any one time.
You need to do the following:
Set Grouped to False.
Set AllowAllUp to False, not that it really matters but you may as well restore the default to avoid confusion.
Set the style to tbsCheck.
Once you've done this you can check and uncheck the buttons independently of each other.

Is there a way to unset the value of a slider in jQuery Mobile 1.4.5?

I am using the following markup to display a slider with its value shown on its button:
<input type="range" name="my-slider" id="my-slider" min="1" max="5" step="0.5" value="" data-show-value="true" class="ui-hidden-accessible" />
When the slider is first displayed, there is no value attached to the slider. Only until I move the button or programmatically set the value, does the slider change. For example,
$('#my-slider').val(someNumber).slider('refresh');
Is there a way to programmatically reset the value back to its original state (with no value) ? If I set it to null or '', the value becomes 1 (min). If I set it to 6, the value becomes 5 (max). But how do I unset it?
Try this:
$('#my-slider').slider('destroy').val('').slider();
Since there is no method to reset to an empty value you destroy the slider instance, set the value, then recreate the slider.
If you initially passed some config values into slider() then add that as well.

Mobiscroll sets input to readonly even when not displayed/shown?

I display two dates in a input-field. When the user clicks on a valid date, mobiscroll should display the date and allow it to be changed.
When the user sets the cursor outside one of the dates (by clicking just before or after one of the dates), the input field should work as expected, allowing the user to change the date in-place or typing something.
Mobiscroll is initialized with:
$('#input').mobiscroll().date({
showOnTap: false,
showOnFocus: false
});
and then invoked with
$('#input').mobiscroll('setDate', theClickedDate, false);
$('#input').mobiscroll('option', {onSelect: dateChanged});
$('#input').mobiscroll('show');
when the "circumstances" are right (i.e. a valid date clicked).
This works when a date is clicked, mobiscroll is displayed with the date. But a click "outside" one of the dates does not set the cursor to allow editing. The input acts like it is 'readonly'.
Pasted from Mobiscroll support team:
Mobiscroll sets the input field to readonly, because otherwise, when it receives focus, the virtual keyboard will also pop up.
I think the best solution would be to not initialize mobiscroll on the input field (as you are not using the show and fill functionality anyway), you can initialize it on an empty div.
If you use bubble positioning, you should also pass the input element in the anchor setting:
$('#mydiv').mobiscroll().date({
display: 'bubble',
anchor: $('#input')
});
$('#mydiv').mobiscroll('setDate', theClickedDate, false);
$('#mydiv').mobiscroll('option', {onSelect: dateChanged});
$('#mydiv').mobiscroll('show');

How to change position of slider without calling change/slide methods?

I have a slider. When the user slides it, it adjusts the gamma of an image. Here is the code, very straightforward, works perfectly.
$('#gammaSlider').slider({
max: 125,
min: -125,
value: 0,
slide: function () {
//stuff to adjust gamma of image
},
change: function () {
//stuff to adjust gamma of image
}
});
However, when the user loads a different image, I want to programmatically set the slider to the value it should be at for the new image (a.k.a. allow flipping back and forth between multiple pages with separate gamma settings). To be clear, the newly loaded image's gamma is already at whatever value it was last set to. I am only seeking to adjust the UI to match the new image's value. For instance, if I increase page 2's gamma, then flip to page 1, I need to move the slider back to default from its increased position, and I need to do it without the code thinking I'm trying to decrease the gamma.
When I do this using the following, there's a problem:
$('#gammaSlider').slider('value', gamma);
The problem is that this is triggering the slide and change calls that I set up for the slider in the original declaration above, causing it to try to reload the image redundantly with new gamma values. Is there a way to change the slider programmatically WITHOUT triggering those calls?
You can use the fact that you can differentiate between a user change and a programmatic change via event.originalEvent. For example, you can have code that gets executed when the user makes a change, and different code that gets executed when you make a programmatic change like changing the value. Since changing the value will trigger the slider's change event, you can put your gamma change code within the block that only is triggered on a user's change, not a programmatic change:
change: function (event) {
if (event.originalEvent) {
//stuff to adjust gamma of image ONLY WHEN USER CHANGES THE SLIDER
console.log('user change');
}
}
You can see in this jsFiddle example that the slider's value is changed to 50, yet no log message is generated unless the user moves the slider. If you comment out the if condition you'll see the log message gets generated not only after the user changes the slider's value, but when you make a change to the value programmatically.
Maybe you can call the slider method passing a new configuration, which probably would be exactly the same object you are passing as parameter, but with the "value" field changed.
I have done a test in one of my old projects and it worked for me.

Resources