w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Listbox item as Listbox should clear the selection of its item when other item's item is selected?
You can explicitly null the SelectedItem whenever the ListBox loses focus, i.e you have to handle the LostFocus event. You could add the event handler to the ListBox and handle the event in the code behind. XAML Change: <ListBox x:Name="lstMsgs" HorizontalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Hidden" HorizontalContentAlignment="Stretch" ItemsSource="{Binding MessageList}" SelectedItem="{Binding DataContext.SelectedMessage,Mode=TwoWay,ElementName=me}" Background="Transparent" BorderThickness="0" LostFocus="lstMsgs_LostFocus"> Code Behind: private void lstMsgs_LostFocus(object sender, RoutedEventArgs e) { ListBox listBox = sender as ListBox; if (listBox != null) { listBox.SelectedItem = null; } }

Categories : C#

Android Listview item selection in Xamarin using VS 2012 C#
Have your activity implement ListView.IOnItemClickListener like this: public class SomeActivity: Activity, ListView.IOnItemClickListener Get a refence to your listview like this: LsitView LV = FindViewById<ListView>(Resource.Id.id_in_axml); Then set the OnItemClickListner to the activity since we are going to implement the interface ListView.IOnItemClickListener lstItems.OnItemClickListener = this; Finally add this to your activity class: public void OnItemClick(AdapterView parent, View view, int position, long id) { //whatever you need it to do goes here. }

Categories : Android

How to clear Selection in VBA
To clear the selection, add this to the end of your sub: CutCopyMode = False Note that that your code doesn't seem to add a copy of the second table, but instead it appends a copy of each row in the second table to the end of that same table. Not sure if that's by design or not. To copy the entire table to the end of the document: ActiveDocument.Tables(2).Select Selection.Copy Selection.EndKey Unit:=wdStory Selection.TypeParagraph Selection.Paste

Categories : Vba

is there a way to clear uipickerview selection?
I would try to put this above the [super viewDidLoad] [picker reloadAllComponents]; [picker selectRow:0 inComponent:0 animated:YES]; That should set your pickerview to row at index 0 every time the view is loaded.

Categories : IOS

Null pointer exception onFling on listview item in a fragment while trying to swipe delete in ListView
Your log is showing e1 is null and historySize=0, so it only has one event to report. You'll need to add a null check to ensure you have both events. @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { Log.e(THIS_FILE, "======onFling "+REL_SWIPE_MAX_OFF_PATH+" , "+e1+" , "+e2); if (e1 == null || e2 == null) { return false; // If it still gives you trouble return true } if (Math.abs(e1.getY() - e2.getY()) > REL_SWIPE_MAX_OFF_PATH) return false; if (e1.getX() - e2.getX() > REL_SWIPE_MIN_DISTANCE && Math.abs(velocityX) > REL_SWIPE_THRESHOLD_VELOCITY) { int pos = getListView() .pointToPosition((int) e1.getX(), (int) e2.getY()); if (pos &

Categories : Android

Mangeto: how to clear the shipping and country selection only from the session
As per my thought and logic it should work for your As magento provide set and get method for different variable name so in quote also will work for you just try like below if the flag is set, making... Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(null); OR Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress->setCountry_id(null); just try or find out in mage core to get your solution.

Categories : Magento

How to clear the selection of QListView when multiple items are selected?
Use void QAbstractItemView::clearSelection() [slot] to clear selection Also, all views have a selection model you can access through: QItemSelectionModel * QAbstractItemView::selectionModel() const that allows doing a lot more things selecting Look at Handling selections in item views Another thing ... #ifdef QT_NO_DEBUG means release #ifndef QT_NO_DEBUG would be debug mode, and im sure, it will not compile the code you pasted

Categories : C++

Clear Checkbox when Radio Button selection is Changed
The following approach appears to work: $('input[name="item_meta\[180\]"]').change(function(){ $('input[name="item_meta\[640\]\[\]"]').prop('checked',false); }); JS Fiddle demo. Note that I removed the onclick (since they weren't defined, their absence generated errors, and if you're using jQuery why are you even using in-line event-handlers?). Also, the escaping of the square-brackets (using the \ characters). References: prop().

Categories : Javascript

Save "Title" item to ListView and click on item to load data to new activity
Well, are you required to do this way(inflate a new view into the container)? or you just simply go with ListView, just add new Item, refresh the view and it's there. You can take a look at this example: The MainActivity: public class MainActivity extends Activity { private Button add; private MyAdapter adapter; private ArrayList<String> data; private ListView lv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); add = (Button) findViewById(R.id.button1); lv = (ListView) findViewById(R.id.listView1); data = new ArrayList<String>(); adapter = new MyAdapter(data); lv.setAdapter(adapter); add.setOnClick

Categories : Android

jquery mobile .listview() adding only last item to localstorage regardless of item clicked
You may try to add the click event to the link elements <a> before adding them to your listview (just after creating them): In your LOOP, do the following: new_markup = $('<li><a href="#fbfullpostviewpage" id="addPostToLocalStorage" data-rel="dialog" data-transition="pop" data-overlay-theme="e" data-inline="true"><img src="' + thumb_url + '">' +'<h4>' + name + '</h4><p>' +'posted this photo....</p><p>'+likes+'<img src="images/facebook-like-16.png"></p></a></li>'); // Add the click event to the link <a> : new_markup.children('a').click(function(){ localStorage.setItem("fbclickedPost", JSON.stringify(post)); console.log(post); alert("this post was added to local storage"); // showDetail

Categories : Jquery

how to limit right click on selected listview item only or an item rather than empty spaces?
You may cancel the ContextMenuStrip.Opening event in case the HitTest shows that the mouse is not over an item. You don't have the mouse position from the event args here, so you have to get it from Control.MousePosition public void ContextMenuOpening(object sender, CancelEventArgs e) { Point mousePosition = myListView.PointToClient(Control.MousePosition); ListViewHitTestInfo hit = myListView.HitTest(mousePosition); e.Cancel = hit.Item == null; }

Categories : C#

Android ListView select item and show information about list item
For the information you can use this code for the dialog box and this can be called by showSettingsAlert(); wherever you want this dialog box to displayed. public void showSettingsAlert(){ AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); // Setting Dialog Title alertDialog.setTitle("Title here"); // Setting Dialog Message alertDialog.setMessage("here the information can be display"); alertDialog.setNegativeButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); // Showing Alert Message alertDialog.show(); } for the other thing look Contextual Action Mode. these li

Categories : Android

Listview's item changed while listview scrolling in android
Don't add any view at getView(). Instead, add the other TextView before, and set its visibilty to be 'gone'. At getView() check if you need this view, if so, set its visibility to be 'visible' otherwise, set 'gone ' (you must set the visibilty for every list item even if you believe that you don't have to do so).

