Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
..Picture.Data error. Why ? bug in IW ?
#1
Hi All,

I have a form with an IwImage onto which I have loaded a BMP image.

In the DFm file the def is:

object BTN_SoegVejning2: TIWImage
      Left = 192
      Top = 14
      Width = 20
      Height = 20
      Hint = 'Click to open a search window'
      ShowHint = False
      RenderSize = False
      StyleRenderOptions.RenderSize = False
      BorderOptions.Width = 0
      TabOrder = -1
      UseSize = False
      OnClick = BTN_SoegVejning2Click
      Picture.Data = {
        07544269746D6170E6040000424DE60400000000000036000000280000001400
        0000140000000100180000000000B0040000120B0000120B0000000000000000
        0000D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3E2DCD9C4BFBDE4DEDBFDF6F3D3D3
        D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3D3D3B0ACAA8C8A8A66666694918FF2ECE9D3D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3
        D3D3D3D3B8B4B27272717B7B7B5B5B5B605E5ED5CFCDD3D3D3D3D3D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3B3AEAC
        7271718484846060604F4F4F898685E3DDDBD3D3D3D3D3D3D3D3D3D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3B9B5B37372728B8B8B5A
        5A5A494949878483D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3E0D8D5CDC4BE63594F
        8A7E729C8F838F84796C645CD2CBC6E3DCD8C8C2BF9593915D5D5D4F4F4F9593
        91D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3B4ACA695887D918172B6A79AC6B9AECE
        C0B5CFBFB3C8B8ABAB9D92A89C92A79A8F958D86585755969392D3D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3B6AEA8887B6EA49587C6BDB3E8E3E0F1ECE9F4EDE8F2E6
        DFECDBD1D6C4B7BAA99AA49486A0958CA7A29FD3D3D3D3D3D3D3D3D3D3D3D3D3
        D3D3E1DAD5988A7FA59688D5CEC8F6F5F3FFFDFCFFFAF9FFF8F5FFF4EFFFEFE8
        F5E0D6DBC7B9BAA99AA3988EE0D9D5D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3746C
        65928172C7BCB2F6F3F1FEFBFBFFFBFAFFF9F7FFF7F3FFF5F0FFF2ECFEE7DDF4
        DCCFCEB9AA9C8E82CDC4BFD3D3D3D3D3D3D3D3D3D3D3D3D3D3D363574CB0A092
        E8DED9FFF8F5FFF8F6FFF8F6FFF7F4FFF5F1FFF3EEFFF1EBFFEAE1FFE4D7E3C9
        B9B39F8F595047D3D3D3D3D3D3D3D3D3D3D3D3D3D3D38C7C6EBEAFA2F1E6E1FF
        F5F2FFF6F2FFF6F1FFF5F1FFF3EEFFF1ECFFEFE8FFE8DDFFE2D5EACCBDB8A18F
        706358D3D3D3D3D3D3D3D3D3D3D3D3D3D3D39E8E80C9B9ACF5E8E1FFF2EDFFF3
        EEFFF3EEFFF2ECFFF0E9FFEDE5FFE9DFFFE5DAFEE2D5EACBBAB69C8A77685BD3
        D3D3D3D3D3D3D3D3D3D3D3D3D3D3A19386CDBDB0F3E4DCFFF0E9FFF0E9FFEFE7
        FFEDE4FFEAE1FFE8DEFFE8DEFEE9DEFDE2D5E3C2B0AD9481685C50D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3D37B7168CBBBAEEEDDD4FFECE3FFEAE0FFE8DDFFE9DDFF
        EAE0FFEBE1FFEAE2FEE9E0FADDCFD4B39FA089764E443BD3D3D3D3D3D3D3D3D3
        D3D3D3D3D3D3857F79BBADA2DECDC2F8E4DAFEE9DFFFEBE2FFEBE3FFEBE2FEEA
        E1FEE9E0FAE2D5E3C1AEB39682857465C6BDB8D3D3D3D3D3D3D3D3D3D3D3D3D3
        D3D3D3D3D3BDB3AACFC0B4E4D3C7F6E3D8FEEAE0FEEAE1FEE9E0FDE8DEFAE4DA
        E5C9B9BE9F8B96816F887C73DDD5D1D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3
        D3C9C1BCB3A99FD1C3B5DECDC0EAD6CAEED8CCEED7CBE9D2C4DDC6B8BAA3919B
        86747E7166ACA5A0D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3
        CAC2BDC2B8AFC2B6ABD2C2B5D4C2B4D1BDAFC9B6A6BAA89897887995897EB1AA
        A4D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3
        D3D389837E857C74B3A79BB4A89CA094886E655CCFC7C1E1DAD5D3D3D3D3D3D3
        D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3}
      FriendlyName = 'BTN_SoegBruger'
      TransparentColor = clNone
      JpegOptions.CompressionQuality = 90
      JpegOptions.Performance = jpBestSpeed
      JpegOptions.ProgressiveEncoding = False
      JpegOptions.Smoothing = True
    end


