VB Datarepeater control in Visual Studio 2010 - currentItemIndex updated before textbox leave event when using mouse - datarepeater

I'm using a datarepeater control, version 10.0 in visual studio 2010. The CurrentItemIndex seems to update before the textbox leave event when I use the mouse to move to the next row. So, when I retrieve the value from the textbox, I don't now what ItemIndex it is associated with. This doesn't happen when the keyboard is used to move to the next row. Anyone see this happen. Version 9.0 on the datarepeater did work this way.

To answer you directly, here are some C# snippets. I'm assuming that you already have the TextBox object (or other control) as implied in your question. I will also assume that you're inside an event handler (e.g. TextChanged). If you haven't already done it, you need to use the object sender parameter and not the design-time declared TextBox control (i.e. do not use TextBox1, or similar object) because it will just refer to the DataRepeaterItem template control and not the individual control for the data row you're interested in.
TextBox itemTextBox = sender as TextBox;
//* DataRepeaterItem is a control which contains other controls for each data "row"
DataRepeaterItem drItem = itemTextBox.Parent as DataRepeaterItem;
//* Retrieve the particular data item
int idx = drItem.ItemIndex;
//* If DataRepeater is bound to a BindingSource, for example,
//* one can retrieve the underlying data item
object dataItem = myBindingSource.List[idx];
I've experienced various bugs and challenges with control focus and data updates with the DataRepeater. There is no guarantee of exactly which order the events fire: Leave, LostFocus, CurrentItemChanged, etc. And as you've observed, it differs depending on whether you use the mouse within the DataRepeater or to/from another control on the form or using the keyboard. There may indeed be an established algorithm, but I have observed differences from documentation. The situation is complicated when the data-handling framework (e.g. BindingSource, CurrencyManager) also subscribes to these events and updates things out of order from what you might expect or want. I don't have a suggestion on how to handle these issues, but I hope the code above can at least get you access to the particular index and data for the control you're in.

Related

Is it possible to keep selecting an item from a carousel/list?

I am displaying a carousel as discussed in Why is the carousel not showing in the console simulator?. I am now noticing that the end-user can only select once an item from the carousel. When the end-user select another item subsequently, the default fallback intent is triggered.
Is it possible to select multiple items from a carousel?
In my case, the backend service shows the carousel with an output context (named my-carousel) set. The corresponding intent for the actions_intent_OPTION event requires that same context my-carousel as input context (which works as expected for the first selection). When setting the output context my-carousel, I tried several lifespan count values, but without any success.
I don't think there is a way to currently do that the way you tried.
However, you can have another intent trained for keys of carousel (Or use fallback intent) and then process the information this way instead of using actions_intent_OPTION.
But this solution would work only for static data/data matching your database.

Focus handling in SAPUI5

We have a requirement that of using a "tab" key in the table control to navigation across only input fields.
1. Every table row has atleast 6 to 8 fields - 2 of them are input fields and rest could be text,select etc.
2. By clicking tab i navigate across input fields in a row on clicking the last input field of a row i should move to the first input field of the next row.
I have the code for the following but i can see the focus method of the input control focuses the UI to subsequent input field of the input to be focused.
Jsbin - https://jsbin.com/lugesecuhe/edit?html,output
I tried to set styles like .sapMFocus and also document.getElementbyId().focus and they dont work either.
Can you suggest some pointers on this.
Thanks and Regards,
Veera
I have exactly the same problem and started looking into it. I found out that the navigation within the table is possible and performed by class sap.ui.core.delegate.ItemNavigation (at least in v1.26).
However, what I consider really non-intuitive:
On Mac (Chrome or Safari) you have to hold the ALT key while pressing TAB to cycle through the input fields of your table.
I haven't figured out how to do it on Windows
I checked in your JSBin example, somehow the fields get focused in a weird order. I have prepared my own example - http://jsfiddle.net/bgerth/x8h92mz8 - where you can cycle through the input fields row by row using Alt+Tab.
Update 1
I have found the blog SAPUI5 Table Navigation with Tab Key by Klaus Kronawetter which adds extra keyboard handling to a sap.ui.table.Table. I adapted his code for a sap.m.Table which you can find at http://jsfiddle.net/bgerth/os6r096y.
Update 2
After further investigation, I decided that the solution from update 1 above is too much hassle.
Instead, I adapted the class sap.ui.core.delegate.ItemNavigationmentioned above, which is internally employed by sap.m.ListBase. In essence, you can cycle through the input fields with up and down arrow keys.
I have prepared an example at http://jsfiddle.net/bgerth/0r9L30wd. The relevant code is
var fnPatchedItemNavigationsetItemDomRefs = sap.ui.core.delegate.ItemNavigation.prototype.setItemDomRefs;
sap.ui.core.delegate.ItemNavigation.prototype.setItemDomRefs = function setItemDomRefsPatched(aItemDomRefs) {
// 'this' is now the instance of sap.ui.core.delegate.ItemNavigation
jQuery.sap.log.debug("Patched version of sap.ui.core.delegate.ItemNavigation.setItemDomRefs");
var aInputFields = $(aItemDomRefs).find("input:enabled").get();
if (aInputFields[0]) {
// There is at least one enabled input field in this table
fnPatchedItemNavigationsetItemDomRefs.call(this, aInputFields);
} else {
fnPatchedItemNavigationsetItemDomRefs.call(this, aItemDomRefs);
}
}

