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
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: 527
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
 
Read Message
Read Message
Previous Topic: Example: TextToSvgPath - Draw + Paint
Next Topic: Slider Size
Goto Forum:
  


Current Time: Sun May 12 08:36:41 CEST 2024

Total time taken to generate the page: 0.02248 seconds