Bug? Error: Paste Image from ClipBoard to ImageView

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

got following error when pasting an image from the clipboard to an imageview.
The imageview is added using the scene designer.
See example project attached.
Using:
B4X:
imageview1.SetImage(fx.Clipboard.GetImage)


Errorlog:
B4X:
Program started.
main._buttonpasteimage_action (java line: 61)
java.lang.RuntimeException: Object should first be initialized (Image).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:28)
    at b4j.example.main._buttonpasteimage_action(main.java:61)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:92)
    at anywheresoftware.b4a.BA$2.run(BA.java:158)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
    at java.lang.Thread.run(Thread.java:744)
 

Attachments

  • imageclipboard.zip
    1.2 KB · Views: 366

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You should check whether there is an image with Clipboard.HasImage.
2. It works fine here:

SS-2014-01-14_10.35.59.png
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Thanks for reply.

I tested as follows under Windows 8.1
  1. Started paint > opened png file > select all > copy to clipboard > started winword > paste image with visible image as a result
  2. Same again, but then pasting into b4j imageview with the previous mentioned error as a result
  3. Then tried using the Windows Snipping Tool with copy function, same error occurred when pasting --- pasting into winword no issue
I have used hasimage to check (see example project).
When using Try ... Catch the LastException Message is empty.
 
Top