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 » U++ Library support » U++ Widgets - General questions or Mixed problems » SplitterFrame: How to build this? (SplitterFrame and how it works)
SplitterFrame: How to build this? [message #50863] Fri, 11 January 2019 00:49 Go to next message
imos is currently offline  imos
Messages: 11
Registered: July 2017
Promising Member


Hi!
I would like to build a GUI app with the following macro details:

Tree | Layout/controls
|
|
|
________________
ArrayCtrl

However I can not get this using 2 SplitterFrame2:

SplitterFrame sfHor;
ArrayCtrl list;
SplitterFrame sfVert;
TreeCtrl tree;

typedef App CLASSNAME;
TopWindow app;
App()
{
CtrlLayoutOKCancel(*this, "Test SplitterFrame");
tree.SetRoot(CtrlImg::Dir(), "Data Channels");
AddFrame(sfVert.Bottom(list,200));
sfHor.Left(tree, 200);
//sfVert.Top(sfHor,200); //Error!
sfVert.SizeMin(100).MinSize(100);
Sizeable();
}

This code shows a listview on the bottom and the layout on the top. But I did not set any content for the top. Why is layout set automatically to the top?

In fact I need to create controls during runtime and not design them during development time. So the layout is not the right option, right? A kind of empty containner would be better, right?
But I can not find any container to use (such as panel in Java). Is it possible to add new controls to an empty layout during runtime?

Thanks a lot
Re: SplitterFrame: How to build this? [message #50865 is a reply to message #50863] Fri, 11 January 2019 09:28 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 533
Registered: August 2007
Location: Turkey
Contributor
Hello, imos

Layouts are not objects, they are simply visual representations (in theIDE) of your predefined widgets (It is c++ code) and they are added dynamicially, as in your code:

CtrlLayoutOKCancel(*this, "Test SplitterFrame"); 


Above code (and other variants of CtrlLayout() function) simply adds and intializes a set of predefined widgets (visually represented as a "layout") to the given Ctrl. (In your case it is referenced by *this, which is a TopWindow. You can also assign layouts to other Ctrls.).
You can modify (add, remove, move position, change their properties etc) the widgets in your layout in runtime, as you like.

You can even define multiple layouts and use them interchangebly in runtime.


I can not find any container to use (such as panel in Java). Is it possible to add new controls to an empty layout during runtime?


Yes, see the above answer. Smile

And you can use ParentCtrl. It is meant to be a container, for grouping widgets.


Best regards,
Oblivion

[Updated on: Fri, 11 January 2019 09:41]

Report message to a moderator

Re: SplitterFrame: How to build this? [message #50878 is a reply to message #50863] Fri, 11 January 2019 15:25 Go to previous messageGo to next message
imos is currently offline  imos
Messages: 11
Registered: July 2017
Promising Member
Thanks for the explanations, but How to get this GUI skeleton:

Tree | Layout/controls
     |
     |
     |
________________
ArrayCtrl at bottom



using 2 SplitterFrames?

Why does "CtrlLayout" stays in the top of the first SplitterFrame if I did nothing to achieve that (according to the privided source code)?
Why can not I add first horizontal SplitterFrame to the top of vertical split frame?

Thanks

[Updated on: Fri, 11 January 2019 15:26]

Report message to a moderator

Re: SplitterFrame: How to build this? [message #50887 is a reply to message #50878] Fri, 11 January 2019 23:10 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 533
Registered: August 2007
Location: Turkey
Contributor
Hello imos,

In such cases you shoud try Splitter instead of SplitterFrame, as it seems to be what you need and is more flexible.

Please find attached a simple example that demonstrates the requested behaviour. (I was lazy, so I used a DocEdit instead of TreeCtrl).
It also demonstrates a simple way of adding a widget to the layout dynamically.

Best regards,
Oblivion

[Updated on: Fri, 11 January 2019 23:11]

Report message to a moderator

Re: SplitterFrame: How to build this? [message #50891 is a reply to message #50863] Sat, 12 January 2019 18:20 Go to previous message
imos is currently offline  imos
Messages: 11
Registered: July 2017
Promising Member
Great example! Thank you!

It is what I was looking for. Just one more question/detail Wink

Imagine that I want to create multiple widgets during runtime or even just one but a large one, such as:


pctrl.Add(button.SetLabel("Added button!").LeftPos(10, 150).TopPos(100, 1140));


Is it possible to configure "WithContainerLayout<ParentCtrl>" with vertical scroll bar in order to be possible to see the whole button?

Thanks
Imos
Previous Topic: Framebuffer backend compilation errors
Next Topic: ScatterCtrl: How to control X axis ticks and tags automatically?
Goto Forum:
  


Current Time: Sun Jan 20 15:45:59 CET 2019

Total time taken to generate the page: 0.00685 seconds