Webview current url for blackberry - events

I have added a webview to my window as shown on below.
<Alloy>
<Window>
<WebView top="150" id="webContent" width="300px" height="300px" borderColor="red"
borderWidth="2px" url="http://www.google.com"></WebView>
</Window>
</Alloy>
And added a load event on controller.
$.webContent.addEventListener('load', checkState);
function checkState(e){
alert($.webContent.evalJS("document.title"));
}
But every time it shows undefined on alert, whenever I change url. It works fine on IOS.
And also the border and border color was not displaying in case of BB.
Please suggest.
Can also check

Related

NativeScript ActionBar keeps re-appearing on navigation

I have a page with a hidden ActionBar (see below) which works fine normally. However when I navigate to another page and then use back() to get back, the ActionBar is now fully visible.
(Note: I require the ActionBar to be on the page so I can change the status bar colour)
This is for the current version of NativeScript Angular.
<ActionBar visibility="collapsed"></ActionBar>
<GridLayout rows="*, auto" columns="*" *ngIf="pageLoaded">
...
</GridLayout>
You can also add the Page class to your constructor and call this.page.actionBarHidden = true; in your ngOnInit.
This way you can also remove actionbar you have defined in your html template.
I was able to just remove the ActionBar and find a different way to change the text colour on the StatusBar, that doesn't require the ActionBar on the page.

Label tap event delay

There is some difference in perfomance between using tap event on label and on button component.
Lets take for example this nativescript hello world app
https://github.com/NativeScript/template-hello-world
And especially this code
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
<StackLayout>
<Label text="Tap the button" class="title"/>
<Button text="TAP" tap="{{ onTap }}" />
<Label text="{{ message }}" class="message" textWrap="true"/>
</StackLayout>
</Page>
When i am tapping fast on the button the UI is updated smoothly, but when i change the Button component with Label and try to tap fast there is some delay with updating the UI or some of the taps are not handled and the message property is not updated correctly.
I am using android (5.0) genymotion and real device (Android 6)
Nativescript: 2.2
The "problem" occurs in nativescript angular2 too.
You can give the tap event to the layout containers containing labels to increase the maximum touchable area.
<StackLayout (tap)="yourFunction()">
<Label text = "click event"></Label>
</StackLayout>

How to change the Back Button Text on Xamarin.Forms

I have been trying to change the text of the back button in Xamarin.Forms without luck.
I tried already this code with no luck:
NavigationPage.SetBackButtonTitle(this, "");
I'm using a MasterDetailPage.
I tried to add the code into the constructor of the XAML cs file.
Libraries used: PRISM 6.2.0, Xamarin Forms 2.3.1.114
Any suggestion or idea?
Thanks in advance
Due to the topic:
One of the things that is a little bit unintuitive about this API is that you are setting the title for the back button that shows up when this page is the one that you are going back to. For example, you are trying to set the title to "Home". That means you should be calling this method on the Page that represents the "home" page, not the page that is visible when the back button that says "Home" is showing.
So, if you are navigating from Page1 to Page2, you should set NavigationPage.SetBackButtonTitle(this, "") in constructor of Page1 and on Page2 you will see the empty title of back button.
You have to set the Backbutton title of your previous page as string.Empty. By default it's the title of the previous page on the navigation stack that is shown as the back button text.
Also Android does not support this property.
You can also do it from the Code Behind of the current xaml page
public TodoPage()
{
InitializeComponent();
NavigationPage.SetBackButtonTitle(this, "Back");
}
NB: It has to be done on the previous page you want to set.
e.g. Page A has to have the code if you want Page B to show "Back" title.
Belated answer but maybe someone will find this useful in the future… Anyhow, if you wish to get rid of the back button title from XAML, you can either add NavigationPage.BackButtonTitle="" for any ContentPage that should have the title removed or you can define new ContentPage style in your App.xaml file like this:
<Style x:Key="ContentPageStyle" TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="White" /><!-- just an example of other things that can be in here -->
<Setter Property="NavigationPage.BackButtonTitle" Value="" />
</Style>
I was, however, unable to turn this into an implicit global style that would get applied automatically without the need to specify Style="{StaticResource ContentPageStyle}" for each ContentPage – I'm not sure why that one doesn't work.
You can set the attribute NavigationPage.BackButtonTitle on ContentPage
For example:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:T3R"
mc:Ignorable="d"
Title="Title of Page"
NavigationPage.BackButtonTitle="Cancel"
x:Class="T3R.MainPage">
Remember the following:
I understand this only works on iOS
For any given page, the back button title is set by the page that presents it. This way, the button label can vary with respect to the page that precedes it on the navigation stack (of which there can be many).
You can set your back button text in XAML as follows (before ContentPage.Content):
<NavigationPage.TitleView>
<Label Text="{Binding PageTitle}" HorizontalOptions="Center"/>
</NavigationPage.TitleView>

ckeditor skip size for zk

i want to use component ckeditor with ZK.
The component is correctly visible but width/height set are non considered.
I've reproduced the problem using ckeditor on zul as follow:
<zk>
<window id="myId">
<div width="500px" height="500px" style="background:red">
<ckeditor id="myEditor" width="500px" height="300px"
customConfigurationsPath="/j/ckeditor_cfg_ro.js" toolbar="MyToolbar">
</ckeditor>
</div>
</window>
</zk>
when i open it, the ckeditor is smaller than expected...
version of ckeditor is 3.6.4.
how i can show my editor in the correct size?
here how the ckeditor is shown:
another info:
the toolbar (configured on file ckeditor_cfg.js on "js" directory) is not shown and using firebug i get the following error:
TypeError: jq(...).ckeditor is not a function
on line: ckez.wpd (line 42564) --> jq(this.$n('cnt')).ckeditor(function(){
Actually, after some testing in fiddle, the height does work.
The problem is that the height is set for the textbox of the ckeditor and do not look at the header.
You can Always create a bug report for it.
Check this fiddle for it.

How to add a button to first item in ListView

Greeting,
I'm developing an apps for Windows Phone 8.1 and face some problem with ListView.
I wanted to place a button for the FIRST item in ListView, but it seem like I can't align center the button.
Below is the code I use currently:
<ListView>
<Button Content="Jio!" Height="6" Width="362"/>
<ListViewItem Content="ListViewItem"/>
</ListView>
Adding horizontalalignment='center' just wont work for the button.
The reason I want to do this is because I wanted the button to scroll together with the list, hence I'm placing it inside the ListView.
Please advice what can I do to achieve my purpose, thanks!
I recommend using the ListView.Header content to place such a button instead of adding it as a child directly.
<ListView>
<ListView.Header>
<Button ... HorizontalAlignment="Center" />
</ListView.Header>
</ListView>
By default, the ListViewItems are left-aligned. You will eventually have to replace their Template in order to center-align it (HeaderTemplate Property).

Resources