Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Proper SplitterFrame removal++
Proper SplitterFrame removal++ [message #58221] |
Mon, 28 March 2022 08:51  |
luoganda
Messages: 190 Registered: November 2016
|
Experienced Member |
|
|
1st question is more about c++, but anyway:
I have this struct.
struct SCtrl:Ctrl{
void Paint(Draw& w)override{
...
}
};
Array<Ctrl> ctrls;
Array<SCtrl> sctrls;
ctrls.Create<Button>(); //this is ok
sctrls.Create<Button>(); //this produces error(no matching member function for call to 'Add')
Can the last one be done, so that SCtrl is somehow subclassed but still used as Ctrl to be used as Button,...?
Any idea how to do this properly? maybe provide copyCtor?
~~~~
2nd question:
Simple app is included in attachment.
I would want a layout design something like foobar2000(win) or deadbeef(linux) has.
Could someone check that and try to correct it
and do it properly - since i don't know fully how SplitterFrame works and how i would do this properly.
When i add frames - it's ok(altough now childFrames are added and are children of parent ctrls - which when clicking on parent and removing it - children are then also removed, i would want to remove only SplitterFrame on which i click->Remove, but for this nonChildren would probably need to be used - siblings - altough i don't know if this is possible with SplitterFrames to do it properly).
When i remove it - problems happens, see and try code.
How to properly remove frames?
if i call sc->spl.FrameRemove(); instead of par->RemoveFrame(sc->spl) i get segmentation fault via repaint(this is called from SCtrl::RightUp...)
pwnd points to global main window,
when called from childCtrl - pfrom points to that from SCtrl::RightUp
SCtrl& AddSplitter(int where,Ctrl *pfrom){
//SSplitterFrame& spl=splitters.Create<SSplitterFrame>();
//spl.FrameAdd(InsetFrame());
SCtrl& sc=ctrls.Create<SCtrl>();
sc.spl.Set(sc.SizePos(),100,where);
if(!pfrom)pfrom=pwnd; sc.frmid=pfrom->GetFrameCount();
pfrom->AddFrame(sc.spl);
return sc;
}
void NewPanel(int where,Ctrl *pfrom){
SCtrl&ctrl=AddSplitter(where,pfrom);
//ctrl.ctrl.Create<Button>();
//Button&b=*(Button*)ctrl.ctrl.Get();b.SetLabel("Marana");b.LeftPos(20,100);b.TopPos(20,40);
////ctrl.ctrl->Add(b);
}
|
|
|
Goto Forum:
Current Time: Wed Oct 04 23:05:33 CEST 2023
Total time taken to generate the page: 0.01962 seconds
|