How can I change (from JavaScript) the title of a XUL window? - xul

In a xulrunner app, I seem to be unable to set the title from JavaScript. I have tried setting in these two ways:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="mywindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="go();">
<!-- your code here -->
<script type="application/x-javascript">
<![CDATA[
function go(){
document.getElementById("mywindow").title="blar";
document.getElementById("mywindow").setAttribute("title","blar");
}
]]>
</script>
</window>
DOM Inspector shows that the title attribute does get updated, but it does not show up on screen.

[CDATA[
function entry_onLoad()
{
document.title = "MyTitle"
}
addEventListener("load", entry_onLoad, false)
]]>
This works

It appears that after the page loads one cannot change the window. If there is a way, I'd be interested to know it.. but this does work:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="mywindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
<script type="application/x-javascript">
<![CDATA[
function go(){
document.getElementById("mywindow").title="blar";
}
go();
]]>
</script>
</window>

Related

How to change height of Xamarin Shell.TitleView?

I cannot find a way to customize the height parameter of Shell.TitleView
you could try to add android:actionBarSize to your styles.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
...
<!-- ********* CHECK HERE ********* -->
<item name="android:actionBarSize">80dp</item>
...
</style>
</resources>
I had put the stacklayout below navigationbar with same backgroundColor as Navigationbar. Than put controls in that stacklayout. It seems to user as Navigation bar height is increased.

Change color of a dojo tab pane

How do I change the color title of a dojo tab pane of a dojo tab container in a xpage under a given condition? Could anyone give me a roadmap on how to change the label's color?
You can do it like this, and hide the style panel based on your condition
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:panel tagName="style">
div.dijitTab:nth-child(1){background-color:red !important}
</xp:panel>
<xp:panel style="padding:30px">
<xe:djTabContainer id="djTabContainer1">
<xe:djTabPane id="djTabPane1" title="Tab1">1</xe:djTabPane>
<xe:djTabPane id="djTabPane2" title="Tab2">2</xe:djTabPane>
</xe:djTabContainer>
</xp:panel>
</xp:view>

Reusing the same contextMenu xml for ContextMenuMailItem and ContextMenuMultipleItems

When adding items to a context menu (ribbon) in a VSTO outlook add-in (for Outlook 2009+), is there a way to use the same context menu for multiple idMso (i.e., I'd like to add the same items for when single or multiple emails are selected)? I tried the xml below, but the schema doesn't like that I'm re-using the same button id in multiple places.
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<contextMenus>
<contextMenu idMso="ContextMenuMailItem">
<button id="DoThis"
label="Label"
onAction="DoThis"
getVisible="GetVisible"/>
</contextMenu>
<contextMenu idMso="ContextMenuMultipleItems">
<button id="DoThis"
label="Label"
onAction="DoThis"
getVisible="GetVisible"/>
</contextMenu>
</contextMenus>
</customUI>
Ideally I guess I'd like something like this:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<contextMenus>
<contextMenu idMso="ContextMenuMailItem,ContextMenuMultipleItems">
<button id="DoThis"
label="Label"
onAction="DoThis"
getVisible="GetVisible"/>
</contextMenu>
</contextMenus>
</customUI>
Reusing id attribute is not possible, but there is another attribute that is reusable - tag:
<button id="DoThis1" tag="DoThis" ... />
<button id="DoThis2" tag="DoThis" />
Then in the code then you can determine the command not by Id but by Tag property of the control.

variable to custom component - flex

I'm trying to pass a variable from my main flex application to a custom component I've created, but haven't really figured anything out.
my variable is just a string - public var test:String = "a test";
my custom component is implement in my main application like this - <ns1:finaltest includeIn="FinalTest" x="26" y="19" />
In my custom component 'finaltest' I'd like just to display the variable 'test'. something like this - finalmessage.text = test;
MainApp.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600" xmlns:local="*"
>
<fx:Script>
<![CDATA[
[Bindable]
public var test:String = "a test";
]]>
</fx:Script>
<local:FinalTest finalMessage="{test}" />
</s:Application>
FinalTest.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="400" height="300"
>
<fx:Script>
<![CDATA[
[Bindable]
public var finalMessage:String;
]]>
</fx:Script>
<s:Label text="{finalMessage}" />
</s:Group>

Flex, States and inheritance

Is it possible to have a child class which adds states to the set of states which are defined in the base class? Currently it looks like my child class overrides all of the states in the base class.
In your child component, create a separate array of states declaratively and in the preinitialize event concatenate them. See this example.
<!-- MyParent -->
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import mx.controls.Button;
private function onCreationComplete():void {
for each(var state:State in states) {
var button:Button = new Button();
button.label = state.name;
button.addEventListener(MouseEvent.CLICK, onClick);
addChild(button);
}
}
private function onClick(event:MouseEvent):void {
currentState = Button(event.target).label;
}
]]>
</mx:Script>
<mx:states>
<mx:State name="Red">
<mx:SetStyle name="backgroundColor" value="#FF0000" />
</mx:State>
<mx:State name="Green">
<mx:SetStyle name="backgroundColor" value="#00FF00" />
</mx:State>
<mx:State name="Blue">
<mx:SetStyle name="backgroundColor" value="#0000FF" />
</mx:State>
</mx:states>
</mx:VBox>
<!-- MyChild -->
<?xml version="1.0" encoding="utf-8"?>
<MyParent xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" preinitialize="onPreinitialize()">
<mx:Script>
<![CDATA[
private function onPreinitialize():void {
states = states.concat(newStates);
}
]]>
</mx:Script>
<mx:Array id="newStates">
<mx:State name="Cyan">
<mx:SetStyle name="backgroundColor" value="#00FFFF" />
</mx:State>
<mx:State name="Purple">
<mx:SetStyle name="backgroundColor" value="#FF00FF" />
</mx:State>
</mx:Array>
</MyParent>
<!-- MyApp -->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
minWidth="955"
minHeight="600" xmlns="*">
<MyParent width="50%" height="100%" />
<MyChild width="50%" height="100%" right="0" />
</mx:Application>