Bokeh - How to use box tool without default selections?

I have built a bokeh app that allows users to select windows in data and run python code to find and label (with markers) extreme values within these limits. For ease of interaction, I use the box select tool for the range selection. My problem arises when repeating this process for subsequent cases. After markers are placed for the results, they are rendered invisible by setting alpha to zero and another case needs to be chosen. When the new select box includes previous markers, they become visible based on the selection. How do I override this default behavior? Can markers be made unselectable? or can I add code to the customJS to hide them after they are selected?
Thanks in advance for any help!
There are a few possible approaches. If you just want non-selected glyphs to "disappear" visually, you can set a policy to do that as described here:
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs
Basically, for bokeh.plotting, pass
nonselection_fill_alpha=0.0,
nonselection_line_alpha=0.0,
as arguments to your plot.circle call or whatever. Or if you are using the low level bokeh.models interface, something like:
renderer.nonselection_glyph = Circle(fill_alpha=0.0, line_alpha=0.0)
But be aware (I think you already are) that the invisible markers are still there, and still selectable if the user happens to draw a box over them with the selection tool.
If you truly want only a subset of the data to be visible and selectable after a selection, I'd say you want to replace the data in the column data source wholesale with the subset in your selection callback.

Reference Table to fill calendar form

In Access 2010, I've built a calendar Form that I want to be able to display who is off in a given month.
Each box of the calendar obviously represents a different day. I've got a table called "Separated" set up that ultimately stores the associate name and the date they are off -- one day per record.
Here's what I've done so far to try to test it on just one of the boxes (representing a day):
Private Function fillDays()
Dim rsNames As DAO.Recordset
Set rsNames = CurrentDb.OpenRecordset("SELECT * FROM Separated")
If Not rsNames.EOF Then
b0.Text = rsNames![Associate]
End If
Set rsNames = Nothing
End Function
I get the following debug note:
"Run-Time Error '2185"
"You can't reference a property or method for a control unless the control has the focus."
The debugger highlights the line with "b0.text = rsNames![Associate]
Is there some whay that I need to reference an index number from my "Separated" table?... or perhaps using a query method of some sort would be more effecient.
Assuming b0 is a textbox, the error you are getting is due to the fact that you can't use it's Text property when said textbox hasn't got the focus.
As stated in MSDN, «While the control has the focus, the Text property contains the text data currently in the control; the Value property contains the last saved data for the control. When you move the focus to another control, the control's data is updated, and the Value property is set to this new value. The Text property setting is then unavailable until the control gets the focus again» (emphasis mine).
Try using Value (help here) instead:
b0.Value = rsNames![Associate]

DataGridViewComboBoxCell selectioindexchange event

I have a data-grid and three column in it. one column is type of DataGridViewComboBoxCell, three items are in this grid combo box, now i have to invoke selection index changed event to change value according to combo value change in grid.
also help me to make a new event ....
please help...
thanks
I really can't understand your question.
But maybe these informations can help:
A ComboBoxColumn has always two kinds of controls. A presenting one (in most cases a label) which is individually for each row. And a editing one that will be shared for the whole column. So take a look into this documentation and the IDataGridViewEditingControl Interface.
Maybe these will give you a starting point on how to solve your problem.
In the Load event for the form, you need to get the cell that you want to add the handler to and cast it as a regular combo box. You can then add the event handler on SelectedIndexChanged, but it must be done programmatically, and depending on the language you are using.