Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » A couple of noob questions
A couple of noob questions [message #59172] Mon, 14 November 2022 06:15 Go to next message
Crazycarppy is currently offline  Crazycarppy
Messages: 1
Registered: November 2022
Junior Member
I am new to U++ and fairly new to c++.
I have read much of the documentation and examples provided on the website, and even understood some of it.

In my first attempt at making an app I found that I can't seem to figure out a couple of things.
1 How do I add items to a droplist after its been added to a layout in the designer? With the rest of the windows working it is Grey and mousing over it does nothing. I have looked at the examples I could find that use a dropkist but couldn't discern a clear answer.

2.my app starts on one layout and I want it to change depending on user input(button presses). I can get it to open a new window with the new layout, but I can't get the old one to close. I assume there is a way to do this? Alternatively is there a way to redraw the window using a new layout without opening a new window?

Thank you for any and all help in advance.
Re: A couple of noob questions [message #59183 is a reply to message #59172] Wed, 16 November 2022 15:09 Go to previous message
Lance is currently offline  Lance
Messages: 534
Registered: March 2007
Contributor
Hi Crazycrappy:

Welcome to U++ commnity.

The first, suppose you add a DropList with name dlist in TestLayout in some layout file. In the ide, select the layout file, and then press key combination `CTRL+N` to display the layout file as C++ code. Yes, a layout is just a C++ template. You will see something like this.
LAYOUT(TestLayout, 384, 248)
	ITEM(Upp::DropList, dlist, LeftPosZ(52, 232).TopPosZ(120, 19))
END_LAYOUT


Now you can edit this file, but proceed with caution. Do something like this:
LAYOUT(TestLayout, 384, 248)
	ITEM(Upp::DropList, dlist,
            Add("Item 1 in layout designer")
                .Add("Item 2 in layout designer")
                .LeftPosZ(52, 232).TopPosZ(120, 19))
END_LAYOUT


CAUTION: Above should have worked, but there is a problem. `CTRL+N` again to switch to visual layout designer and then `CTRL+N` back again, you will notice your code becomes.
LAYOUT(TestLayout, 384, 248)
	ITEM(Upp::DropList, droplist, Add("item 2 in layout").LeftPosZ(52, 232).TopPosZ(120, 19))
END_LAYOUT


The "item 1" simply vanished. I cannot tell for sure, but I suspect this is a bug. There is nothing you and me can do about it atm. So add the list in the constructor instead. Some thing like this:
#include "TestLayoutDropListItems.h"

TestLayoutDropListItems::TestLayoutDropListItems()
{
	CtrlLayout(*this, "Window title");
	droplist.Add("item 1")
             .Add("item 2").Add("item 3");
}

GUI_APP_MAIN
{
	TestLayoutDropListItems().Run();
}


The second question, I remember somebody asked not long ago and i have answered that, maybe not to his satisfaction. Let me do a quick search.

Happy coding!

BR,
Lance
Previous Topic: Example: TextToSvgPath - Draw + Paint
Next Topic: Slider Size
Goto Forum:
  


Current Time: Sun Jun 16 21:56:17 CEST 2024

Total time taken to generate the page: 0.02561 seconds