Easier way to center a label in Xul - xul

Is there an easier way to center a label in Xul then with the following?
<xul:hbox>
<xul:spacer flex="1" />
<xul:label id="myLabel" value="LABEL"/>
<xul:spacer flex="1" />
</xul:hbox>

Yes. Use box packing via the pack attribute.
<hbox pack="center"><label id="myLabel" value="LABEL"/></hbox.

Two alternative ways which also work with multiline labels:
Use <label style="text-align: center"/>
Use <vbox align="center"><label/></vbox>

Related

<render-mode> not working with dynamic Material UI

I use the <render-mode> tag to include some html in my screen:
<?xml version="1.0" encoding="UTF-8"?>
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.1.xsd"
require-authentication="anonymous-all">
<widgets>
<label type="h1" text="Hello world!"/>
<render-mode>
<text type="html,vuet" location="component://tutorial/template/hello.html"/>
</render-mode>
<label type="h1" text="after Hello world!"/>
</widgets>
</screen>
The incuded hello.html file is shown fine using the "standard UI" or "dynamic Bootstrap UI", but it doesn't show when using the "dynamic Material UI".
Is there a way to enable this? I much prefer the look and navigation of the dynamic Material UI.
Thank you!
The reason it doesn't show under qapps is that qapps uses a new render mode 'qvt' just like vapps uses the render mode 'vuet'. To make it show under /qapps just change:
<text type="html,vuet" ...
to:
<text type="html,vuet,qvt" ...

Is it possible to render elements conditionally in NativeScript-Vue?

I hope you can help me to solve my problem.
I am working on a Nativescript-Vue Application and I want to render this conditionally:
<Label if="isRendering" text="This is a text"></Label>
But this does not work.
I already tried it with <v-template if="..."></v-template> but this also does not work.
If i am not mistaken, in Vue.js it is possible to render conditionally with v-if and i am searching for a possibility to make it in Nativescript-Vue.
Thank you
It's the same like in Vue.js.
Instead of using if you should be using v-if.
Playground example
Example:
<Label v-if="isRendering" text="This is a text"></Label>
But if you want to use an if in a ListView it's different.
Example:
<ListView for="item in listOfItems" #itemTap="onItemTap">
<v-template>
<Label :text="item.text" />
</v-template>
<v-template if="$odd">
<!-- For items with an odd index, shows the label in red. -->
<Label :text="item.text" color="red" />
</v-template>
</ListView>
But more info about that in the docs

Check that values of two input fields are the same

I am using React Native and have a form like this :
<Form>
<Text>Password</Text>
<Label>
New Password
</Label>
<Item regular >
<Input />
</Item>
<Label style={styles.label}>
Confirm
</Label>
<Item regular >
<Input/>
</Item>
</Form>
<Button title="Update" onPress={() =>? } ></Button>
I need to check that the values in the input fields are the same, and check some restrictions that can be done using regular expressions.
How do I pass the values in the input fields so that I check in the controller?
I have done this using Angular in the past only.
It's my first time using react native, any guidance of best practice to do is is appreciated.
Thanks.
This problem is so basic that I suggest you to read React docs on forms: https://reactjs.org/docs/forms.html
Tell me if you have problems still when you have read the docs and tried implement the solution yourself :)

titanium alloy raised tab bar with raised center button - dailybooth style

I'm trying to customize my alloy TabGroup to look like the image below (with no luck). no "height" properties on Tab item in the default documentation and with my current version of titanium 3.4.0 can't add View to TabGroup.
anybody know how to create a raised center button using alloy?
that's my index.xml view
<Alloy>
<TabGroup tabsBackgroundColor="white" barColor="#f15b26" activeTabIconTint="black" tintColor="white">
<Require src="home" nr="1" />
<Require src="play" nr="2" />
<Tab icon="/menu/logo.png" height="100">
<Window title="" id="">
<Label></Label>
</Window>
</Tab>
<Require src="chat" nr="3" />
<Require src="config" nr="4" />
</TabGroup>
</Alloy>
you can use an image in the middle of the that exceed the height of the bar.
When we implemented this solution in the past, we did a completely custom tabBar. I dont think you can accomplish what you are trying to do with the base tabBar control

Formatted XUL Tab caption

Is there an easy way to have formatted tab captions in XUL? I want to have a specific part of the tab caption in bold font.
No easy way. XUL <tab>'s text is in a <label>, which doesn't give you fine-grained control over parts of the text. You'd have to replace it with a <description> which can contain HTML markup, but this is not a standard thing to do.
An easier way perhaps is to put multiple <label>'s inside the <tab>
Eg :
<tabbox>
<tabs>
<tab>
<label style="margin-right: 0px;" value="normal"/>
<label style="margin-left: 0px; font-weight: bold;" value="bold"/>
</tab>
</tabs>
</tabbox>
Of course it depends on what it's used for exactly.