Moving a picture programmatically

I have a picture that I have pasted into a graph. Is there a way to move it programmatically? If I double-click on the picture and change its position in the dialog box, the picture moves and a command like 

DrawPICT -1.32,47.5,1,1,PICT_1

is placed in the command window. If I enter DrawPict ...PICT_1 commands, with different positions, in the command window then my picture moves. But if I use a DrawPict command in a function, it seems to have no effect.

Is there a way to programmatically move a picture once it's in place?

A simple approach for implementing the moving a picture insert in a graph window is by drawing the picture into a subwindow (hosted in your graph) and then calling MoveSubWindow in your function.

 

HTH,

AG

Often a doupdate operation needs to be called to effect a change to a graph.  Don't know what the rest of you code is like to predict if this will help.

You may need to use SetDrawEnv before DrawPICT to set the drawing layer.

The dialog works on a selected draw item. When the item is selected, then the command applies to that item.

Unfortunately, it's quite cumbersome to programmatically alter a particular draw object. Originally, you had to kill the content of the entire draw layer, and then re-draw everything with the amendments you want.

Now, you can do something that is more targeted, but still cumbersome. When you initially create the draw objects, make a "named group" using `SetDrawEnv gstart, name=MyPicture` (where MyPicture can be changed to your choice of name). Then when you want to change that object, use `DrawAction` to erase that group and then you can redraw just that group with amendments.

In the end I erased the layer each time and redrew the object. This is fine for my purposes because I am making frames for a movie. So I draw the current frame, save it as an image file, draw the next one, save it, and so on. Once I have all the images in a folder on my computer, I use QuickTime to make them all into a movie.

But yes, it would be nice to be able to refer to draw items and change their properties programmatically.