I assume that mapslist is a Basic4ppc ImageList. It looks to me like a problem with that. I've not looked at ImageList before and assumed it stored bitmap references. In fact it appears that it can store bitmaps as both string filenames and as bitmap references. As ImageList is not as separate control but is implemented by inline code in both the IDE and optimising compiler I can't be sure but it looks as though normally the IDE/compiler compensates for this but in your instance it may not be and is passing an image filename as a string to DrawImage - hence the complaint.
The above is my best guess unless you can post some code that displays this behaviour.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
I'm having a bad few days suffering from a bad winter cold and I suspect my glib reasoning above is not the reason for the problem as I am now doubting my observation about both string names and references being stored in an ImageList. However it does seem that ImageLists, or at least, what is returned from the ImageList.Item(x) method, are treated differently in the IDE and when optimised compiled so I don't really understand what is going on here.
It seems when optimised compiled an ImageList should only contain references, as I previously assumed, so I have no idea why it was trying to pass a string to DrawImage. Perhaps Erel might shed some light on this as it looks like it might be a bug.
You didn't confirm that mapslist was a Basic4ppc ImageList but it seems so.
Was the offending image assigned to the ImageList at design or runtime?
Did this happen with more than one image?
Were there a misture of images in the ImageList assigned at design and runtime?
Is "compilation to desktop " optimised compiled?
You don't have some example code that produces the problem you could post do you?
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
You didn't confirm that mapslist was a Basic4ppc ImageList but it seems so.
Sorry for omitting what was clear for me, yes it is.
Quote:
Was the offending image assigned to the ImageList at design or runtime?
At runtime, the list contains 10 maps of 1000*1000, they are assigned by: mapslist.item(i) = [filename]
Quote:
Did this happen with more than one image?
- yes.
Quote:
Were there a misture of images in the ImageList assigned at design and runtime?
No, all 10 are assigned at runtime.
Quote:
Is "compilation to desktop " optimised compiled?
Yes.
Quote:
You don't have some example code that produces the problem you could post do you?
No, I have a small test program in which the problem does not appear and I attach it without the map (which is 467 KB).
In the meantime - my nav prog is running with the intermediate image but it slows the process meaningfully, so enabling the use of imagelist item in the darwimage will be great advantage for me.
Thank you.
__________________
David Erez
Ramat Hasharon, Israel
No, I have a small test program in which the problem does not appear and I attach it without the map (which is 467 KB).
I am afraid that is not much help. I, or Erel, need to see the problem. I suspect something in the code of the failing application may be confusing the optimised compiler.
To look further we would need either some failing source code or a zip of the Class1.cs file produced after compiling the failing application which is in YourUserName\AppData\Roaming\Anywhere Software\Tzor in Vista or Documents and Settings\YourUserName\Application Data\Anywhere Software\Basic4ppc\Tzor in XP and indicate the name of the Sub where the bitmaps are assigned to the ImageList and also the Sub name where the DrawImage fails.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
The relevant subs:
Initializing the mapslist content:
Code:
... For i = 1To10 mapslist.Add(AppPath & "\maps\blank.jpg") Next ...
then the runtime assignment of maps:
Code:
Sub replace_all_maps(a,b) temp = map_header ind = 0 For i = a-1To a+1 For j = b+1To b-1Step - 1 ind = ind + 1 FN = temp & Format(i,"D2") & Format(j,"D2") & ".jpg" If FileExist(FN) Then mapslist.Item(ind) = FN Else mapslist.Item(ind) = mapslist.Item(0)
It's a bug in your code I'm afraid ( EDIT - no it's not ). I've rearranged the IF statement as I don't like single line IFs.
Code:
If FileExist(FN) Then mapslist.Item(ind) = FN <font color="Red">' Error! assigning a string not an image</font> Else mapslist.Item(ind) = mapslist.Item(0) <font color="SeaGreen">' OK, this is an image assignment</font> EndIf
This works in the IDE because the assignment checks if a string is being assigned and reads the bitmap from the file if it is a string. The optimising compiler just does the assignment without checking.
EDIT:- I've just looked at the help for ImageList.Item and it states that what you are doing should work so it looks like a compiler bug.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Yes. In order to do what the help says is permissible, and works in the IDE, the compiler should be compiling a call to a function called GetBitmapFromString which checks at runtime whether the assignment is a string and if so reads a bitmap from the filename specified by the string. The compiler does this for the parameter to ImageList.Add(something) producing
ImageList.Add(GetBitmapFromString(something))
but not for an assignment to ImageList1.Item(somewhere) where it produces
ImageList1.Item(somewhere) = something
instead of
ImageList1.Item(somewhere) = GetBitmapFromString(something)
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.