Display HTML in Boxlayout - codenameone

I want to display HTML in my forms. The problem is I have to use a Boxlayout to place my components. So when I put a WebBrowser I'll have some height and scroll issues. I get the HTML I want to display from a webservice. The length of the content is variable. I just want to display a part of this response. Here is what I already have:
The webBrowser is below the edit button and ends near the LBL_LIB_NOM label.
As you can see the webBrowser is way too high and I can't scroll the Form when I click over the WebBrowser. In this example I would like to reduce the size of the WebBrowser so we can only see the Title. I also would like if possible to scroll my form when I click on the WebBrowser since I don't want the WebBrowser to scroll.
I have tried a few things to solve my issue:
I tried to override the calcPreferredSize method.
I revalidate my form and my webbrowser.
I resized it's container using the deprecated setPreferedSize method.
In that case the container is well sized but the the WebBrowser displays
above the other components.
The usual answer I have seen in other posts is to put the WebBrowser in a BorderLayout but I can't do that.
So here is my question: Is there any other component I can use to display one HTML line ? Or is there a way to make a webBrowser work properly in a boxLayout ? Do I have to write my own HTML renderer ?

I'm guessing you want box layout so you can scroll... This is problematic.
Web views generally expect to scroll themselves and this is common in native widgets which handle their own events and thus scrolling. It's hard for our code to know when your swipe is intended for us or to the underlying native widget and it's harder still to do this in a consistently portable way.
There are 3 options:
Use only Codename One code
Use a border layout or similar layout
Use the web browser for the entire UI of this form
If you want to take the first option this article might be useful as a starting point.

Related

codenameone autocomplete text field display issue in gui

I m working on my mobile apps using codename1 and i found that after adding an autocomplete textfield to any form, every other component disapears along with tabs behind a white container.
It sounds like you are using a scrollable FlowLayout (which is the default layout manager) and some nesting behavior goes bad.
Another guess is that you add everything into the layered pane which is a HUGE MISTAKE, you should add everything to the form directly or content pane.

Codenameone: WebBrowser pull to refresh issue

As title said I have a issue to use “pull to refresh” feature with WebBrowser in Codenameone.
The issue is that “pull to refresh” feature cannot be used with BorderLayout and I need this type of layout to expand WebBrowser over entire screen.
I’ve tried different mix of layouts combinations to avoid usage of BorderLayout so that “pull to refresh” can work but the final result is that I cannot expand WebBrowser over entire screen and have at same time the “pull to refresh” working.
Question: How can I have WebBrowser expanded over entire screen so that I can use “pull to refresh” feature for it?
Thanks.
WebBrowser is a Peer Component hence it handles everything natively including pointer events. This means our pull to refresh logic can't possibly work within a web browser and you have quite a few other limitations.
If you want pull to refresh functionality in a WebBrowser you will need to do it using JavaScript, its an all or nothing issue. FYI You should use a BorderLayout with WebBrowser.

silverlight animated UI

I am trying to put some tabs in the first page, and when mouse is over it, it should be bold and get larger, when click, it will direct to different page. Is it going to involve with JavaScript ? any tutorial for this ?
For the URL, you will want to read about The Silverlight Navigation Framework.
To make the URL go bold and get larger, you will want to use setup a MouseOverState VisualState Storyboard, as is done here: Style the MouseOver on a Silverlight/WPF button.

How to make a navigation in Expression Blend 4?

So I created a layout in Expression Blend 4 for my Silverlight application. Now I need to create a simple navigation to navigate between pages. I have a canvas control in the layout (MainPage.xaml) and I would like the navigation buttons to just change the content of the canvas.
So if a user clicks on a navigation button for Page1.xaml, the Page1's content will be loaded into the canvas.
Could anybody give me an example how to do it? I tried using the MenuItem control but I could not understand how to use it. Now I have just used buttons but I don't know how to make a navigation from them.
I would love to be wrong about this but Im pretty sure, Blend 2,3,4 (the ones I have used)are just like windows form development your controls are not active until you actually build and run the application.
Sorry
Edit
To answer your comment the menuItem is a simple control that has been predefined like a button or link. The main idea with blend is to give developers and designers the ability to customize the look and feel of control layout in a similar way html uses CSS and javascript.
Try using "Hyperlink Buttons" for your menu and display the content in a "Frame" control.

opening a silverlight childWindow overlay on the viewport of the browser

I would like place a silverlight contol on an HTML page --- something about the size of a typical calendar control. However when the user selects a day on the control a bigger canvas opens up on top of the containing page --- something like a modal dialog box that you might find with the AJAX.
I'm wondering if this is even possible with Silverlight, or is the silverlight content limited in size to the DIV element on the host page?
UPDATE: after doing some poking around, I think the answer will involve using the ChildWindow control introduced with Silverlight 3. However I'm still at a loss how to have the ChildWindow display ontop of the existing content
I know one way, you will need javascript event on the page itself to expand a silverlight object to fit the whole page then build you silverlight event accordingly.

Resources