Unable to set button icon with ImageDownloadService (EncodedImage) - codenameone

I have an issue with ImageDownloadService. Below is my code. If I use a label, I can display the image downloaded from a server. But if I use a button, nothing is displayed. I have set the placeholder as the initial icon of the button. Please what am i doing wrong?
EncodedImage eImg = EncodedImage.findButton(f).getIcon();
Image i = URLImage.createToStorage(eImg, "MyStoredImage.jpg", "http://ImgURL.png", URLImage.RESIZE_SCALE);
//now set the ad image to downloaded image
findButton(f).setIcon(i);
If I used findLabel(f).getIcon() instead and findLabel(f).setIcon(i), the code would work but for Button it does not. Why is this?
Thanks in advance.

See the discussion in the Codename One forum here https://groups.google.com/d/msg/codenameone-discussions/05dLV771OV8/x-pEYngCrsEJ

Related

Codename One: How to increase height of dialog

I have developed app using Codename one.I want to set specific height of dialog because my text overidden while displaying message in dialog body .what should I do for that?
Thanks in Advance?
I have added image in which first image is original image and second one is cut image which is displaying on screen while using infinite progress bar. my code is "Dialog ipDialog = new InfiniteProgress().showInifiniteBlocking(); ipDialog.Dispose()" I want whole image on screen like original image.
can you help me to solved this ?
You can use the Dialog show method that accepts int values to determine the distance from the edges. But normally this is a matter of the text sizing and dialog construction.
Also make sure you are showing the Dialog from the EDT thread.

How to display image in Krypton Button

In my existing system Krypton button is been used. I want to display image instead of text in the button. My current Buttonstyle is set as "LowProfile". I am confused about the button style mode in tool kit also. I couldnt find any relevant documents for the ButtonStyle.
So my questions are:
Where can I find the good document/tutorial for the krypton tool kit?
How to display image in the krypton Button?
Image can be added in StateCommon -> Back -> Image -> {Select your image}
Also to visualize the image set Draw to True
Krypton is now open source.
https://github.com/ComponentFactory/Krypton
You can find some examples of KryptonButton in the KryptonExplorer.exe and KryptonButtonExamples.exe demo projects.
Source code for these projects are available here:
https://github.com/ComponentFactory/Krypton/tree/master/Source/Krypton%20Toolkit%20Examples
In these projects, the image is added with Properties, Values, Image, {Select your image}
Otherwise, you can also use: Properties, StateCommon, Back, Image, {Select your image}
The difference between Values and StateCommon seems to be "some padding" and therefore the image is not directly on the border/edge of the button.

Delete an image in the aloha-editor

The Aloha Editor ships with an image plugin that enables users to edit images inline. However, i've not found a way to delete an image in the editor. I'm on a Mac, and i've tried:
Press Backspace when the image is selected
Press Backspace wehn the cursor is in front of the image
There's also no "delete image" button in the floating toolbar.
Has anyone found a way to delete an inline image?
I have a similar issue. On windows, I can delete an image by pressing the 'Del' key. However, I've used a float:right css to position the image automatically and in this case I can not delete it anymore.
I have added the following workaround in my page. It makes possible to delete the image by double-clicking on it.
$(function() {
$('.aloha img').live('dblclick', function(event) {
if (confirm("Supprimer l'image?")) {
event.preventDefault();
$(this).remove();
}
return false;
});
});
This seems to works on firefox. However sometimes I can see the image to be magically restored. On Chrome this magic behavior happens every time.
I keep investigating and I'll keep you informed if I fix this problem in a clean way.
Update: this is now fixed in aloha-editor. If you select the image and clear the src field value. See https://github.com/alohaeditor/Aloha-Editor/issues/513
You can delete the image URL from the URL field that appears when you click on the inserted image. That makes the image disappear for me. Not very convenient though. :)

Using lightbox2 to display text instead of images

I am trying to use lightbox2 to display a block of text after clicking a heading element:
something like
<h3>name</h3>
I have used lightbox for images with captions but this time I would like the caption to come up without an associated image after clicking a name on a webpage.
Thanks for any replies.
I don't think that lightbox2 is made for such a thing, why don't you try http://fancybox.net/ this one works 100%.

Animated GIFs in Lotus Notes

I have built a HTML email newsletter containing an animated GIF Christmas Ecard which is being sent to all employees of a company who exclusively use Lotus Notes.
The problem I'm having is that they are receiving the email fine, but the GIF isn't animating.
Any idea if there's a way to get this working?
You could ensure that the first frame of the gif looks nice so that the animation is an 'added benefit' rather than a requirement.
That they had one come through last year seems amazing to me. But if that is actually the truth it might have had something to do with the file size being too large. You should try to keep them under 40kb
Click Create in the toolbar above the email message. Click on the Picture option and then choose GIF from the pull-down menu. Go to the folder location of the animated GIF that you want to embed in the email. Click and highlight the file. Click the Import button to add the animated GIF.

Resources