Pictures as Buttons

Hi to all Members,

i have always tryed to find out about my question, but without positive result.
The asked question is: how to use pictures as buttons, to refresh the image with another picture and/or with another window.

First of all.

Cheers

You can use a Canvas, but by creating your own buttons you’re completely throwing away everything the operating system offers you and the user in terms of accessibility and design.

I would recommend against it.

I use Canvas buttons regularly. Especially under Windows (which is less Stalinian than macOS in terms of design), it is very convenient.

To switch pictures, you can use the Backdrop property.

The trick is to add MouseDown, return true in it, and use MouseUp as Action event.

You can also do very elaborate stuff by painting in the Paint event, such as changing image when the mouse hovers, clicks, releases.

Another way is to use the BevelButton, and its icon property. That way insure that accessibility features are available for handicapped users.

You’re right, but It is supposed to be a kind of tutorial-app, by means of pictures.

Ok, i will try.
Pity that there is no tutorial about this argument. (i can’t find it).

Thanks anyway.

Monsieur Michel,
tell me please how to jump from one picture to another and so on.

Thanks in Advance

in fact canvas is convenient

Change the .backdrop property to a new picture.

Also see this example project:

Examples/Desktop/Custom Controls/CanvasButton

and this discussion:

https://forum.xojo.com/23764-how-to-load-a-picture-in-the-contents-pane-into-a-canvas-contro/0

Jeff already told you a lot.

If you use the backdrop property, it is as simple as doing

Canvas1.backdrop = myPicture

Drop all the pictures in your project, and then call them by name as above. To simplify things, you will have to prepare the pictures so they have the same size as the canvas.

ok Guys, thanks a lot,

i’m gone go to work with it.

After battery charge.

This will certainly help: http://www.jeremieleroy.com/wpg/bin/JeremieLeroy.com%20-%20Creating%20Custom%20Controls.zip