CodenameOne GUI Builder Button Image Problem - codenameone

The CodenameOne GUI Builder seems to have a mind of its own..
I created a simple form with a button that has a green image when it is enabled and red when disabled. In my code I use another button to call an event function that enables and disables the button.
This seems pretty simple, yet it doesn't work reliably. The button's image changes between green and transparent as it toggles. Other times it works correctly. After I make a change I always do a 'save' and a 'regen' in the GUI Builder and then 'Clean and Build' in NetBeans.
Also, the size of my image is much smaller in the simulator than in the GUI Builder.
GUI Builder is sooo frustrating; I wish I could just code the for using html and css :(
Any suggestions would be appreciated.
Please see my video capture (https://siscocircuits.com/cno_gui_builder_problem.wmv) which shows the problem in action.

You can write code in Java to represent the GUI. In fact that's what the GUI builder does under the surface and that's what most of our demos do. We also support a form of CSS.
The problem with the image sizes is probably due to the fact that you used regular images instead of multi-images to adapt to the various DPIs. I suggest reviewing the generated code to see what went wrong it's a bit difficult to see in the video but you can put a breakpoint in the debugger and step over the generated code.

Related

How to configure Combobox from Gui Builder?

I can not make combobox from gui builder.
I drag and drop a combobox into place from Components Pallete/Core Combonets.
I am setting two values as is shown in the screen shot bellow:
I am saving the From in the gui builder and then I hit the run on netbeans. On simulator the combobix is shown empty as you can see on the next screenshot:
am I dong something wrong?
This seems to be a bug in the GUI builder. We generally recommend avoiding combo boxes so people don't test this much. Please file an issue here. As a workaround just use setModel within the constructor and define the elements that go in.

Is it possible to enable hover in the simulator?

I was thinking about creating sort of animated screenshots of my app running in the simulator and created some code which is able to record an animated GIF image where I am also able to draw the current pointer as a gloved hand on top.
Then I realised it woud be much better if the pointer was shown even if it is not down.
Therefore - is it possible to enable hover in the simulator?
We have the ability to show it in the JavaSE port but that isn't exposed in the simulator. If you change the compile path to the project you can use:
JavaSEPort.setInvokePointerHover(true);

Image not scaling correctly for each device screen

I am having problems with multi image in the new GUI builder. It doesn't scale as should with individual skin or device screen. Is there another way to add multi image to scale according to screen size in the code?
I got this done very well in the old GUI builder. This is preventing me from having my app update.
Open the designer and verify that the image is indeed a multi-image and that resolutions exist for all the right DPI's.
Look at the code and verify that the image is fetched using getImage(String) and isn't manipulated in any way.
Verify that you are using Label and not ScaleImageLabel or some similar class.
The Phoenix demo was created using the new GUI builder and uses a lot of multi-images.

Silverlight 3: How to implement Textblock copy/paste functionality?

Silverlight is awesome, most of my application users are giving positive feedback about silverlight. However some of the users are not able to live without copy/paste functionality. They are very much used to copy/paste functionality provided by HTML page out of the box.
How can I implement such a context menu as well as copy/paste functionality?
PS: Windows only solution is fine too.
Aside from using TextBox with IsReadOnly=true, you'll have a pretty hard time trying to simulate selection and copy/paste in a TextBlock. I would identify the areas they wish to copy/paste the most and use TextBox's there. You could even remove the border and make a transparent background and it should look nearly identical to adjacent TextBlock's.
If you do that then you will get the selection and copy functionality provided by TextBox and it works across browsers.
Otherwise you will need to go through the browser's DOM to put stuff on the clipboard and that will be a pain because of cross-browser concerns. Silverlight 4 adds a Clipboard API if you're able to start development with a beta version.
As Josh has answered, style a TextBox to look like a TextBlock. In terms of copy and paste:
Assuming the users aren't content with just CTRL+C, CTRL+X or CTRL+V - you can now access the clipboard in Silverlight 4:
string content = Clipboard.GetText();
Clipboard.SetText("hello world");
A context menu can be done in various ways, and in Silverlight 4 it is actually properly supported cross browser instead of just IE. You could do it with a Popup or a ChildWindow or just use one from the Vectorlight library:
This open source project on Codeplex contains a demo that does just that and much more:
http://sl4popupmenu.codeplex.com/

Learning WPF... Full screen launcher app

I'm in the process of building a Home Theatre PC (HTPC), and figured this could give me a small project to learn some more about WPF.
I want to build a simple program launcher. It would be an application that would fill the screen with a background of my choosing, and a few large icons/buttons to represent applications. I have an IR remote that will be set up to emulate keystrokes, so I can use the "keyboard" to move between the large buttons and "click" one of them, launching a program.
I'd like to define my button info, images, and background using some kind of external config file and image files in the same folder as the exe.
I've been playing around with the idea in VS2008 using VB but already I'm getting stuck with just trying to get an external image file to appear on a button. Many of the samples I find are relatively complicated and are written in C#, but I work in VB. If anyone has suggestions for getting over this hurdle or ideas on how I should approach other parts of my application, your input is welcome.
Thanks!
Try working your way through this series:
A First Introduction to WPF and XAML for Visual Basic Programmers
Good intro recommended in the first answer - if you want to go a bit deeper have a look at WPF - how and why

Resources