How to change opacity of a Xul element at runtime? - transparency

I've tried
document.getElementById("myId").style = "opacity: 0.5";
but it didn't work:
Error: setting a property that has
only a getter
Also looks like there's no "opacity" attribute or parameter (in the box or window element).
Any idea?

Try setting the style as an attribute
document.getElementById("myId").setAttribute("style", "opacity: 0.5");

The opacity is a property of the style property i.e.
document.getElementById("myId").style.opacity = 0.5;

Related

How to change the visibility of a TextField (native library), i.e. make it invisible, in Corona SDK

Is it possible to make a TextField (for the Corona SDK native library) invisible? If so, then how? The isVisible property does not seem to work.
For example, if I create a TextField instance like this:
local textIngrediente1 = native.newTextField(...)
when I try to make it invisible by setting the isVisible property like so:
textIngredient1.isVisible = false
it has no effect on the visibility of the TextField.
native.newTextField() does honor the .isVisible property. I just tested it. You likely have an error if you copy and pasted your code:
--local textIngrediente1 = native.newTextField(...)
-- textIngredient1.isVisible = false
In one you use textIngrediente1
In the other you use textIngredient1 (no extra e)
You can't use the isVisible, and alpha properties except for display objects..
But you can set your textField off the screen and then change the x,y coordinates when you need to show the textField..
local text= native.newTextField( ... )
text.x = -100
text.y = -100
then when you need to use or show the textField object
text.x = 100
text.y = 100
I think this will do the trick
According to the Corona documentation, TextField objects inherit properties from NativeDisplayObjects which inherit properties from DisplayObjects, including the isVisible property, so (as long as there are no typos ;-) ) this will control the visibility of the TextField.

Is there a way to wire up a color to a variable?

I would like to 'wire' up a 'color' variable to the an imported svg. I would like to change the color of a variable of the fill with a Stylekit method.Is there a way to do so?
You can set it as a variable or pass it in as a parameter, using the drop down when editing a color.

How to set a CSS background-image with URL in Dart?

I'm trying to find a equivalent to jQuery.css() method
In my specific case, I want to set a background image for a canvas.
in jQuery, it would be:
$("#canvas").css("background-image", "url(./assets/gridPattern.png)");
It is possible to acess CSS properties via the style attribute in Element
query("#canvas").style.backgroundImage = "url(./assets/gridPattern.png)";

How to dynamically change TChart's Panel's color in Delphi?

While in IDE Panel's parameters are shown in Chart->Panel->Parameters (e.g. color). I can't use this method in code though: Chart.Panel.Color:=RGB(0,0,0);//doesn't work Any advice would be appreciated.
Use the Color property, e.g., Chart1.Color := clYellow.

TPopupActionBar has no ColorMap property?

Ok, so I almost have a good looking UI, using TActionManager, TActionMainMenuBars and TToolBar with DrawingStyle as gradient to create a OfficeXP style interface.
I am using a couple of TPopupActionBar popup menus too, but I dont see a ColorMap property. I am using a ColorMap property to change the color of the default XP style color, and also changing the Hot Color of the TToolBar to match the menu.
I now need the TPopupActionBar popup menu to match the menu and toolbar, but how can I do this when I see no way of assigning a ColorMap to it?
Excuse me if this is non trivial, I have looked and cannot see. I also tried at runtime to assign a ColorMap but there doesnt seem to be the property for it?? I can change the Style of the TPopupActionBar, but cannot assign a ColorMap.
To assign a ColorMap you can use the OnGetControlClass event of the TPopupActionBar component , then check if the PopupMenu is not nil and finally assign the nested property ColorMap of this property.
check this sample.
procedure TFormMain.PopupActionBar1GetControlClass(Sender: TCustomActionBar;
AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
begin
if Assigned(PopupActionBar1.PopupMenu) then
PopupActionBar1.PopupMenu.ColorMap:= TwilightColorMap1;
end;
check this image which contains a TPopupActionBar with the TwilightColorMap applied

Resources