I am getting an exception error on the // scaledown if statement which triggers a paint event on the image “MainImg” ( canvas ), i have marked the error line as this << .
It is an exception error with the REALbasic.Rect(-1) which i am not sure what the means.
MainImage is a global string property which is the name of the image.
The puzzling thing is this has been working fine with no problems for maybe 1/2 year , until today. as far as i know i have changed nothing.
here is the code below
[code]dim f as FolderItem
dim p as Picture
Dim nW, nH as integer
Dim ratio as Integer
if MainWin.DBLocation.Text = “” then
if MainImage = “” then
MsgBox “Main Image Not Set”
f = MainWin.PictureFolder.Child(MainImage)
if f = Nil or Not f.Exists Then
Status1.Text = “Photo " + MainImage + " not found”
p = f.OpenAsPicture
if p.Height > 800 then << Exception Error Here /
ratio = p.Height - 400
nW = p.Width - ratio
nH = p.Height - ratio
g.DrawPicture(p,0,0, nW ,nH ,0,0,p.Width,p.Height)[/code]
//p = f.OpenAsPicture
p = Picture.Open(f)
but got the same exception
The photo is a .JPG taken by a cannon. I drag and drop the photo on to my “thumb” canvas, it this reads the name of the photo, gets the location, sets the FolderItem location, then attempts to open the picture with f.OpenAsPicture OR picture.open(f)
below is the drag and drop event
[code]Dim DropImgPath As FolderItem
Dim ImageName As String = MainWin.ItemCode.Text + “-” + format(index+1, “00”) + “.jpg”
Dim rtn as string
If obj <> Nil Then
// copy full size image to _DB
DropImgPath = obj.FolderItem
very simple. a Msgbox takes focus away from the window… when you dismiss it, the window gets focus back, which in turn fires the Paint event, which may display the Msgbbox again, which takes focus away from the window … [add recursion here]