Discussion:
2 different results fro the same code!
Jean-Luc Arnaud
2017-08-29 14:21:52 UTC
Permalink
Hi all,

I'm used to test some codes in little test apps before using these codes
in main apps.

Today, I'm facing a very strange issue.

I'm opening a ".ico" file using:

  If SourceFile.NameExtensionMBS="ico" Then
    p=Picture.Open(SourceFile)

    ...

In my little test app, after the second line, p (defined as a global
property of type "Picture) has a depth property of 0, Graphics Nil,
ImageCount 4 And

    p=p.BestRepresentation(MyCanvas.Width,MyCanvas.Height,1)

returns the expected result, that is, the icon matching the closest
properties of MyCanvas.

Now, the same code with the same p property, in my main project, returns
a p object with a depth property to 32, Graphics not nil, ImageCount to 0

and a p.BestRepresentation returning always a 16x16 icon, of course with
the same SourceFile.

The p property is not instantiated, a break point on the second line in
both projects shows a nil p property.

I don't understand what's happening, so any idea, help, suggestion,
exorcism is welcome.

TIA
--
Jean-Luc Arnaud




To unsubscribe, email ***@xojo.com
Jean-Luc Arnaud
2017-08-29 16:27:40 UTC
Permalink
In addition, I just tested to open the .ico file SourceFile in a
MemoryBlock in both projects, the content is the same!

So, in the first project, Picture.Open(SourceFile) returns a Picture
containing 4 icons, as expected (16x16, 32x32, 48x48 and 256x256).
In the second, it returns only the first icon, that is the 16x16 one.

Any explanation?

Thanks

JL Arnaud


---------------------
Hi all,

I'm used to test some codes in little test apps before using these codes
in main apps.

Today, I'm facing a very strange issue.

I'm opening a ".ico" file using:

  If SourceFile.NameExtensionMBS="ico" Then
    p=Picture.Open(SourceFile)

    ...

In my little test app, after the second line, p (defined as a global
property of type "Picture) has a depth property of 0, Graphics Nil,
ImageCount 4 And

    p=p.BestRepresentation(MyCanvas.Width,MyCanvas.Height,1)

returns the expected result, that is, the icon matching the closest
properties of MyCanvas.

Now, the same code with the same p property, in my main project, returns
a p object with a depth property to 32, Graphics not nil, ImageCount to 0

and a p.BestRepresentation returning always a 16x16 icon, of course with
the same SourceFile.

The p property is not instantiated, a break point on the second line in
both projects shows a nil p property.

I don't understand what's happening, so any idea, help, suggestion,
exorcism is welcome.

TIA
--
Jean-Luc Arnaud




To unsubscribe, email ***@xojo.com
Bernd Fröhlich
2017-08-29 17:24:58 UTC
Permalink
Post by Jean-Luc Arnaud
So, in the first project, Picture.Open(SourceFile) returns a Picture
containing 4 icons, as expected (16x16, 32x32, 48x48 and 256x256).
In the second, it returns only the first icon, that is the 16x16 one.
Any explanation?
I assume you are using the same version of Xojo for both projects?

I´m staying at 2017R1.1 right now because in 2017R2 a picture that appears correct in an iOS projekt in R1.1 is rendered HUGE in R2.

Might have nothing to do with your problem though.

Greetings from Germany,
Bernd Fröhlich


To unsubscribe, email ***@xojo.com

Loading...