Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Share Your Creations
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.


Photo display program with smooth control


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-10-2008, 02:29 PM
Junior Member
 
Join Date: Sep 2007
Posts: 16
Question Photo display program with smooth control

Hi,
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,
Frank
Attached Files
File Type: zip Photo.zip (56.0 KB, 87 views)
__________________
----------------------------
Frank
(with XDA Orbit)
Reply With Quote
  #2 (permalink)  
Old 01-10-2008, 03:56 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,466
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

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.

Quote:
Originally Posted by Frank View Post
Also: after a while I receive an out-of-memory-error, although I am not aware of a memory leak. Does anybody know why?
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!
Reply With Quote
  #3 (permalink)  
Old 01-14-2008, 11:09 AM
Junior Member
 
Join Date: Sep 2007
Posts: 16
Default Memory leak

Agraham,
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...

Bye,
Frank
Attached Files
File Type: sbp photo.sbp (10.5 KB, 24 views)
__________________
----------------------------
Frank
(with XDA Orbit)
Reply With Quote
  #4 (permalink)  
Old 01-14-2008, 02:56 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 529
Awards Showcase
Competition Winner 
Total Awards: 1
Default

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
Done=1
MapX=HScroll.Value
bmpMap.Value=MapImage.CopyImage(ImageList1.Item(Ma p_I),MapX,MapY,GW,GH)
frmMain.DrawImage(bmpMap.Value,GX0,GY0)
Done=0
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
ErrorLabel(DoneH)
MapX=HScroll.Value
bmpMap.Value=MapImage.CopyImage(ImageList1.Item(Ma p_I),MapX,MapY,GW,GH)
frmMain.DrawImage(bmpMap.Value,GX0,GY0)
DoneH:
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.

Klaus
Switzerland

Last edited by klaus : 01-18-2008 at 10:45 PM.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Photo Picker? Offbeatmammal Questions & Help Needed 0 06-02-2008 04:16 AM
Display barcodes Offbeatmammal Questions & Help Needed 3 05-26-2008 06:02 AM
Display maps klaus Share Your Creations 1 01-23-2008 10:17 PM
Smooth switch between Basic4PPC and Help conniemalan Basic4ppc Wishlist 1 07-19-2007 12:02 PM
display resolution VGA 480*640 BerndB Basic4ppc Wishlist 7 07-03-2007 02:29 PM


All times are GMT. The time now is 06:03 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0