R2016.1 - Picture.Objects are neglected ?

I have a project where I assign a group of 2dObjects to the picture.objects property. It worked fine on older versions
but it seems in R2015.4 and higher it won’t work anymore. Do I have missed any information or is it just a bug ?

https://www.dropbox.com/s/cvsastyetunh6n8/Picture_objects.xojo_binary_project?dl=0

If you end the dropbox link with 1 (instead of 0), the download is done instead of displaying a web page.

I will get an eye on the project with the free Xojo 2016r1 and make report, eventually.

Noted.

OK: I saw nothing on screen running the project in the Xojo 2016r1 IDE.

Running with 2015r1 displays the Hello world.

Tested on OS X 10.11.4

New code:

[code] dim p as new Picture(g.Width,g.Height)
dim g2d as new Group2D
dim s as new StringShape
s.Text = “Hello World”
s.VerticalAlignment = StringShape.Alignment.Center
s.HorizontalAlignment = StringShape.Alignment.Center
s.X = g.Width/2
s.y = g.Height/2
g2d.Append s
p.Objects = g2d

// This is new: get an eye at StringShape in the docs
g.drawObject(s)[/code]

This displays the Hello World string.

Hey Emile,

2016R1 and 2015R4 won’t work. I have tested it. Unfortunately I had a good reason to use the objects property
of the picture class. I will submit a feedback base.

The code you’ve changed is trivial as you attach the the stringshape to a group2d assigns it
to the picture.objects property (which doesn’t work currently) and then draw it separately by drawobject.

The objects property has the advantage that all objects are drawn, once you draw the picture somewhere via
drawpicture.

Hy Rob,

I do not understand. I get an eye on the documentation, saw they use DrawObject(s) an feel like if I found something that worked. I will get an eye later.

Maybe this will be better:

dim p as new Picture(g.Width,g.Height) dim g2d as new Group2D dim s as new StringShape s.Text = "Hello World" s.VerticalAlignment = StringShape.Alignment.Center s.HorizontalAlignment = StringShape.Alignment.Center s.X = g.Width/2 s.y = g.Height/2 g2d.Append s // p.Objects = g2d // g.DrawPicture p,0,0 g.DrawObject(g2d)

Nota: your code, in the debugger does not display anything in p if the debug red dot is set to the last line of your code.

I tried to make a copy of p in the clipboard and I get a NilObjectException (I think). Then I go to the StringShape entry of the Doc…

[quote=259302:@Emile Schwarz]New code:

 dim p as new Picture(g.Width,g.Height)

This depth argument needs to be passed to the constructor and be 0 for vector images. For example:

dim p as new Picture(g.Width, g.Height, 0)

This isn’t a new requirement and the documentation touches upon it:

Just to break it down what I wanted to say:

The picture.objects are not drawn if you attached objects to.
Prior to release 2015R4 all objects in picture.objects were drawn to the content if you used:

_paint(g as graphics, areas() as realbasic.rect)
dim p as new picture(…)
p.objects = xxx
g.drawpicture p,0,0

[quote=259315:@Joe Ranieri]This depth argument needs to be passed to the constructor and be 0 for vector images. For example:

dim p as new Picture(g.Width, g.Height, 0)

This isn’t a new requirement and the documentation touches upon it:[/quote]

OK. I have no clue why the old code worked well in all other versions. I never used a depth of 0. Probably that
been fixed in one version or in the process of the redesign of the picture class due to HiDPI.

It’s true the original code works as excepted when setting the depth to 0.

Thanks you guys for clearing it up! :slight_smile:

We can talk about this ad lib… but the code I suggested works.

Also, in the Object2D and StringShape entries not a single word about the specific for Vector Graphics initialization. But this recalls me something Thanks Paul.

At least, I do not consider nor recommand the use of Object2D a good idea. Eventually only for displays (so no File I/O).

BTW: I found Here a description of the use of the 0 Picture.Depth property (but there can be other pages…).