For now I have implemented the second option:
override public function set
content(value:org.apache.royale.core.UIBase):void
{
if(content != value)
{
super.content =
value;
content.className="jewel contextmenupopupcontent";
}
}
This is the result [1]
[1]
https://drive.google.com/file/d/1qoeo_p4L4rcuk45DDwy_Ph4w6k-dj9Gv/view?usp=sharing
Hiedra
-----Mensaje original-----
De: Maria Jose Esteve <[email protected]>
Enviado el: martes, 21 de diciembre de 2021 23:41
Para: [email protected]
Asunto: New Jewel ContextMenuPopUp
Hi, I need some advice...
I'm trying to implement a ContextMenuPopUp, similar to the current Jewel PopUp
but without background color and whose positioning is based on mouse
coordinates.
In this first attempt I have extended ContextMenuPopUp from PopUp to be able to
change the typeNames and className of "content" and some other things like
changing the IBeadView to a new ContextMenuPopUpView or IBeadController to a
new ContextMenuPopUpMouseController.
My problem is when I override the setter of "content" because the variable
"_content" is private in PopUp:
In Jewel PopUp.as:
public function PopUp()
{
super();
typeNames = "jewel popup";
}
public function set content(value:UIBase):void
{
if(_content != value)
{
_content = value;
_content.className="jewel popupcontent";
}
}
In ContextMenuPopUp.as:
public function ContextMenuPopUp()
{
super();
typeNames = "jewel
contextmenupopup";
}
override public function set
content(value:org.apache.royale.core.UIBase):void
{
if(_content != value)
{
_content = value;
_content.className="jewel contextmenupopupcontent";
}
}
But sure, I can't refer to _content because it is private in the base class.
The options I'm shuffling:
- Change the scope from private to protected in PopUp.as and leave the code
that I have shown above.
- Change the override to something like this: (work)
override public function set
content(value:org.apache.royale.core.UIBase):void
{
if(content != value)
{
super.content =
value;
content.className="jewel contextmenupopupcontent";
}
}
- Or, clone PopUp.as and change what I need directly.
How would you extend PopUp?
Hiedra