Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Help/tips to make this app run faster


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2007, 01:45 AM
Junior Member
 
Join Date: Jun 2007
Posts: 32
Default Help/tips to make this app run faster

Hi all,

I've re-posted this from the end of another thread.

The application is a fuel calculator for the Airbus A330. Prior to push back there is a sometimes complicated procedure to work through with respect to weights and fuel. I thought I might be able to write an application to aid in the procedure. This is my first attempt at any real programming so my code may be a bit messy and hard to follow.

Basically I've created a soft number pad to be used with fingers. The data goes into a table called table1 and is initialised by a table called table1init.

The input field starts on the right hand side of the table and with every push of the ENT button cycles to the next appropriate field. When it comes time to amend the fuel load press the F button to cycle through the various options.

Press the Wt button to access the next page (called CatB) then press the same button again to get back to the Wt page.

I know it won't mean much to most as it is very task specific but I'd appreciate any input.

One last thing. On the desktop the input cell is 'highlighted' so you can see which cell you're working in but on the device this doesn't happen for some reason. Any ideas?

Thanks

JT.
Attached Files
File Type: zip A330 Fuel Calc.zip (3.5 KB, 20 views)
Reply With Quote
  #2 (permalink)  
Old 07-09-2007, 10:11 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,688
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

I wish I had an A330 to play with! A neat little application.

Suggestions

You should load the table automatically on starting the app. This would avoid the exceptions caused by pressing a numeric key before the table is loaded.

You have a neat way of identifying a numeric button but the code is unnecessarily repeated for each button. You could abstract this to a sub as follows. Also I am surpised that B4PPC lets you get away with the syntax "table1.cell(c,r)sender.text", grammatically there should be a string concatenation operator "&" in there.

Sub ButtonX_click
update_cell(sender.text)
End Sub

sub update_cell(key)
if Sound_flag = 1 then sound("Tick.wav")
c=table1.selectedCol
r=table1.SelectedRow
table1.cell(c,r)=table1.cell(c,r)&sender.text
end sub

There also seem to be other bits of oft repeated code such as

table1.cell(table1.ColName(d),4)=table1.cell(table 1.ColName(d),2)-table1.cell(table1.ColName(d),3)

that could be abstracted into a sub. For readability and maintainability of code it is always as well to put a repeated function into an appropriately named sub and pass any needed parameters to it.

You've left a messagebox on the right arrow key!
Reply With Quote
  #3 (permalink)  
Old 07-09-2007, 07:11 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

The code attached replaces all Button0-9_Click with ButtonX_Click sub using AddEvent keyword (agraham idea).
Add Table1.Focus if you want to see the highlighted cell (it is also in the code).
The application ran pretty smoothly on the device, is there a specific method that takes too long?
Attached Files
File Type: sbp A330 Fuel Calc.sbp (9.7 KB, 23 views)
Reply With Quote
  #4 (permalink)  
Old 07-10-2007, 12:06 AM
Junior Member
 
Join Date: Jun 2007
Posts: 32
Default

Thanks Erel and Agrahm,

I'll have a look at it later today. Re the application speed it probably has more to do with my ancient Toshiba e310 device; but any improvements are v. much appreciated

Thanks again,

JT
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
Creating code faster pmu5757 Basic4ppc Wishlist 0 04-13-2008 12:33 PM
How to get the PDA type and make HARRY Questions & Help Needed 3 01-13-2008 12:19 PM
How do I make a textbox go from one to the other sunnyboyj Questions & Help Needed 2 12-17-2007 09:44 PM
Draw and Refresh faster hung Questions & Help Needed 3 08-01-2007 02:00 PM
Help me to make HTMLViewer Lib conf Questions & Help Needed 2 06-17-2007 05:35 PM


All times are GMT. The time now is 02:54 PM.


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