Mutually exclusive checkable menu items?

This may not be what you’re looking for, but you could write an extension for the MenuItem class that allows you to use something like the GroupName property of the RadioButton class. I slightly modified this handy example for similarly extending ToggleButton controls and reworked it a little for your situation and came up with … Read more

Android adding a submenu to a menuItem, where is addSubMenu()?

Sometimes Android weirdness is really amazing (and amusing..). I solved it this way: a) Define in XML a submenu placeholder like this: <item android:visible=”true” android:id=”@+id/m_area” android:titleCondensed=”Areas” android:title=”Areas” android:icon=”@drawable/restaur” android:enabled=”true”> <menu> <item android:id=”@+id/item1″ android:title=”Placeholder”></item> </menu> </item> b) Get sub menu item in OnCreateOptionsMenu, clear it and add my submenu items, like this: public boolean onCreateOptionsMenu(Menu menu) … Read more

How to display menu item with icon and text in AppCompatActivity

@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.menu_patient_home_screen, menu); menu.add(0, 1, 1, menuIconWithText(getResources().getDrawable(R.mipmap.user_2), getResources().getString(R.string.action_profile))); menu.add(0, 2, 2, menuIconWithText(getResources().getDrawable(R.mipmap.add_user), getResources().getString(R.string.action_add_user))); menu.add(0, 3, 3, menuIconWithText(getResources().getDrawable(R.mipmap.switch_profile), getResources().getString(R.string.action_switch_profile))); menu.add(0, 4, 4, menuIconWithText(getResources().getDrawable(R.mipmap.logout), getResources().getString(R.string.action_sign_out))); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle … Read more

Set anonymous/dynamic functions to Menu

Summary: Google apps script runs in a stateless environment. Anything stored in global object is not maintained across sessions. If you add something to the global object during a session, it is not available in the next session run. Use Immediately Invoked Functions or Call functions in global scope to fill the global scope(this object) … Read more

How can I dynamically create menu items?

How to Dynamically Add Menu Items to an Android Activity public class yourActivity extends Activity { … private static final int MENU_ADD = Menu.FIRST; private static final int MENU_LIST = MENU.FIRST + 1; private static final int MENU_REFRESH = MENU.FIRST + 2; private static final int MENU_LOGIN = MENU.FIRST + 3; /** * Use if … Read more

Android : Get view Reference to a Menu Item

You can achieve this by providing your menu item with an actionViewClass property in xml and then you will be able to get the pivot view u wanted. The code would be something like this <item android:id=”@+id/menu_find” android:showAsAction=”ifRoom” android:actionViewClass=”android.widget.ImageButton” /> In your OnCreateOptionsMenu do this public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_search, menu); locButton = … Read more

Android: How to enable/disable option menu item on button click?

Anyway, the documentation covers all the things. Changing menu items at runtime Once the activity is created, the onCreateOptionsMenu() method is called only once, as described above. The system keeps and re-uses the Menu you define in this method until your activity is destroyed. If you want to change the Options Menu any time after … Read more

WPF – How can I create menu and submenus using binding

For me, it worked with this simple template: <Menu.ItemContainerStyle> <Style TargetType=”{x:Type MenuItem}”> <Setter Property=”Command” Value=”{Binding Command}” /> </Style> </Menu.ItemContainerStyle> <Menu.ItemTemplate> <HierarchicalDataTemplate DataType=”{x:Type local:MenuItemViewModel}” ItemsSource=”{Binding Path=MenuItems}”> <TextBlock Text=”{Binding Header}”/> </HierarchicalDataTemplate> </Menu.ItemTemplate> Here is the complete example: MainWindow.xaml: <Window x:Class=”WpfApplication14.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:local=”clr-namespace:WpfApplication14″ Title=”MainWindow” Height=”350″ Width=”525″> <DockPanel> <Menu DockPanel.Dock=”Top” ItemsSource=”{Binding MenuItems}”> <Menu.ItemContainerStyle> <Style TargetType=”{x:Type MenuItem}”> <Setter Property=”Command” … Read more

Sql Server ‘Saving changes is not permitted’ error ► Prevent saving changes that require table re-creation

From Save (Not Permitted) Dialog Box on MSDN : The Save (Not Permitted) dialog box warns you that saving changes is not permitted because the changes you have made require the listed tables to be dropped and re-created. The following actions might require a table to be re-created: Adding a new column to the middle … Read more

tech