ontouch for RecycleView affects other positions - android-recyclerview

I have a RecyclerView that I want to add a colored place holder so that when the user clicks on an item, that item and all before become colored. If the previous item clicked was an item after it I'll uncolor that and the other items that come after the current item clicked.
I've gotten it to color any item clicked but I'm not sure how to handle one click affecting other items like that

I had the clicks be represented by a boolean[](true = selected, false = not selected). When a position is selected make that position true and the ones before it true and the ones after it false.
I then call notifydatasetchanged which starts up OnBindViewHolder to set the colors based of if the positions are true or false

Related

Getting Button state in XCUITest

How to get button state in XCUITest?
It is just a NSButton which acts as a toggle button. The images changes upon clicking. In application i check with button.state which returns 0 or 1. depending upon the values i changes the images.
#IBAction func checkBoxClick(sender: NSButton) {
print("Checkbox state ", sender.state)
}
But when writing XCUITest automaton code, i am not able to get the state of the button. there is no attribute like state. Also when i take 'value' or 'selected' attributes of the button it always gives nil and false.
let window = XCUIApplication().windows["Window"]
let button = window.buttons["Button"]
button.click()
print("Button selected ",button.selected)
print("Button selected value ",button.value)
button.click()
print("Button unselected ",button.selected)
print("Button unselected value ",button.value)
Values printed are
Button selected false
Button selected value nil
Button unselected false
Button unselected value nil
Any inputs.
In your application code, you could map the 0/1 state to selected/not selected. Default state should be false and when it is toggled, invert the state of sender.selected.
The selected property represents two states and provides the same functionality as your .state addition.

How to access ScrollRect items and get it selected and clicked?

I am using Myo so my inputs are not the same as keypress and mouse.
I am trying to access items in the scroll UI Panel. Here is a snapshot of my Unity3D hierarchy.
http://imgur.com/f0cIJWl
As you can see, I have
-StoreMenu
-ScrollPanel
-ScrollRect
-ShopItems (list of items)
How can I possibly scroll and highlight the list of item. And on certain input gesture, get it selected ?
I'ved only managed this far:
scrollpanel = GameObject.Find("ScrollPanel");
scrollRect = scrollpanel.GetComponent<ScrollRect>();
scrollRect.GetComponent<ScrollRect>();
scrollRect.verticalNormalizedPosition = 0.5f;
I can get the scrollrect, move to certain position in the scroll but items are not highlighted.
Thanks in advance.
TRY THIS : http://docs.unity3d.com/462/Documentation/ScriptReference/EventSystems.EventSystem.SetSelectedGameObject.html
This can be used to Set the object as selected

How do I select a item out of a radio button list?

I have a radio button list set up for sorting with 2 possible choices. when the page loads i need to have one of those selected, however it has to be through code rather than manual section in the design screen.
For the first item selected:
myRbl.Items(0).Selected = True
Or the second:
myRbl.Items(1).Selected = True
Simply set their Checked flags to true/false.
rbFirstOne.Checked = True
rbSecondOne.Checked = False
Edit: Oh, radio button list, not just button. Sorry.

RadioButtons Highlighting Incorrectly

On my form, I have 4 RadioButtons, each with its appearance set to Button. In my program, I change each of these RadioButton's ForeColour, BackColour and AutoCheck status, as below:
ARadioButton.AutoCheck = False
ARadioButton.BackColor = Color.FromKnownColor(KnownColor.ControlLightLight)
ARadioButton.ForeColor = Color.FromKnownColor(KnownColor.ControlDark)
However, later on, I reset these properties back to default:
ARadioButton.AutoCheck = True
ARadioButton.BackColor = DefaultBackColor
ARadioButton.ForeColor = DefaultForeColor
My issue is that instead of the entire button being highlighted, only the outside is, as shown in the images below.
Originally:
After changes are made and RadioButtons reset to default using code above:
I know this may seem trivial, but I would like the entire RadioButton to be highlighted when the user clicks on the RadioButton, not just the outside.
Is there a way I could somehow reset this?
Try setting the BackColor property to Color.Transparent

vb.net hide button text or make image on button cover text

I dynamically create buttons on a form and use the button text as ids so that I can pass that to an SQL query to pull saved data about that button when necessary, but I also use an image over buttons that have information saved about them. What I need to know is how do I keep the text on the button from appearing when there is an image assigned to that button? By default vb.net shows both the text and the image and no TextImageRelation values allow for the image to take precedence. I tried changing the text color to transparent, but the outline of the text is still visible through the image. Is there anyway to keep the text value as it is but just show the image on the button?
Don't use the .Text property of the button to store your information. Use the .Tag property for your IDs. Just set the .Text property to "" (empty string), that way it won't interfere with your image.
not sure, but why not just set the value to a variable to be passed to the SQL on the button click event and not place the text on the button? If you are using the same button click event for several buttons you could check the sender's ID and then set the variable based on that.
To Enable "Button1" Click (Visible)
Button1.Enable = True
To Disable "Button1" Click (Visible)
Button1.Enable = False
Hide "Button"
Button1.Visible = True
or
Button1.Show()
Show "Button"
Button1.Visible = False
or
Button1.Hide()
You can Also Used the code to any Tools (TextBox, Label, ComboBox, Radio Button, Button, Link, GroupBox)