1. WinClass Question for Al
- Posted by don cole <doncole at pacbell.net> Dec 17, 2005
- 524 views
Hello Al, When I try to delete the last picture in the directory with retv= VDeleteFile(TargetDirName&newtemp). The file does not delete retv=0. Even if I close the Euviewer program I can not drag the file newtemp (which is the last .jpg file in the diectory) to the trash bin. I get Error in Deleting File or Folder: Cannot delete (The name of the file):There has been a sharing violation. The Source or destination file may be in use. I even add an onClick_ButtonBackward() before the delete to be sure I am not using that file in the viewer. And again I close the veiwer and Edita it still won't drag to trash bin. I suppose if I restart the computer I can drag it that way. I haven't tried that. How can I clear that file so I can delete it. Thanks in advance, Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.
2. Re: WinClass Question for Al
- Posted by Al Getz <Xaxo at aol.com> Dec 17, 2005
- 491 views
don cole wrote: > > > Hello Al, > > When I try to delete the last picture in the directory with retv= > VDeleteFile(TargetDirName&newtemp). > > The file does not delete retv=0. Even if I close the Euviewer program I can > not drag the file newtemp (which is the last .jpg file in the diectory) to the > trash bin. I get Error in Deleting File or Folder: Cannot delete (The name of > > the file):There has been a sharing violation. The Source or destination file > may be > in use. > > I even add an onClick_ButtonBackward() before the delete to be sure I am not > using > that file in the viewer. > > And again I close the veiwer and Edita it still won't drag to trash bin. > I suppose if I restart the computer I can drag it that way. I haven't tried > that. > > > How can I clear that file so I can delete it. > > Thanks in advance, > > Don Cole > A Bug is an un-documented feature. > A Feature is a documented Bug. Hi there Don, As you noticed when the picture is loaded it's not possible to delete it from anywhere that i know of (including Win Explorer), but as you figured out if you simply forward or backward then you can delete the picture. This actually works, and i've already done it a number of times when editing images -- the editors wont let you save the new file until you've forwarded or backwarded to a different pic in the EuViewer. My guess is that when the back button is 'hit' via some code the new picture is the one that the program is trying to delete, so it still wont delete it. If you save the file path of a file, then forward, then delete the saved file path then it will delete properly. You have to be careful not to try to delete the new path instead of the one that you store prior to 'hitting' forward or backward. There is one more trick to be aware of however, and that is that the program must be allowed to uninitialize the GdiPlus library. There is a good chance that if it's not allowed to do this then it might be impossible to delete the file. If in the trace mode, be sure to let the program run and then click the close button as you normally would do when using the viewer. This should allow the program to clean up the library properly as well as the two objects it creates for use with the lib. My experiment was as follows... 1. create a sequence 'CurrentFilePath' just before the procedure "LoadGraphics(sequence FilePath)". Load this with FilePath when LoadGraphics is called so you've effectively stored the last file path viewed. 2. create an integer 'pass' just before the keyboard event for the key 'x', and initialize it to zero. Also create a seq "lastpath". 3. in the keyboard event for the 'x' key, increment pass, and if pass=1 then load lastpath=CurrentFilePath. If pass=2 then call VDelete with lastpath: ?VDeleteFile(lastpath) printing the return value. Start up the viewer and navigate to a temp directory where you can try things out. Get a pic in view, then hit 'x'. Forward the viewer to the next pic, then hit x again, you should see a '1' print out in the console because the previous file was deleted. I noticed that whenever i would try to delete the file in view it would not delete but return a zero as you said, but when i used the above code it did in fact delete and a '1' was printed out. I guess you're trying to put that delete option back into the viewer too then? I believe you are on the right track, to forward or backward first. If there's only one pic left in the directory however, we'll probably have to come up with another way to delete the pic (ie possibly GdipDisposeImage first, then delete). BTW in the older viewer i made it impossible to delete pics unless the viewer was in the 'review' directory, so that pics couldnt get deleted by mistake. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
3. Re: WinClass Question for Al
- Posted by don cole <doncole at pacbell.net> Dec 18, 2005
- 499 views
Hello Al thanks for the quick response. It might be easier to show you what I have so far. Which is pretty much what you say. After the last line of onClickButtonForward() and onClickButtonBachward() I added temp=filename. my code: --count is the number of the pic we're on. elsif char=46 then --delete newtemp=temp if count=totalSupportedFiles then totalSupportedFiles=totalSupportedFiles-1 onClick_ButtonBackward() else totalSupportedFiles=totalSupportedFiles-1 onClick_ButtonForward() end if retv= VDeleteFile(TargetDirName&newtemp) if retv=0 then puts(1,"Can't delete "&TargetDirName&newtemp) end if end if This works fine unless I'm trying to delete the last file in the Directory. Even if there are other files in Dir. Let's say there are 10 files in the dir, totalSupportedFiles=10. And I only want to delete #9, works fine. I only want to delete #10 (the other 9 are still there) It won't delete? Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.
4. Re: WinClass Question for Al
- Posted by Al Getz <Xaxo at aol.com> Dec 18, 2005
- 502 views
don cole wrote: > > Hello Al thanks for the quick response. > > It might be easier to show you what I have so far. Which is pretty much what > you say. > > After the last line of onClickButtonForward() and onClickButtonBachward() I > added temp=filename. > > my code: > --count is the number of the pic we're on. > > elsif char=46 then > --delete > newtemp=temp > if count=totalSupportedFiles then > totalSupportedFiles=totalSupportedFiles-1 > onClick_ButtonBackward() > else > totalSupportedFiles=totalSupportedFiles-1 > onClick_ButtonForward() > end if > retv= VDeleteFile(TargetDirName&newtemp) > if retv=0 then > puts(1,"Can't delete "&TargetDirName&newtemp) > end if > > end if > > This works fine unless I'm trying to delete the last file in the Directory. > Even if there are other files in Dir. > > Let's say there are 10 files in the dir, totalSupportedFiles=10. > > And I only want to delete #9, works fine. > I only want to delete #10 (the other 9 are still there) It won't delete? > > Don Cole > A Bug is an un-documented feature. > A Feature is a documented Bug. Hi there Don, I suspect that your image viewer doesnt support directory wrap around which would prevent it from going to a new picture file anyway, but that's just a guess. In any case, a better all around solution is this... ?GdipDisposeImage(pImage) --unregisters the picture so it can delete pImage=0 --keeps GdiPlus get pic size calls happy ?VDeleteFile(CurrentFilePath) --deletes the file "CurrentFilePath" was loaded as per the last post...within the LoadGraphics procedure (or if you want to do it another way that's fine). You can then have your viewer forward to the next pic unless it wont wrap around to the first pic in the directory, in which case you may want to have it back up one pic or jump to the beginning of the dir. Once the picture is 'disposed of', it does in fact then delete properly unlike what was happening before so when the window is repainted a blank window will show up. One additional note here though... Once a pic is deleted you'll have to update your directory listing if you dont want your user to see a blank window next time they try to display the pic that was deleted. This doesnt bother me any, but if you delete say 10 pics in a row your users are going to have to forward 10 times just to see one pic when all 10 pics show up as a blank window. Im sure there's some simple way to update the directory listing (sequence) so this wont happen. You'll still have to decide what you want the viewer to do if the very last picture in the directory is deleted though. Let me know how you make out with this ok? Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
5. Re: WinClass Question for Al
- Posted by don cole <doncole at pacbell.net> Dec 20, 2005
- 506 views
Al Getz wrote: > (snip) <eucode" Here what i came up with and it seems to work: elsif char=46 then --delete newtemp=temp if count=totalSupportedFiles then totalSupportedFiles=totalSupportedFiles-1 onClick_ButtonBackward() else totalSupportedFiles=totalSupportedFiles-1 onClick_ButtonForward() end if ?GdipDisposeImage(TargetDirName&newtemp) --unregisters the picture so it can delete pImage=0 --keeps GdiPlus get pic size calls happy ?VDeleteFile(TargetDirName&newtemp) --deletes the fil if retv=0 then puts(1,"Can't delete "&TargetDirName&newtemp) end if end if </eucode> {{{ I'm going to E-mail you the whole thing. I think it's done. I'll get your opinion. Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.
6. Re: WinClass Question for Al
- Posted by Al Getz <Xaxo at aol.com> Dec 20, 2005
- 504 views
don cole wrote: > > Al Getz wrote: > > > (snip) > <eucode" > Here what i came up with and it seems to work: > > elsif char=46 then > --delete > newtemp=temp > if count=totalSupportedFiles then > totalSupportedFiles=totalSupportedFiles-1 > onClick_ButtonBackward() > else > totalSupportedFiles=totalSupportedFiles-1 > onClick_ButtonForward() > end if > ?GdipDisposeImage(TargetDirName&newtemp) --unregisters the picture so > it can delete > pImage=0 --keeps GdiPlus get pic size calls happy > ?VDeleteFile(TargetDirName&newtemp) --deletes the fil > if retv=0 then > puts(1,"Can't delete "&TargetDirName&newtemp) > end if > end if > > </eucode> {{{ > > I'm going to E-mail you the whole thing. > > I think it's done. > > I'll get your opinion. > > Don Cole > A Bug is an un-documented feature. > A Feature is a documented Bug. Hi there Don, Looks good to me :) I'll be looking forward to trying out the whole program. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
7. Re: WinClass Question for Al
- Posted by don cole <doncole at pacbell.net> Dec 20, 2005
- 484 views
I have another program written in dos that deletes pictures. But it won't work on the last file in a directory that has been viewed with euviewer3 Did you get my e-mail? Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.
8. Re: WinClass Question for Al
- Posted by Al Getz <Xaxo at aol.com> Dec 20, 2005
- 486 views
- Last edited Dec 21, 2005
don cole wrote: > > I have another program written in dos that deletes pictures. > > But it won't work on the last file in a directory that has been viewed with > euviewer3 > > Did you get my e-mail? > > > Don Cole > A Bug is an un-documented feature. > A Feature is a documented Bug. Hi there Don, Yes i got your email thanks, but when i tried to run the program there apparently was a file missing: "MyFile.e" so the program wouldnt run. Can you send or post this file? Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
9. Re: WinClass Question for Al
- Posted by don cole <doncole at pacbell.net> Dec 21, 2005
- 524 views
Al Getz wrote: > > Yes i got your email thanks, but when i tried to run the program > there apparently was a file missing: "MyFile.e" so the program > wouldnt run. Can you send or post this file? > Sorry Al, I forgot to include my includes ha ha! I resent the whole thing hopefully I got everything. Let me know. Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.
10. Re: WinClass Question for Al
- Posted by Al Getz <Xaxo at aol.com> Dec 21, 2005
- 526 views
don cole wrote: > > Al Getz wrote: > > > > > Yes i got your email thanks, but when i tried to run the program > > there apparently was a file missing: "MyFile.e" so the program > > wouldnt run. Can you send or post this file? > > > > Sorry Al, > > I forgot to include my includes ha ha! > > I resent the whole thing hopefully I got everything. > > Let me know. > > Don Cole > A Bug is an un-documented feature. > A Feature is a documented Bug. Hi Don, Oh ok, he he, i've done that myself a few times. I have a program around somewhere that prints out all the include files for a given program exw...i'll have to dig it out. I'll check my email and the new program and get back here... Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"