Photo display program with smooth control

Discussion in 'Share Your Creations' started by Frank, Jan 10, 2008.

  1. Frank

    Frank Member Licensed User

    this is a small program that displays (jpg)-Photos in fullscreen-mode on the PPC. I am sure there are hundreds of programs that can do that, but I might work on it until it really suits my needs.
    Controlling it is quite simple: Slide your finger across the screen (left to right or right to left) to load a photo, down for help, up to close help.

    It scans the directories given in the file directories.txt for photos. If you try it on the desktop, you need to change the pathes in that file.

    I would like to add more features such as a photo ribbon which can be scrolled, but I fear that the program becomes to slow. It is already quite slow on my XDA Orbit.
    Is there any way to make this program faster?
    Also: after a while I receive an out-of-memory-error, although I am not aware of a memory leak. Does anybody know why?

    Thanks a lot,

    Attached Files:

  2. agraham

    agraham Expert Licensed User

    That's a neat idea to maximise real estate for pictures. However there is quite a bit of duplicated code displaying images that really should be put into a Sub as good practice ,for ease of debugging, dictates.

    I can't see immediately see any leaks in the code. As a clutching at straws suggestion I wonder if your MouseUp sub is being re-entered and causing a recursion problem because it does a lot work and may take some time to run. I would try declaring a global for the sub set to false. Check it on entry to the sub and exit if true otherwise set it true. Set it to false on exit. You could also do something similar to count re-entries - that's if they are happening at all!
  3. Frank

    Frank Member Licensed User

    Memory leak

    thanks for the tip; I incorporated a Boolean variable, and so far I didn't get an out-of-memory error. The program is still slow, though...

    I'll do the code cleanup next time; this time only the new variable...


    Attached Files:

  4. klaus

    klaus Expert Licensed User

    I had the same kind of trouble with bitmaps bigger than the screen which I scroll with a scroll bar.
    Tried it like below, but still got the memory overload message but less often.

    Sub HScroll_ValueChanged
    If Done=1 Then Return
    End sub
    And after the first Out of memory message the variable Done remained at 1 and the bitmap did not move anymore.

    Solved it like below:

    Sub HScroll_ValueChanged
    End Sub

    Of course in scrolling I notice that some intermediate scroll values are not displayed, but this is less anoying than the error message.

    Last edited: Jan 18, 2008
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice