openlaszlo Button and Radiogroup inerference - animation

I am a openlaszlo beginner and I wnat to create an interactive web interface which simulates the indications of a vomplex astronomic clock. It should be possible to input e.g. the coodriantes and date/time or to select a realtime or timelapse modus.
I have tried to use a edittext field and button and a radiobutton group to select the informations and then to move an image according to the selsction.
When I use only the edittext field and the button, then it works. The text entry is displayed in the output edittext field and the image really rotates the arc which was given. When I add the radiobutton group, then the selected arc is displayed in the output edittext field, but no rotation of the image occurs. Can someone help?
Here is the code
<canvas>
<!-- Load of the image -->
<view name="Zeiger" x="100" y="100" resource="images/Kal_Ring_Stundenzeiger.gif" id="HandID">
<!-- Methode to rotate the image, Arc is set by the argument -->
<method name="rotate" args="Arc">
var increment = 0 + Arc;
var dur = 700;
this.animate('rotation',increment,dur);
</method>
</view>
<!-- Control unit -->
<view name="Bedienung" x="200" y="10">
<simplelayout axis="y" inset="8"/>
<text text="Output:"/>
<edittext id="outputID" text = "0"/>
<text text="Arc:"/>
<edittext id="WinkelID" text = "51"/>
<button x="000" y="160">
Rotation
<!-- Handler to execute the Method -->
<handler name="onclick">
var x = WinkelID.getText();
HandID.rotate(x);
outputID.setAttribute('text',x);
</handler>
</button>
<!-- when I remove the radiogroup, then the image rotates -->
<radiogroup id="group1ID">
<handler name="onselect">
var Arcchoice = this.getValue();
HandID.rotate(Arcchoice);
outputID.setAttribute('text',Arcchoice);
</handler>
<radiobutton value="0" text="0°" selected="true"/>
<radiobutton value="90" text="90°"/>
<radiobutton value="180" text="180°"/>
<radiobutton value="270" text="270°"/>
<radiobutton value="360" text="360°"/>
</radiogroup>
</view>
</canvas>

I've tested the code with OpenLaszlo 5.0 trunk, and it works as expected in both the SWF10 and DHTML runtime.
Here is a screenshot of the app with a resource from the LzClock widget (didn't have your SWF resource available for testing). I've entered the arc value into the textfield and clicked the button to set the rotation.
I've tested with Chrome and Firefox on Linux, haven't tested with Windows.

Related

Appium application automation testing issues of element size

We are doing Windows application automation using Appium. That application is developed under WPF Microsoft technology.
In Appium source response we got xml proper but not getting x, y, height, width of tabItem of tab control.
XML look like below
<Tab AcceleratorKey="" AccessKey="" AutomationId="MainTabControl" ClassName="TabControl" FrameworkId="WPF" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="tab" Name="" Orientation="None" ProcessId="68888" RuntimeId="7.68888.15577129" x="8" y="41" width="1350" height="679" Selection="7.68888.32204626">
<TabItem AcceleratorKey="" AccessKey="" AutomationId="" ClassName="TabItem" FrameworkId="WPF" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="True" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="tab item" Name="Samba.Presentation.ClientLibrary.Modules.LoginModule.LoginView" Orientation="None" ProcessId="68888" RuntimeId="7.68888.61852681" x="0" y="0" width="0" height="0" IsSelected="False" SelectionContainer="{, TabControl, 7.68888.15577129}" IsAvailable="True" />
</Tab>
Appium gives x, y, height, width of Tab but not of TabItem.
So, we cannot click on that Tab item.

How to get context from NativeScript modal opener through frame?

I'm unable get showModal to pass context through a frame to the default page. Also, showingModally does not seem to fire when modal is loaded (I guess args from showingModally should pass context?).
I've tried the example provided on https://docs.nativescript.org/ui/modal-view under Custom Actionbar, because I need the modal to load within a frame. The modal opens and closes fine, but showingModally in the modal XML does not seem to run.
home/home-page.js
const modalView = "home/modal-root";
function openModal(args) {
console.log('Opens modal');
const mainpage = args.object.page;
const context = "some context";
mainpage.showModal(modalView, context, () => {
console.log('Modal closed');
}, true);
}
exports.openModal = openModal;
home/home-page.xml
<Page xmlns="http://www.nativescript.org/tns.xsd">
<Page.actionBar>
<ActionBar title="Modal view Navigation" />
</Page.actionBar>
<GridLayout rows="auto, *">
<Button text="Open modal" tap="openModal" textWrap="true" />
</GridLayout>
</Page>
home/modal-root.xml
<Frame defaultPage="home/modal-view-page" />
home/modal-view-page.js
function onShowingModally(args) {
console.log("onShowingModally");
}
exports.onShowingModally = onShowingModally;
function onCloseModal(args) {
args.object.closeModal();
}
exports.onCloseModal = onCloseModal;
home/modal-view-page.xml
<Page backgroundColor="green" showingModally="onShowingModally">
<Page.actionBar>
<ActionBar backgroundColor="red" title="Modal view" icon="">
</ActionBar>
</Page.actionBar>
<StackLayout backgroundColor="lightGreen">
<Label text="Modal view with ActionBar" style="text-align:center;" textWrap="true" />
<Button text="Close Modal" tap="onCloseModal" />
</StackLayout>
</Page>
I've added the example to https://play.nativescript.org/?template=play-js&id=lFxTi4&v=9
with console logging.
Console show "Opens modal" on open and "Modal closed" on close as expected (from home/home-page.js), but "onShowingModally" (home/modal-view-page.js) nevers shows in console.
I think the docs need to be fixed. When you have the Frame being shown modally, the event will be called on the Frame not on the page within. If you are showing a simple view instead of Frame, then the event should be called on the view, basically whatever is the root view for your modal and in your example it's the Frame.
Updated Playground

GridLayout not showing on devices

I've this problem using GridLayout, tested on two Samsung devices.
This is an excerpt from the layout:
<GridLayout
a:layout_width="0dp"
a:layout_weight="2"
a:layout_height="match_parent"
a:rowCount="5"
a:columnCount="4">
<TextView
a:id="#+id/tvDescentsFemaleCount"
style="#style/dataPanelControlLabels"
a:layout_width="0dp"
a:layout_row="0"
a:layout_column="0"
a:layout_columnWeight="3"
a:layout_columnSpan="3"
a:text="#string/pnlVisitDescentsFemaleDescentNumber" />
<Button
a:id="#+id/bDescentsFemaleCount"
style="#style/dataButton"
a:layout_width="0dp"
a:layout_row="1"
a:layout_column="0"
a:layout_columnWeight="3"
a:layout_columnSpan="3"
a:layout_marginLeft="3dp"
a:layout_marginRight="3dp" />
<ImageView
a:id="#+id/ivDescentsMoveLeft"
a:layout_width="0dp"
a:layout_row="1"
a:layout_column="3"
a:layout_columnWeight="1"
a:src="#drawable/freccia_indietro"
a:adjustViewBounds="true"
a:scaleType="centerInside" />
<TextView
a:id="#+id/tvDescentsMaleCount"
style="#style/dataPanelControlLabels"
a:layout_width="0dp"
a:layout_row="2"
a:layout_column="0"
a:layout_columnSpan="3"
a:layout_columnWeight="3"
a:text="#string/pnlVisitDescentsMaleDescentNumber" />
<Button
a:id="#+id/bDescentsMaleCount"
style="#style/dataButton"
a:layout_width="0dp"
a:layout_row="3"
a:layout_column="0"
a:layout_columnSpan="3"
a:layout_columnWeight="3"
a:layout_marginLeft="3dp"
a:layout_marginRight="3dp" />
<ImageView
a:id="#+id/ivDescentsMoveRight"
a:layout_width="0dp"
a:layout_row="3"
a:layout_column="3"
a:layout_columnWeight="1"
a:src="#drawable/freccia_avanti"
a:adjustViewBounds="true"
a:scaleType="centerInside" />
<ImageView
a:id="#+id/ivDescentsAdd"
a:layout_width="0dp"
a:layout_row="4"
a:layout_column="0"
a:layout_columnWeight="1"
a:layout_margin="3dp"
a:src="#drawable/add"
a:adjustViewBounds="true"
a:scaleType="centerInside"
a:padding="6dp" />
<ImageView
a:id="#+id/ivDescentsRemove"
a:layout_width="0dp"
a:layout_height="wrap_content"
a:layout_columnWeight="1"
a:layout_row="4"
a:layout_column="1"
a:layout_margin="3dp"
a:padding="6dp"
a:src="#drawable/meno"
a:adjustViewBounds="true"
a:scaleType="centerInside" />
<ToggleButton
a:id="#+id/tbDescentsFemaleSelect"
style="#style/toggleButtonPv"
a:layout_width="0dp"
a:layout_row="4"
a:layout_column="2"
a:layout_columnWeight="1"
a:layout_height="wrap_content"
a:layout_margin="3dp"
a:textOn="#string/pnlVisitDescentsFemaleShort"
a:textOff="#string/pnlVisitDescentsFemaleShort"
a:padding="4dp" />
<ToggleButton
a:id="#+id/tbDescentsMaleSelect"
style="#style/toggleButtonPv"
a:layout_width="0dp"
a:layout_row="4"
a:layout_column="3"
a:layout_columnWeight="1"
a:layout_height="wrap_content"
a:layout_margin="3dp"
a:textOn="#string/pnlVisitDescentsMaleShort"
a:textOff="#string/pnlVisitDescentsMaleShort"
a:padding="4dp" />
</GridLayout>
On the complete layout there is another GridLayout, where the only difference is the absence of the a:layout_columnSpan attribute (I've shortened the classic namespace declaration from xmlns:android... to xlmns:a...).
This is the less-significant screenshot from my PC designer :
This is the screenshot from an SM-T535, API level 21 Samsung tablet :
On the upper left corner there is a GridLayout, on the middle right there is an android.support.v7.widget.GridLayout. I've left the layout limits only to show how the widgets are rendered.
This is the screenshot from an SM-T585, API level 24 Samsung tablet:
The GridLayout is rendered correctly, whereas the android.support.v7.widget.GridLayout on the right is rendered almost in the same way.
This is the screenshot from the same SM-T585, where all the two widgets are the standard GridLayout:
Please note also the switch bank under the GridLayout on the right; they are android.support.v7.widget.SwitchCompat, because originally I was porting the app on a GT-N800 Samsung tablet, and the standard Switch widget was not so customizable. In the Activity code I'm substituting the standard typeface with a font from an asset. Only on the SM-T585 the font is shown correctly.
The activity inherits from Activity, but inheriting from AppCompatActivity doesn't change a single pixel.
The entire project is a Xamarin app (I'm porting the same app developed for IOS, so I've to recycle a great part of the code), and the IDE is VS2017 Community edition.
The same layout (GridLayout widgets) works correctly on a Nexus 7, although the screen is too small.
Any suggestion appreciated.
Thanks.
Rodolfo.

Xamarin.Forms change background color of ContentPage.ToolbarItems

With my Xamarin cross-platform app, I have a drop-down menu which is created with the following XAML code:
<ContentPage>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Add another child to my account" Order="Secondary" Priority="1" Clicked="AddAnotherChildClick" />
<ToolbarItem Text="Delete child from my account" Order="Secondary" Priority="2" Clicked="DeleteChildClick" />
<ToolbarItem Text="Log Out" Order="Secondary" Priority="3" Clicked="LogOutClick" />
</ContentPage.ToolbarItems>
</ContentPage>
I need to be able to control the background color and text color of the menu. It is currently grey with white text (see screenshot). I would like it black with orange text.
How can I change this - ideally using a global style?
If you are using Navigation page then you can do the follow:
var navPage = new NavigationPage(new YourPage());
this.MainPage = navPage;
navPage.BarBackgroundColor = Color.Orange;
navPage.BarTextColor = Color.Black;
It will work on iOS but on Android 5.0 and above the text color will not change. To change it see this link
How to change navigation bar text color in xamarin forms android

Flex 4 - Vertical layout problem on TitleWindow

This must be a simple problem, but I can't get my head around it. I have a resizable title window. Inside I just want a VGroup to hold the contents of the form and an HGroup to have a few buttons at the bottom. Very standard stuff.
<!-- Content -->
<s:VGroup id="content" height="340" width="100%">
...more stuff in here...
</s:VGroup>
<!-- Buttons -->
<s:HGroup id="buttonGroup" width="100%">
...buttons in here...
</s:HGroup>
Horizonal resizing works fine. However, I want it to behave such that when the TitleWindow is resized vertically that the buttons stay in the same place relative to the TitleWindow and the content VGroup is resized vertically. But I don't know what to set the height of the VGroup to?
Ideally it would be like this:
height="{this.parent.height - buttonGroup.height - top*
or something like that....
You can also try the following trick:
<s:VGroup id="layoutContainer" width="100%" height="100%">
<s:SkinnableContainer id="content" height="100%">
....content here....
</s:SkinnableContainer>
<!-- Buttons -->
<s:HGroup id="buttonGroup">
... buttons here...
</s:HGroup>
</s:VGroup>
The intent is to make the content-container take as mush as possible vertical space within the VGroup.
Let me know if that worked for you!
Use constraint properties.
You could try for AS:
content.top = 0;
content.bottom = buttonGroup.height;
buttonGroup.bottom = 0;
But better put it to MXML definition of the components
<s:VGroup id="content" top="0" bottom="{buttonGroup.height}" width="100%">
...more stuff in here...
</s:VGroup>
<s:HGroup id="buttonGroup" bottom="0" width="100%">
...buttons in here...
</s:HGroup>
Add some paddings and margins if you like

Resources