Is there anyway I can use my mouse on a picture in an image well

Question about Image well and picture size:
What happens when you have a picture bigger than the size of the Image well box?

I know that scroll bars do not appear. How do I display the part of the pictures that do not show in an Image Well since you can’t scroll to those parts of the picture you cannot see?

What I want to do is to be able to use my mouse wheel to enlarge or shrink my picture and drag my picture so I can see other parts of the picture.

Or Is there another object I can use to do this. either way I will need some programming examples to do it

Thanks for ant help
Dave

you might be better off using the CANVAS control instead

Canvas is the only way to do this. The great thing is that the Canvas lets you do everything. The drawback to the Canvas is that you have to code everything. AFAIK there’s no 3rd party control that does what you’re asking.

FWIW, none of these actions are very hard to do and it’s good practice to know how to manipulate the Graphics content in the Canvas.Paint event since it’s used in many places for various things.

I need help. How do I load a picture into canvas like I do with the Image Well?

canvas doesn’t have a canvas.image or a canvas.picture that I could find
Dave

Look up the Canvas.Paint event. You’ll have to draw everything manually.

That’s NOT going to work because I want to show pictures that is why the image well seem to work so good.
Dave

You should be able to adapt this code to resize an image and keep the proportions correct:
https://forum.xojo.com/2060-resize-picture-to-a-imagewell/p1#p414562

Trust me… Bob (or most anyone else here) would not suggest something that won’t work, and will usually lead to a learning experience that will help you now and in the future.

It is possible (but perhaps beyond the present scope of you knowledge) to create a custom class based on the CANVAS control the WILL incorporate some of the features of the ImageWell and retain the massive flexiblity of the Canvas.

I personally have been using RealBasic/RealStudio/Xojo since 2006 and can honestly say I have NEVER used an ImageWell in a single project, but do use Canvas in almost all of them

Dave I think your quote is askew

It takes me a while to pick up things as I’m not to quick on the uptake anymore either and I’m easily confuse so it’s going to take me a few days to figure put what is going on,

Tim has been very help full with the link he provided and I’m going to study that and hope it helps
Dave

PS someone just invited me to join an Image well replacement but it disappeared before I could click on it.

Hmmm… the forum did that :frowning:

right now I’m going to study the canvas.Paint event. It a whole new thing for me.
dave

[quote=446219:@David Howe]Question about Image well and picture size:
What happens when you have a picture bigger than the size of the Image well box?[/quote]
You may resize down the original image file and use the smaller one into the ImageWell. Or…

Use a different Control. Read below…

[quote=446219:@David Howe]What I want to do is to be able to use my mouse wheel to enlarge or shrink my picture and drag my picture so I can see other parts of the picture.[\quote]
You have work on your plate coding that.

…Yes, as already stated, you can use a Canvas Control.

BUT:
You have to read the documentation to achieve your goal. Specifically, you have to:
a. Put a Canvas using the size you need in a Window,
b. Load the image,
c. Resize down * the image
d. Display it in the Canvas

Links to the documentation:
http://documentation.xojo.com/api/deprecated/canvas.html
http://documentation.xojo.com/topics/user_interface/desktop/desktop_controls/canvas.html#canvas-paint
http://documentation.xojo.com/topics/user_interface/desktop/desktop_controls/canvas.html#canvas-backdrop
http://documentation.xojo.com/api/graphics/picture.html

and eventually (to let the user choose the image file from disk):
http://documentation.xojo.com/api/deprecated/opendialog.html

You can come back here and ask when you are stopped by anything (example: why .Paint / .Backdrop ?)

Have you checked the projects in the Example folder (inside the Xojo folder) ?

Edit: List of Project that are Canvas related in the Example Projects folder:

CanvasAreas.xojo_binary_project CanvasDragRect.xojo_binary_project CanvasDrawDrag.xojo_binary_project CanvasDrawString.xojo_binary_project CanvasScrolling.xojo_binary_project CanvasZoom.xojo_binary_project ObjectsInCanvas.xojo_binary_project ObjectsInCanvas

canvas.Paint event

happens when the canvas is asked to repaint
You get G as a parameter - this is a graphics object, you can draw what you like on it
.drawpicture to add a picture , at whatever zoom or scroll position you want.

if you add the mousewheel event, you can ‘know’ that someone wants to zoom in or out, set properties about zoom size, then call canvas.invalidate

when the canvas paints next, those properties will tell you how big to draw the picture

There are also some other place to get information:
http://www.xdevmag.com/

and:
http://www.xdevmag.com/browse/15.1/15102/

will explain about a book (I Wish I Knew How to… Program the Canvas Control with Xojo Desktop, by Eugene Dakin, fellow member of this forum).

The article above is free, the book is not. Check http://xdevlibrary.com/ for details.

Edit: I re-read the article and have to balance Markus writing. This is a skilled review, not a review for Neville Newbie.

Joe Newbie (as well as Paul Power-User) always learn things from its reading. The diference is in the quantities of learned things. :wink:

…and there is a second edition of this book.

Thanks for all the help. That is what I really like about this forum. You not only try to help a me but you force me to think outside the box (as my wife is always telling me) and after a good nights sleep I have come up with a plan of action.

I’m a programmer by necessity not choice and I really have a hard time learning to code something new. That’s why I need examples.
My problem with last night is that I did Not realize that the image well resizes and or crops a picture so what I do now when I run into a picture that has been cropped is to SHELL the original picture into PAINT and my problem is solved.

I realized that I was trying to build my own version of the view options that PAINT gives me. So why NOT use Paint.

Without the help I got here I would never have realize how easy it was to fix my problem.
Thanks
Dave

If you are using SHELL to solve a Canvas related issue… I will say you are probably running down the wrong path.

Post the code here that you wrote, and let us see if we can point you in a better direction. While SHELL has its place, this may not be one of them

Maybe piDogScrollingCanvas is an option?

Dave I’m sorry I though I posted this yesterday but here is the code you wanted to see.

I put this button in my Image well form (or window) so when I load a pictures (or chart, or map etc) into my image well and it looks distorted or parts of the image are cut off I can just push the paint button and I’m taken to paint and can enlarge the picture and/or edit the picture if I need to.
This works really well on charts or maps where I want to highlight the item I want people to see.
And the other thing is that I don’t have to learn all the ins and outs of canvas but when I have some time I can come back to this post and study it.

'MsgBox “At Button Paint”

Dim s As Shell
s = New Shell
#If TargetWin32 Then
str__PathToProgramWanted = “%windir%\system32\mspaint.exe”
'MsgBox "str__PathToProgramWanted is: " + str__PathToProgramWanted
'MsgBox "str__AbsoultePathToPicture is: " + str__AbsoultePathToPicture

s.Execute(str__PathToProgramWanted, str__AbsoultePathToPicture)
#Elseif TargetMacOS Or TargetLinux Then
s.Execute(“ls -la”) 'not used by me as it’s not a windows operation
#Endif

If it hadn’t been for this post I would never come up this this solution
So I’m really thankful for all the help I’ve been given
Dave

I suppose the typo in Absoulte is not in the real code