Thus the image is loaded into the form as a series of HEX values, and not an image on a hard drive location anymore.

So when I create the form, and get this error message, aborting the creation of the form:

Error reading BTN_SoegVejning2.Picture.Data: System Error. Code: 87. The Parameter is incorrect.

The error is shown as a pop-up box with a n OK button, and when clicking it, the program is returned to where the formcreation was called.

I would like to know what I can do to avoid that error.

As it is not a file on a drive, it is not a question about access rights, or false directory specifications, but only a question of reading the HEX values from the form, which is compiled into the exe file. So what is it ? and is there anything different I can do to avoid this problem ?

The program runs as a SA HTTP.SYS service on a Wondows 2016 Server.

Regards
Soren
Reply
#2
If its a static image, this issue aside its much better to put it in the files or wwwroot dir and use the Image with URL. When its in memory like this, IW has to convert it each and every time to websafe format (PNG, GIF etc)... which takes CPU and RAM...

Is this image static or dynamic? ie do you make changes to the image on the fly?

If you need it dynamic, please make a ready to run simple demo (you can even just modify Guess Demo) and send to use please.
Reply
#3
Hi Kudzu,

No, it's not dynamic. Ones I have loaded an picture onto the iwimage placeholder at design, that's it. The image is small (20x20 pixels).
I then put an onclick event onto it to open up at search form when clicked. The error appears when loading the form, not when clicking the image.

In fact, using this solution, was a work-around form earlier IW versions, where buttons with images was not available. And to be honest I find it hard to believe it should be a better solution to add the image as a file (png or bmp) to the wwwroot dir, and then use an URL, which will mean disk activity when loading program/form, not to mention the dependencies of external files. I have the same image maybe 20-25 times in total for the current number of forms, so it would only be one file, but it would be loaded from disk up to 2-3-4-5 times for each forms, depending on the number of images on if.

For every field on the form, being a key field to a table, I have an image with an onclick event allowing the users to open up a search form, enabling them to search for data for the table in question. Using an image allows me to have a smaller footprint for the option, as an image says "more than 1000 words", as they say.

I am loading the image as a BMP file (delphi's own glyphs) but could make it a png to try that, if you think it would avoid conversion.

Do you recommend I use a image button instead, now these are available in IW ?

And thanks for the explanation, btw.

Regards
Soren
Reply
#4
Hi Soren, Alexandre post a demo here: http://intraweb.net.br/ImageButtons/$/start using image in buttons.
Reply
#5
Hi Jose,

Thanks for your input. I've seen the demo and even have the source to try it out on my own Pc. The images on the buttons are defined as coming from a CSS file under wwwroot, but is in fact pointing to an internet address, ...cloudflare.com, where they are picked up at program start.

Seem neat and handy, but in my book it makes the application depending on availability of a server I have no control over. I cannot even be sure the image I'm using is there when I need it, or even is an image. I'm worried it's an unsafe opening in security. However, I could accept them as images on my disk, or on a in-house server where security is controlled and intact. So it is definitely worth exploring further.

Once again, thanks for your input. I really appreciate it.

Regards,
Soren
Reply
#6
"application depending on availability of a server I have no control over"

Cloudflare is a global CDN (the largest in fact) and likely more reliable than wherever you are hosting your application.
Reply
#7
Soren, First demo show exactly how to use images with NO INTERNET. Just send folder wwwroot with your APP, done.
Reply
#8
Jose: I'll check it out a bit more and give it a try. My application is an internal Intranet application running only on company servers and network, and if it need to pick up data from outside, I'll need to have security to drill a hole in the firewall for me, so keeping it all locally is important.

Kudzu: I do not doubt for a second that CloudFlare.Com is global and large and probably really reliable. What I mean with not having any control over it, is as I write to Jose. To get data automatically (even an image) from the outside, is not an option as I would not be able to guarantee safety. Had my application been public to be used by any surfer, it would be perfect, but with a all internal application, in a highly secure environment, it is not an option. I could create my own images placing them locally and having the application picking them up from a local server. That is just fine, and that's what I will explore further.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)