Categories : Android

How to change value of selected item in ListView by choosing it from another ListView?
If there are two ListBox controls with their ItemsSource property set to the same source. Set IsSynchronizedWithCurrentItem to true on both list boxes to ensure that the selected item in each ListBox is the same. <ListBox Name="employeeListBox1" ItemsSource="{Binding Source={StaticResource Employees}}" ItemTemplate="{StaticResource EmployeeItemTemplate}" IsSynchronizedWithCurrentItem="True"/> <ListBox Name="employeeListBox2" ItemsSource="{Binding Source={StaticResource Employees}}" ItemTemplate="{StaticResource EmployeeItemTemplate}" IsSynchronizedWithCurrentItem="True"/> check with this(http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.selector.issynchronizedwithcurrentitem.aspx)

Categories : Wpf

Listview with multiple layout item changes on item moves off the screen
I solved the problem since there was two different layouts to inflate i had to use two different viewholders. public class MessageAdapter extends ResourceCursorAdapter { private static final ContactsWrapper WRAPPER = ContactsWrapper .getInstance(); /** Cursor's sort. */ // static ViewHolder holder; int rowType; public static String SORT = Calls.DATE + " DESC"; private Activity context; /** {@link BackgroundQueryHandler}. */ // private BackgroundQueryHandler queryHandler; /** Token for {@link BackgroundQueryHandler}: message list query. */ /** Thread id. */ private int threadId = -1; /** Address. */ private String address = null; /** Name. */ private String name = null; /** Display Name (name if !=null, else ad

Categories : Android

How to apply overlay only on the item when select listview item
Check this out:ListView - Highlight sub layout of item. I've implemented exactly what I think you're looking to do.

Categories : Android

ListView does not clear to set new values
You should make locally this line :-- Replace this:- map = new HashMap<String, String>(); From This:- HashMap<String, String> map = new HashMap<String, String>();

Categories : Android

how to update listview item on item click?
Have you tried AdapterView.OnItemClickListener? http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html onItemClick(AdapterView<?> parent, View view, int position, long id) view is the list item that was clicked, so if you wanted to alter it, you can just alter the view paramter.

Categories : Android

ListView item deletion changes item heights
Okay, i've found a solution. Added int lastValidPosition = -1; in the adapter, then adapter.lastValidPosition = position-1 in the deletion callback method, before adapter.notifyDataSetChanged(); , and in the getView() method of the adapter i've changed //if(convertView == null) view = inflater.inflate(R.layout.counter_list_item, null); to if(lastValidPosition < position | convertView == null){ view = inflater.inflate(R.layout.counter_list_item, null); lastValidPosition = position; } and it works perfectly.

Categories : Java

Is there something like a WPF listview without the selection?
The best solution is for me: <Style TargetType="{x:Type ListBoxItem}"> <Style.Resources> <!-- With focus --> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /> <!-- Without focus --> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" /> <!-- Text foreground --> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" /> </Style.Resources> <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> </Style> and I found it few months ago som

Categories : Wpf

Android Listview with Listview item
Instead of using Nested ListViews, you can use Expandable ListView. Here are some useful links for playing with expandable ListView. http://www.dreamincode.net/forums/topic/270612-how-to-get-started-with-expandablelistview/ http://android-adda.blogspot.com/2011/06/custom-expandable-listview.html

Categories : Android

How to get ListView selection color value?
Well the list selector drawable is (usually) transparent in its default state. So you have to change the state first. The pressed state could be used for example: Drawable drawable = context.getResources().getDrawable(android.R.drawable.list_selector_background); drawable.setState(new int[] {android.R.attr.state_pressed}); x.setBackgroundDrawable(drawable); Where x is your view.

Categories : Android

How to disable Gxt ListView selection
I would think ListView.setEnabled(false); should do the job for you. If this doesn't work, you could add a listener for the Select event, and set the ListView's selection to null, though this won't disable selection, but rather undo it.

Categories : Gwt

Go to last item of listview when scrolled up from the first item
Try using, threeDListView.setItemChecked(position, true); threeDListView.smoothScrollToPosition(position); This makes your ListView animate and move to any position selected.

Categories : Android

Is HiddenFor works incorrectly when I clear list item?
I've fixed it but replacing Html helper with simple html like this: @for (int locationIndex = 0; locationIndex < Model.Locations.Count; locationIndex++) { <input type="hidden" name="Locations[@locationIndex].Address" value="@Model.Locations[locationIndex].Address" /> <input type="hidden" name="Locations[@locationIndex].LocationType" value="@Model.Locations[locationIndex].LocationType" /> }

Categories : C#

android: chaotic selection in ListView
Wow, its the first hurdle you face in your first ListView. Don't worry. First of all understand how ListView works, its important. Otherwise you can't master ListView. In simplest word: ListView creates few row Views and utilizes them for every row. So if you have have 50 elements in your ListView then may be only 10 times getView() was called with convertView being null. So in short if you don't update the state of a view inside getView() method for every position, it will really be a chaos. Also please use View Holder Pattern in your ListView. It will drastically increase scrolling and will utilize less resources. More on View Holder Pattern http://www.jmanzano.es/blog/?p=166 UPDATE: I said So in short if you don't update the state of a view inside getView() method for every posi

Categories : Java

difficulties facing with multiple selection in listview
In your ListViewAdapter when creating view for a list item, use setTag() on the "more"-TextView to add its pr_id to it. In more's listener call getTag() to retrieve the right id.

Categories : Android

Listview items selection error when scrolling
The first problem is that you don't setup visibility of your linearLayoutStockDetail. ListView in android reuse view for rows. When you open detail view for row 3 and scroll bottom - android reuse your row number 3. You setup new values for text fields, but don't hide detail view. The second problem, I guess, the same. You don't show tabDetailSetup method, but I think you add tabs everytime. You need to clear old tabs before. Remember, when you are using convertView in adapter, you get old view with their own properies, which you set last time.

Categories : Android

How to set ListView selection from the template element that has focus?
You can use PreviewMouseUp event on a ListViewItem: <ListView Grid.Row="1" ItemsSource="{Binding Ratings}" SelectedItem="{Binding SelectedRating}" Margin="5" MinHeight="50" SelectionMode="Single" ScrollViewer.CanContentScroll="True" local:GridViewSort.Enable="True"> <ListView.Resources> <Style TargetType="{x:Type ListViewItem}"> <EventSetter Event="PreviewMouseUp" Handler="ListViewItem_PreviewMouseUp" /> </Style> </ListView.Resources> <ListView.View> <GridView> ... Code behind: private void ListViewItem_PreviewMouseUp(object sender, MouseButtonEventArgs e) { var listViewItem = sender as ListViewItem; if (listViewItem != null) { listViewItem.IsSe

Categories : Wpf

How to get XAML Listview with full-row selection and correct theme
I've had the same problem. All of my controls uses ExpressionDark theme. This is how I solved this issue: <ListBox HorizontalContentAlignment="Stretch"> <ListBox.ItemTemplate> <DataTemplate> <Grid Background="Transparent"> <!-- here is my custom content --> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> It all started working properly after adding Background="Transparent" attribute in Grid element.

Categories : Xaml

Default Selection of a Row in the ListView and HighLight the slected Row Android
Try this, it should do the trick: your_list_view.post(new Runnable() { @Override public void run() { your_list_view.setSelection(0); } }); UPDATE: Please take a look at this class YourAdapter extends BaseAdapter{ @Override public int getCount() { // TODO Auto-generated method stub return 0; } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return 0; } @Override public Vie

Categories : Android

How to display parameter in a single item's detail and not in a single listview item
If you don't want the description to be shown in the main list, just remove the UI element that represents the description from your res/layout/list-item.xml (it probably would be TextView with id=@description). In that case you won't see the description, but will still be available throught the SimpleAdapter.

Categories : Java

Android - Disable ListView Selection Highlight but Keep OnClick enabled
Just create a drawable that has a transparent color in it, something like this: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:drawable="@android:color/transparent"/> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" /> <item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_light" /> <item android:state_focused="true" android:state_pressed="true" android:drawable=

Categories : Java

Android Listview - setting constraint for specified number of user's selection
you can use a counter in your adapter class and compare it with the maximumNoOfItemToSelect and not allow the user to select if it's greater than maximumNoOfItemToSelect something like this class MyAdapter { int counter=0; ... } when user selects an item counter++; when user deselects an item counter--; before selection check this condition if (counter > maximumNoOfItemToSelect) { //don't select the item }

Categories : Android

ExtJs border layout item selection help needed.
It looks like your reference is not defined correctly. Since userlist is embedded inside a panel (your center region), using viewport > userlist won't work unless you either (1) include the containing panel or (2) remove the >: this.control({ 'viewport > panel > userlist': { itemdblclick: this.editUser, }, ....... or: this.control({ 'viewport userlist': { itemdblclick: this.editUser, }, ....... This is because the > in Ext.ComponentQuery looks only for direct children in the component tree. See here for the docs: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.ComponentQuery

Categories : Javascript

ComboBox Item Selection Works With Keyboard But Not Mouse
I can't really tell what's wrong from your code however, I'd strongly suggest you to use Snoop to debug your controls (http://snoopwpf.codeplex.com/) By holding Ctrl+Shift and pointing the mouse where you ComboBox is supposed to grab the input you would instantly find out who is having the focus instead of your combo box. You can even change the value of a property, really your best friend for debugging your templates ! EDIT I'm afraid but the code you've posted works for me: <Window x:Class="WpfApplication6.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfApplication6="clr-namespace:WpfApplication6" Title="MainWindow" Width="525" Height="3

Categories : C#

MvvmCross : dynamic item template selection for MvxListView
You have to use a custom adapter to do this. A few of the samples show how to use cell type selection. See: polymorphic lists in https://github.com/slodge/MvvmCross-Tutorials/tree/master/Working%20With%20Collections grouped lists in the session list views in https://github.com/slodge/MvvmCross-Tutorials/tree/master/Sample%20-%20CirriousConference e.g. from PolymorphicListItemTypesView.cs protected override View GetBindableView(View convertView, object source, int templateId) { if (source is Kitten) templateId = Resource.Layout.ListItem_Kitten; else if (source is Dog) templateId = Resource.Layout.ListItem_Dog; return base.GetBindableView(convertView, source, templateId); } For Android, there

Categories : Android

How to 'remember' combo selection after inserting new Item (LINQ to SQL)?
What about using a Session to track where you're at and then checking that Session against the logic you want to use? http://wiki.asp.net/page.aspx/57/

Categories : SQL

How to change the ListView selection blue highlight with custom image (not selector)?
Store the clicked item position in your adapter. Like in above function adapter.setPosition(position). Then in getView function of adapter, check if the position is selected one and then change backgroung accordingly

Categories : Android

WPF ListBox with live shaping/grouping - how to keep selection when item is regrouped?
Currently there is no simple solution. I can see two solutions: 1) Manually stop live updates by user. It is error prone to allow work with jumping data. Example: Pause button in WCF log viewer from MS. 2) Before you start to update data remember selected item. When update will finish just return selection. Example: How To Prevent WPF DataGrid From De-Selecting SelectedItem When Items Updated?

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.