Home » Community » U++ community news and announcements » 2022.3
Re: 2022.3 [message #59480 is a reply to message #59477] |
Wed, 04 January 2023 10:22   |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi Mirek (and happy new year, btw!),
Im'using the ListObject() too... here is the code in my control constructor:
PopUpList &pt = ListObject();
prevListSelect = pt.WhenSelect;
pt.WhenSelect = THISBACK(listSelectCb);
and in the handler:
// catches selections on popuplist
// to handle changes in layer's properties
void LayersDrop::listSelectCb(void)
{
// get clicked point
Point p = ::GetMousePos() - GetScreenRect().TopLeft();
int col;
if(p.x < 24)
col = 0;
else if(p.x < 48)
col = 1;
else
col = 3;
int iLine = ListObject().GetCursor();
// if no line clicked or clicked on name, normal behaviour
// of current layer selection
if(IsNull(iLine) || col == 3)
{
prevListSelect();
return;
}
// clicked on an item, just call given callback
// and repost a drop on list
Value v = GetValue(iLine);
LayerData ld = ValueTo<LayerData>(v);
if(col == 0)
ld.on = !ld.on;
else if(col == 1)
ld.locked = !ld.locked;
v = RawToValue(ld);
SetValue(iLine, v);
WhenToggle(ld.name, ld.on, ld.locked);
PostCallback(THISBACK(Drop));
}
Here the effect :

You can open the droplist, click on layer name (third column) and the list behaves as usual (the layer is selected and list is closed), but if you click on first 2 columns (layer ON/OFF and layer LOCK/UNLOCK) the list stay open but the state of item is toggled.
By now I solved by the usual "#define private protected" trick before including CtrlLib and re-adding the ListObject() function in my control. Not a very nice way... and I must disable blitz for this package.
It would be nice to have the ListObject() function again, or at least to put the 'list' item as protected instead of private...
-
Attachment: layers.png
(Size: 29.06KB, Downloaded 530 times)
|
|
|
 |
|
2022.3
By: mirek on Thu, 29 December 2022 09:26
|
 |
|
Re: 2022.3
By: Tom1 on Thu, 29 December 2022 10:16
|
 |
|
Re: 2022.3
By: zsolt on Thu, 29 December 2022 11:15
|
 |
|
Re: 2022.3
By: Klugier on Thu, 29 December 2022 11:43
|
 |
|
Re: 2022.3
By: unodgs on Thu, 29 December 2022 23:20
|
 |
|
Re: 2022.3
By: Lance on Fri, 30 December 2022 00:47
|
 |
|
Re: 2022.3
By: Oblivion on Fri, 30 December 2022 04:37
|
 |
|
Re: 2022.3
|
 |
|
Re: 2022.3
By: Klugier on Fri, 30 December 2022 18:44
|
 |
|
Re: 2022.3
|
 |
|
Re: 2022.3
By: mirek on Sun, 01 January 2023 16:48
|
 |
|
Re: 2022.3
|
 |
|
Re: 2022.3
By: mirek on Tue, 03 January 2023 10:35
|
 |
|
Re: 2022.3
|
 |
|
Re: 2022.3
By: mirek on Tue, 03 January 2023 23:26
|
 |
|
Re: 2022.3
By: mdelfede on Wed, 04 January 2023 10:22
|
 |
|
Re: 2022.3
By: mirek on Wed, 04 January 2023 11:36
|
 |
|
Re: 2022.3
By: mdelfede on Wed, 04 January 2023 16:10
|
 |
|
Re: 2022.3
|
Goto Forum:
Current Time: Fri Jul 04 20:50:51 CEST 2025
Total time taken to generate the page: 0.03835 seconds
|