Passing a Picture Array leads in an error

The code below returns an error:

Var Pict(7) As Picture

// Populates the above array

Var thisMouse As New MouseCursor(Pict, 0, 0)

If I pass a standard Picture

Var Pictu As New Picture(30,30)
Var thisMouse As New MouseCursor(Pictu, 0, 0)

Compiles without error.

Ideas ?

Xojo 2022r2
Monterey 12.5
m1 MacBookPro

Because the constructor for MouseCursor takes a single Picture, not an array?

Thank you Charlie for your answer.

There is a second Constructor that takes an array, but no example code is available:

Constructor(width as Integer, height as Integer, bitmaps() as Picture)

I do not checked if there is another Picture Class called bitmap… :frowning:

My wrong answer… current code is:

Var Pict(6) As Picture
Var Pict_Idx As Integer
Var Loop_Idx As Integer
Var Fldr_Cnt As Integer = f.Count - 1 // .DS_Store
Var Curs_FI As FolderItem

For Loop_Idx = 0 To Fldr_Cnt
  Curs_FI = f.ChildAt(Loop_Idx)
  If Curs_FI.Name <> ".DS_Store" Then
    Pict(Pict_Idx) = Picture.Open(Curs_FI)
    Pict_Idx = Pict_Idx + 1
  End If
  If UserCancelled Then Exit

Var Pictu As New Picture(30,30, Pict()) // Now the Pict array is populated…
Var thisMouse As New MouseCursor(Pictu, 0, 0)

Self.MouseCursor = thisMouse

That second constructor is not in the documentation (at least, that I can see?)

Assuming it was, though, surely the correct usage would be:

Var thisMouse As New MouseCursor(0, 0, Pict)

and not

Var thisMouse As New MouseCursor(Pict, 0, 0)

as you have?

Should surely be:

Var Pictu As New Picture(30,30, Pict)

(ie: you are passing Pict variable, not calling Pict() as a function)

That is the error I get when I removed the parents…

Without an example (or someone who knows), I do not know how to code the line, so I tried many things…

This is mentioned in docs for Picture class:

You need to check the graphics files in your folder, they must all have the same aspect ratio, ie: for all of them, width / height (or height / width if you prefer to look at the world like that!) must be the same.

The 7 pictures I load were created using Export after I changed to colored dot inside:

NB: the file size in Bytes is different.
width (19), height (30), resolution (72 dpi) are the same…

I don’t believe that is what that constructor for Picture is for … As far as I understand it, it is for creating multiple resolution bitmap representations of the same picture. Your bitmaps are all the same size, you are presumably trying to do something else? (Animation or something?)

If trying to animate, you will possibly have to create array of MouseCursor, then loop your way through them:

var cursors() as MouseCursor

// populate each with one coloured hour glass

var i as integer = 0

// use cursors( i )

// wait a little

// increment i

// loop etc etc

That is how Xojo use it, but to made an animation, you can do that (gif anime for example).

This code is related to the other Thread:

I found the error. It was in the nextline:
Var Pictu As New Picture(30,30, Pict)

The Declaration, once changed to the real Pictures sizes (1) runs OK:
Var Pictu As New Picture(19,30, Pict)

(1) The loaded Pictures size is 19 x 30… (and not 30 x 30)…