Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Howto create control-collection -control? [SOLVED -good example]
Re: Howto create control-collection -control? [message #1692 is a reply to message #1684] |
Mon, 13 March 2006 22:04 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
wilho wrote on Mon, 13 March 2006 14:42 | Ok, here we go again:
class DblClckBtn : public Button {
public:
Callback WhenLeftDouble;
virtual void DblClckBtn::LeftDouble(Point, dword);
};
class ExpressPane : public Ctrl {
struct SlaveControl {
bool isInSplitter;
DblClckBtn button;
Ctrl* slave;
};
Array<SlaveControl> slaves;
Splitter splitter;
static const int BTN_SPACE = 22;
typedef ExpressPane CLASSNAME;
void Toggle(int);
void OpenOne(int);
public:
void Add(const char *text, Ctrl& slave);
void Rearrange();
ExpressPane();
};
void DblClckBtn::LeftDouble(Point p, dword) {
if(IsReadOnly()) return;
WhenLeftDouble();
}
ExpressPane::ExpressPane(){
Ctrl::Add(splitter);
splitter.Vert();
}
void ExpressPane::OpenOne(int indx){
for(int loopI=slaves.GetCount()-1; loopI>-1; loopI--){
slaves[loopI].isInSplitter = false;
}
slaves[indx].isInSplitter = true;
Rearrange();
}
void ExpressPane::Toggle(int indx){
slaves[indx].isInSplitter = !slaves[indx].isInSplitter;
Rearrange();
}
void ExpressPane::Rearrange(){
for(int loopI=slaves.GetCount()-1; loopI>-1; loopI--){
splitter.RemoveChild( slaves[loopI].slave );
if (slaves[loopI].isInSplitter == true){
splitter << *slaves[loopI].slave;
}
}
splitter.RefreshLayout();
}
void ExpressPane::Add(const char *text, Ctrl& slave){
SlaveControl& slvCtrl = slaves.Add();
int btnIndx = slaves.GetCount()-1;
slvCtrl.button <<= THISBACK1(Toggle,btnIndx);
slvCtrl.button.WhenLeftDouble << THISBACK1(OpenOne,btnIndx);
slvCtrl.button.SetLabel(text);
slvCtrl.button.HSizePosZ(0, 0).BottomPosZ(BTN_SPACE * (btnIndx), BTN_SPACE -2);
slvCtrl.isInSplitter = false;
slvCtrl.slave = &slave;
splitter.HSizePosZ(0, 0).VSizePosZ(0, BTN_SPACE * (btnIndx+1));
Ctrl::Add(slvCtrl.button);
}
Here's rearrange and some use for it in form double-click feature. And I finally got the !visible hint
|
Well, now this actually looks like some U++ code
Mirek
|
|
|
|
|
Howto create control-collection -control? [SOLVED -good example]
By: wilho on Tue, 07 March 2006 22:45
|
|
|
Re: Howto create control-collection -control?
By: mirek on Tue, 07 March 2006 23:32
|
|
|
Re: Howto create control-collection -control?
By: wilho on Sat, 11 March 2006 18:09
|
|
|
Re: Howto create control-collection -control?
By: mirek on Sat, 11 March 2006 18:43
|
|
|
Re: Howto create control-collection -control?
By: wilho on Sat, 11 March 2006 19:33
|
|
|
Re: Howto create control-collection -control?
By: mirek on Sat, 11 March 2006 20:39
|
|
|
Re: Howto create control-collection -control?
By: wilho on Sun, 12 March 2006 11:25
|
|
|
Re: Howto create control-collection -control?
By: mirek on Sun, 12 March 2006 12:47
|
|
|
Re: Howto create control-collection -control?
By: wilho on Mon, 13 March 2006 20:42
|
|
|
Re: Howto create control-collection -control?
By: mirek on Mon, 13 March 2006 22:04
|
|
|
Re: Howto create control-collection -control?
By: fudadmin on Tue, 14 March 2006 18:05
|
|
|
Re: Howto create control-collection -control?
By: wilho on Tue, 14 March 2006 19:23
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: kbyte on Tue, 07 April 2009 10:53
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: mrjt on Tue, 07 April 2009 12:10
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: kbyte on Tue, 07 April 2009 15:29
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: kbyte on Tue, 07 April 2009 15:36
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: mrjt on Wed, 08 April 2009 10:52
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: kbyte on Wed, 08 April 2009 11:46
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: mrjt on Wed, 08 April 2009 16:05
|
|
|
Re: Howto create control-collection -control? [SOLVED -good example]
By: kbyte on Thu, 09 April 2009 10:26
|
Goto Forum:
Current Time: Mon May 20 15:59:21 CEST 2024
Total time taken to generate the page: 0.00862 seconds
|