i am currently working on an App for Win CE 5.0 and every Form start on my device with a bar over every object on my form.
Does anyone know something about this?
Better how to remove it...
That's a Form MainMenu with no items in it. Just remove the MainMenu item from each of the Forms (or the base Form if they all derive from a common parent).
Related
I've been building my Codename One app for the phone screen format so far. There is a separate Form for the main menu, then a second Form with a list of elements, and then a third Form to edit an element selected from the list. Each Form has an overflow menu and various Titlebar command buttons. And each (Extended) Form has a lot of code that implements the functions in the Form and shares variables etc.
However, to use the tablet (iPad) screen estate, I would like to show the main menu on the left of the screen, the list of elements in the middle and the element edit form on the right. Something similar to the screenshot below. This seems to be a common type of layout on tablets and suits my app usage pattern well.
However, I don't see an elegant way of structuring the code to do this. I can't easily combine the list and edit Forms into one Form, and writing a completely new Form just for the tablet format would be a lot of work. I assume others have faced the same challenge and would love to hear how you achieved this.
PS. I know the side menu can be made permanent but that only solves part of the problem, not how to show a list and edit Forms at the same time.
There is no one answer for this but if you look at apps like Codename One Build you would notice they adapt to this form factor.
We usually just use isTablet() to adapt the UI at key points to the different form factor. One element is the permanent side menu which we turn on in the init method using code like this:
if(Display.getInstance().isTablet()) {
Toolbar.setPermanentSideMenu(true);
}
It makes the side menu stay open all the time. Within the code we try to use Container instead of Form. This allows us to package multiple logical pieces into a single UI for the tablet mode.
I have been trying lately to have one constant menu for all the screens, but I couldn't find any solution for that! The only solution was to copy the menu code and paste it in every single screen with their click events code. Do you have any ideas about this?
I want one stable / constant menu in my whole project.
Thanks.
Approach 1: You can create a user control that wraps whole menu and its item commands. This seems more proper, flexible and straightforward approach than 2nd one below. Get started on how to create user controls in WPF.
Approach 2: Have a one main window in application with a Menu and a Frame that will host rest of the views of your application. These views will be result of the menu item command. Frame and Page are generally used in application where navigation is desired. For your case I repeat Approach 1 suits and sound logical more.
I am working on a WinForm Application.
The Form has many fields/components but is poorly built.
for example a field is used as user name on one case and used as folder path on the other case. Code is quite poorly maintaned.
Is is possible that when i run the application and GUI appears, i can use a tool like 'spy++' which can show me 'names' of the components (not ids). For instance the name of a button or name of a label.
Or if i can use SPY++ for 'names' please tell me?
I would solve the problem by adding a ToolTip control to your form and iterating over each control and adding a Tool Tip message to each control that is the name of the control.
First, add a ToolTip object to your form (from the Tools section of the designer.) You can rename it, but for the sake of my demo, I left it as the default name toolTip1.
Next, add a method similar to the one I'm posting below to the code page of your form. (I'm assuming this is for C# but the code is simple and can easily be modified for VB or C++).
public void AddNameToToolTip(Control c)
{
toolTip1.SetToolTip(c, c.Name);
foreach (Control child in c.Controls) AddNameToToolTip(child);
}
Finally, from within the Form constructor, add the following line of code after the call to InitializeComponent().
AddNameToToolTip(this);
This will add a ToolTip message to each control in your form. All you should have to do is hover your mouse over each control and the ToolTip will pop up a message after a second or two displaying the name of the underlying control.
Alternatively, you can recursively adding a MouseHover event to each control and when the event is fired, write the name of the control to the debugger. This would also work if you are already using a ToolTip control within your form.
Lets say i have created a small game with XNA. Now i can change the windows attributes of the Game by simply obtaining its Form Object by casting & do stuff with it as i can do with normal C# form.
Form MyGameForm = (Form)Form.FromHandle(Window.Handle);
MyGameForm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
now i want that this window(Form) should Always-on-Bottom, complete opposite of Always-on-Top. Meaning the window should stay on the back and never take focus even if i interact with it.
i don't know how to do it but for other stuff in C# we override that function and process whatever we want and return false. For input n text boxes etc. but i don't know how to over ride form focus method or what sets form to on top or bottom or at any index in opened windows on desktop.
no need for it now, i have got the solution, i will simple avoid animating all the stuff for my self and use something that they already built, Windows Dreamscene.
i am developing an application in which there are many form i want to get a colletion of all these forms which are in open or hide state. how would i implement this.
This will help you get all forms opened by the application
FormCollection col = Application.OpenForms;
In .net 4.0 there is still a defect with Application.OpenForms. The form will be removed from the list of forms when changing ShowInTaskbar property. Use Application.OpenForms if you are sure that they do not change ShowInTaskbar. Otherwise think about managing your own OpenForms collection