In my Blackberry application, I have screen with few menu items (created by myself in makeMenu()).
On this screen, sometimes I should remove two of this menu items.
But menu.deleteItem() method does not work.
How i can remove menu item in application menu, without recreate new instance of screen? Is it real for already constructed menu? Or mb I should refresh menu/screen someway?
Thanx.
The menu is drawn at the point it's selected so all I do is set conditions on anything that's not static, example below:
protected void makeMenu( Menu menu, int instance ) {
menu.add(staticMenuItem);
if (condition) menu.add(dynamicMenuItem);
}
Related
I use the side menu (jonkykong / SideMenu) when developing an application for iOS and ran into a problem. I need a menu that will be displayed on all ViewController, everything seems to work, but when you switch to the second controller, a new menu opens with the second controller, but the old menu. The only thing I found in the developer's questions is that it's necessary to destroy the old menu before switching to the second controller, but I have not found it anywhere. The code for my menu is exactly the same as in the example, except for the TableView in the menu itself (the list of menu items is implemented by tables) and the implementation of the standard functions of selecting on the table cell. I am hope for your help. Thank you very much.
Link to the side menu itself:
github.com/jonkykong/SideMenu
Photo1
Photo2
I am trying to add an image next to the hamburger menu in my app. I am using a master detail page and it renders fine in ios and android. I tried using setting the icons for the detail pages. but the icons never showed. How do I achive this. I am looking to add an image similar to the amazon app.
I checked out this app on my phone and it uses a lot of custom constructions that aren't supported by out of the box Xamarin Forms controls. Something like the back arrow next to the hamburger menu is not a standard thing (on iOS at least). Also looking at the actual menu that the hamburger button triggers it becomes clear that its not an out of the box hamburger menu. Theirs pops over the content instead of sliding it out of view as the built-in one does.
More than likely they implemented their own hamburger menu and navigation structure which gave them the freedom to add buttons next to it. If you want to achieve this with out of the box controls you will most likely need custom renderers for each platform to create a replica of this navigation structure.
What is built-in in Xamarin Forms is that you can set the page title to an image instead of text by using the NavigationPage.SetTitleIcon method, which could be used to achieve what you want:
public class MyPage : NavigationPage
{
public MyPage ()
{
var myContentPage = new MyContentPage (Color.White);
this.Push (myContentPage);
var s = "icon.png";
NavigationPage.SetTitleIcon (myContentPage, s);
}
}
Even then, this is limited in functionality. If you want to fiddle with the alignment of the image e.g. you would also need to resort to a custom renderer.
i wanna make a windows database application with c++ builder. The idea is to have a static menu of 6 icons at the top (i need this to be constant in every screen) while the rest of the screen will host all user interactions and data regarding with the selected menu item. I have a litte experiece with SDI apps and as far as i know there is no way the whole application to be in a single screen / form. Should i build this like an MDI app or is there any other way to maintain a fixed icon based menu at top while the rest screen data to change for every different menu item? I dont want to be in a single window with no overlaping forms while user navigates through the application.
Although an MDI application is definitely possible, the interaction between the different forms sometimes is a little cumbersome. A tabbed page is easier to handle since everything then resides within the same TForm class.
If you want to change the appearance of the individual tabs you can overload the 'PageControlDrawTab' Just add an event handler, get a handle to the Canvas of the tab itself and you are free to draw is as you want. See the example below:
void __fastcall TMainForm::PageControlDrawTab(TCustomTabControl *Control,
int TabIndex, const TRect &Rect, bool Active)
{
/* OnDraw handler to change the appearance of the Tabs.
Change it to blue text on white background.
*/
String s;
TRect r;
TTabControl * tTab = (TTabControl *)Control; // Get a pointer to the tab itself
s = tTab->Tabs->Strings[TabIndex]; // Retrieve the text of this tab
Control->Canvas->Brush->Color = clWhite; // Use the Canvas to draw
Control->Canvas->Font->Color = clBlue; // .. whatever you like
Control->Canvas->FillRect(Rect);
Control->Canvas->TextRect(Rect,Rect.Left+4,Rect.Top+2,s);
}
You will probably have to do it in a MDI format. I do not know of any way to share the menu across forms. The other option you could use though is to use a page control and have all the other "forms" live in a tab so the menu is the same all the time. The menu items could respond differently if you would like them to when the user is on a different tab, or they could do the same thing no matter what tab you are on. Sorry this is the form of an answer, I don't have comment rights yet.
I build an app using smartGWT (3.1) (GWT: 2.5).
To hold changes to the various views (scrollbar-position in ListGrids etc.) I add all the views to the main canvas and just change their visibility (show() / hide())
(hide() all children then show() the one which was selected in the menu)
This works fine until I use hichcharts (gwt.highcharts-1.5.0.jar / highcharts.js -> 2.3.5).
no difference if I wrap the Chart in a smartGWT or GWT widget, when I hide the views some elements of the chart stays visible.
Ledgend-background, Ledgend-lines, and some dots from the data-points stays visible. It happens in firefox 18.0.2 and IE 9. In Chrome (24.0.1312.57 m) it works.
I try TabSet aswell. when i switch tabs (which should hide the 'old' tab) the same elements of the chart stays visible.
besides of the visibility-problem the still active Listener from the chart are another problem.
summary:
highcharts chart do not hide proper when parent-widgets hide (in firefox & IE).
For the display issues, and since you didn't provide any code example, I have used the wrapper provided on GWT Highcharts forum. With correct usage of hide/show calls (e.g. when tab is selected or deselected, call show or hide, respectively) I have managed to overcome the issue described in all browsers.
I had the same issue. I solved it by adding a tabSelectedHandler to the tabSet and inside that I show or hide the charts using StockChart.setVisible(boolean) depending on the selected tab.
tabSet.addTabSelectedHandler(new TabSelectedHandler()
{
#Override
public void onTabSelected(TabSelectedEvent event)
{
if (event.getTab().getTitle().equals("Charts"))
{
chart.setVisible(true);
}
else
{
chart.setVisible(false);
}
}
});
I am working on a project where I need to display a ListField that takes the top half of the screen when the user clicks on a menu item. It should display on top of the earlier screen. How can I implement it?
Here are my ideas:
Use ListField directly with the above screen size to required screen.
Use PopupScreen with ListField
Use some screensplit functionality to display half of the screen
PopupScreen is best fit for your question. Can you try and post the code that didn't work?
Another option is to use managers to split the screen (higher manager and lower manager) and to hold another two managers: one that will be displayed on click and one that will be used as a pointer to the displayed Manager. Then, when ever the replace event is fired you should call the following function:
void updateManagers(boolean click)
{
if(click)
{
currentManager = afterClickManager;
}
else
{
currrentManager = beforeClickManager;
}
invalidate();
}
Where currentManager is an instance of Manager and afterClickManager & beforeClickManager are instances of some class which extends Manager (no need to be the same class).
Note that you should add currentManager to your screen layout before using the invalidate function.