April 19, 2024, 11:19:05 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Value Out of Range Error

Started by TexasPete, December 02, 2010, 06:17:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TexasPete

I am trying to display a bitmap the the screen. I have loaded the bitmap with the load command. I have checked it with stop to see that there is a valid handle.
The handle is global.
I am using the following command to Display it to the screen.

Book example:
SHOWIMAGE window, handle, type, x, y , {w, h{, flags}}

ShowImage win2,BitmapUP,@IMGBITMAP,300,300, 30,30


Thanks
Texas Pete

ckoehn

Below is a section of code that worked for me.  I stored the image in the same directory as the program.

UINT BinImg
BinImg=LoadImage(GETSTARTPATH+"BinImg.gif",@IMGSCALABLE)

WINDOW w1
OPENWINDOW w1,100,100,640,480,@SIZE|@MINBOX|@MAXBOX|@MAXIMIZED,0,"Bin Level",&main
SETWINDOWCOLOR w1,RGB(225,190,128)
BACKPEN w1,RGB(225,190,128)

SETFONT w1,"Times New Roman",12,900

SHOWIMAGE w1,BinImg,@IMGSCALABLE,10,10,100,200


Later,
Clint

GWS

Assuming 'BitmapUP' is an integer variable into which you've loaded the bitmap, there's probably nothing wrong with your image handling.

The 'Value Out of Range' message usually displays when you try to address an out of range element of an array.


openconsole
cls

def a[2]:int

a[2] = 1

do:until inkey$<>""
closeconsole
end


The error in this example arises because the array is defined as having only two elements - '0' and '1' (arrays are zero-based).

So trying to load a[2] is addressing an out of range memory location, which is not permitted.

Have a search for nearby arrays and check you aren't going out of range.

best wishes, :)

Graham
Tomorrow may be too late ..