GoDB Developer Network
Friday, November 25, 2005
  Lesson 3: Form Controls & Events

Multiplatform Form Builder and Event Handlers

GStudio comes with a powerful Form builder that lets you design Forms visually. Forms in GoDB are text files with XML tags that correspond to different controls that GoDB Supports. When you add a text box to the Form a XML tag corresponding to a text box is created.

Ex:

GoDB Supports the following Controls.

A quick summary of the widgets

Standard Controls











LabelUsed to Display Labels.
TextEdit Box for capturing Data From the user.
PasswordEdit Box for capturing Password From the user.
RadioRadio Button. Controls with the same name are grouped.
CheckCheck Box.
ButtonStandard Button
Image
Frame boxUsed to group controls.
LinkUsed to Navigate between pages. URL property determines the new page.
Read OnlyReadonly box for displaying results etc.
Popup BoxPopup to display help and alert Messages.
ScriptTo Associate a different Bas File to the form.


UI Enhancement Controls


DividerTo Display a Divider between controls
Poly LineSpecial control to display polygons.
Title TextTo set the title for the form.

Enterprise Controls

MultiLineEdit Box for capturing Multiline Data From the user.
List BoxDropDown List box.

Data Related and Special Controls





Look Up Table (LUT)Used to Display a Popup to select master items
like Products,Customers etc.
Embedded GridGrid that can be embedded in a form.
Calculator BoxPopup calculator Control for entering numeric data and calculations.
DatePopup Datebox Control to select date.
Sign BoxPopup Sign box control to capture Signature.
GridFull screen grid to display reports etc.

Form Submit Controls



HiddenHidden box for holding temporary values.
Submit ButtonTo Submit the values of a form to an internet site or to another page.
Cancel ButtonTo Clear the values entered in a form.

Building Forms

This section will demonstrate the process of creating a form, dropping controls and creating event handlers.

Step 1) Create a New project

Step 2) Open Home.txt and select the "Welcome to GoDB" button and delete it.

Step 3) Drop three label controls and Change their values to Enter Number 1 , Enter Number 2 and Result.





Step 4) Drop a Button Control, Drop three text controls and empty the value attributes for the text controls.



Step 5) Right click on the Calc Button -> Script Wizard -> On Click.



Alternatively for Click events you can just double Click on the control.

This should open up home.bas with a empty event handler.

Sub Button1_Click

' Add Handler Code Here

End Sub

Add the following Code to the event handler

Sub Button1_Click
#text3=#text1+#text2
End Sub

Compile and run the application. Enter data in the text boxes and hit the button. The third editbox should show the sum of the numbers entered in the first two edit boxes.

Certain issues remain with this app. First the edit boxes allow characters.

Second the content in the result edit box can be modified. A common way to handle this is to make the edit boxes accept only numeric values and the result box readonly. Here is how this can be done.

Select the text box and locate the validate property , click on the ... button and select the Numeric Check Box and hit ok. Repeat this for the second text box too.



Select the third text box and make Disabled attribute to Yes. Alternatively you can also use a Readonly box for the result.






Multiplatform Forms

The form builder in GoDB can be used to create Forms that have different layout in different platforms. The Master Form is common for all the platforms. To adjust the layout for a different platform just select the appropriate platform tab.





The blue guide line indicates the screen boundaries for the platform.

Here we can see that the form has to be redesigned for palm.

Simply reposition or change the attributes of the controls to suit your platform screen size.



You can see that we have changed the X and Y positions in the Palm Form. This is indicated by the BOLD font in the attribute names.

If you want to remove any attribute you have to do it in the Master page.

When the project is compiled based on the platform selected for compilation the attributes from the appropriate Form will be used.



During the design process sometimes you might want to apply the value of a specific attribute to all the platforms.This can be done by selecting the attribute in the Property list window and clicking on the A button.

If you want to apply all the attributes in a specific control in a platform to all the platforms you can select the control and Right click > Apply to all platforms.

You can also restore the default settings for a control by selecting the control and Right click ->Revert all to default.

You can remove unwanted platforms by right clicking on the platform tab and selecting Remove Platform.



You can add a new platform you can right clicking on the platform tab and selecting Add Platform.



In the popup just select the platforms you want to add or remove and hit OK.



Debugging

GStudio has a powerful built in debugger with break points, watch points etc. Lets see how a program can be debugged using GStudio.

Copy the following code and paste it in home.bas

i=10
j=20
end

Sub Button1_Click
dim lvar
lvar=10
#text3=#text1+#text2
print i
print lvar
End Sub

You can set a Breakpoint by clicking on the left margin or pressing F9 key.



Now Compile the project and click on Start Debug.



This will launch the simulator in debug mode. When you login you should be able to see the Program Trace, That is the Blue markers in the Left Margin.



Now Click on the Button in the simulator.



This should stop the execution at the break point.



You can see the variables and fields in the Watch Window.



When the Execution is suspended by a break point you can use the debug aids to Control the execution.

Click on to "Step Into" a Call Statement

Click on to "Step Over" a Call Statement

Click on to "Step out" of a Subroutine

Click on to execute till the current cursor position

Click on to Continue Execution from the current break point

Click on to Stop the Debug session

Click on to Restart the Debug Session

To reset a breakpoint simply click on the red dot using your mouse or press F9 key.

Form Events

The above examples demonstrated Events that Fields generate, similarly the forms also generate events that are common to all the controls like Mouse Celik etc.

To Generate Form Event Handlers Right click on the form when no controls are selected.



Form_Load Event is called when the form is loaded.

Form_Keypress Event is called the user presses any key.
GetKey() Function can be used to identify the key pressed. KeyHandled method determines if the events are bubbled to the next control or not.


Sub Form_KeyPress
' Add Handler
Code Here
' keycode = GetKey()
' KeyHandled(1)
End Sub

Form_MouseClick , Form_MouseUP and Form_MouseMove

Events are generated for mouse events. GetX() and GetY() functions return the X,Y location of the mouse.
MouseHandled method determines if the events are bubbled to the next control or not.

For Example of a user clicked on a button
Form_MouseClick is called first and if mouse is handled in this event handler you can choose not to process the Button_Click Event.

Sub Form_MouseClick
' Add Handler Code Here
' x
= GetMouseX(0)
' y = GetMouseY(0)
' MouseHandled(1)
End
Sub

Form_Paint Event is called when the Microbrowser is painted. All the drawing routines like DrawLine FillRect etc should be coded here.

Starting with GoDB 3.6 Form_RMouseClick and Form_RMouseUp have been added to handle right mouse clicks on plaforms that support it.

Form Navigation

GoDB uses a microbrowser for rendering forms.

Add a new form to the project. Right click on project explorer and select Add Form.



In the open dialog enter the name Main.
Select Yes when prompted for creating a file.

Double click on the Main.Frm in the project explorer add a few controls to the form and save.

Now open Home.FRM and add a Link Control . Change the value attribute for this control to Load Main. Change the URL attribute to !main.frm.

In godb all references to local files should start with a !.



Note: When Changing primary properties use the Master page. Use the platform pages only for properties that differ from the Master. This is to avoid errors where you might change a property in PalmOS page and compile a Pocket PC project and wonder why the property change does not work.

Alternatively you can just dragdrop a file from the project explorer on to the form and this will create a link control.

Compile and run the project

 
Thursday, November 24, 2005
  Conditional Statements

GoDB Supports Block IF and Single line IFF statements.

ifConditionthen
Statements
Statements
else
Statements
Statements
endifEx:

if a >120 then
print "a is greater than 120"
else
print "a is less than or equal to 120"
endif
print "Program Continuing"



iff condition then Statement1:Statements2
The : operator can be used for separating statements in a single line.

Ex:

iff a > 120 then print "a is greater than 120": goto
!ProceedNext
print "a is less than or equal to 120"!ProceedNext
print "Program Continuing"

Note: GoDB Labels start with a !.



Loops


GoDB supports two types of Loops the For next and While Wend.Loops can be aborted by a Break Statement.The control can be transfered to the loop
begining using a Continue statement.

For Variable = Start to End [Step Increment]
iff condition then Break
iff condition then continue
Next

Ex:

for i =1 to 100
print i
next
for i =1 to 100 step 10
iff i > 50 then break
print i
next



While Condition


While Conditioniff condition then break iff condition then continue
Wend

Ex:

i=0
While i < i="i+1" i="0"> 5 then break
i=i+1
wend




Subroutines and Functions

GoDB allows creating modular applications using subroutines and functions. Subroutines are blocks of code that do not return values. Functions are blocks of code that return values.
Subroutines are defined as.
SUB SubroutineName(Parameters)

iff condition then return
EndSub

To call a subroutine you have to use the CALL statement.

Ex:
Call test1
End
sub Test1
print "Inside Test "
endsub

Ex Sub with parameters:

Call test1(1,"test")
End
sub Test1(a,b$)
print "Inside Test with numeric and string parameter";a;b$
endsub


Note: You should not jump out of a sub using a strong>goto statement.
Use Return statement if you want to exit a subroutine. In GoDB when strings are passed to a sub or function,they are passed by reference . String literals , String expressions , Numeric variables and Numeric Expressions are passed by value.All arrays variables are passed by reference.

c$="test"
d=100
Call test1(d,c$)
print "after Test1 ";d;c$
End
sub Test1(a,b$)
print "Inside Test1 ";a;b$
b$="Welcome to GoDB "
a=120
endsub ' Passing Array dim
a(10)a(0)=10call test2(a)print "After ";a(0)



Endsub Test2(b)print "Before" ;
b(0)b(0)=20
endsub



Recursion

GoDB supports recursion only in Subroutines and not in functions.

Call recsub(1)
End
sub recsub(a)
iff a >10 then return
print a
call recsub(a+1)
endsub



Functions

Functions are defined as

Function FunctionName(Parameters)
iff condition then return
FunctionName = ReturnValue
Endfunction
Functions are called by using them in an expression.
Ex:

t=TestFunc()
print t
End


function TestFunc
print "inside
TestFunc"
TestFunc=10
endfunction

Ex: With parameters

print TestFunc(1,"test")
End

function TestFunc(a,b$)
print "inside TestFunc ";a;b$
TestFunc=a+100
endfunction


Ex: String Functions

print TestFunc$(1,"test")
End

function TestFunc$(a,b$)
print "inside TestFunc ";a;b$
TestFunc$ = b$ +" added in func "
endfunction

Ex: String Functions Passed ByRef

c$="test"
print TestFunc$(1,c$)
print c$
End

function TestFunc$(a,b$)
print "inside TestFunc ";a;b$
TestFunc$ = b$ +" added in func "
b$="Modified in TestFunc"
endfunction

Note: Recursion is not supported in functions.



Dimensioning and Arrays

GoDB Supports creation of Numeric or string arrays using the DIM
statement.DIMI - Integer VariablesDIMF - Floating
Point VariablesDIMS - String Variables
Numeric Array
Ex:

DimI a(100)
for i=0 to 99
a(i)=i
next
for i=0 to 99
print a(i)
next

Note: GoDB arrays are 0 based so when you declare an array of 100 elements the elements start from 0-99.

Multidimensional Numeric Array

Ex:

DimI a(100,10)

GoDB Supports up to Four Dimensions for Numeric Arrays. Only single dimensional String arrays are supported.DimS can be used to define Strings and
String Arrays.
Ex:DimS a$ ' Single String
DimS b$(10) ' Array of 10
Strings.DimS b$(10,5) ' 2-D Array Strings.

One interesting thing about GoDB strings is that they can be accessed as an array of chars. You can also use the Mid$ function to get substrings.

a$="testing 123 "
for i=0 to len(a$)-1
print a$(i)
next

GoDB Strings are internally stored as Null terminated character strings. You need to consider this while setting characters at different positions. This will work

a$="123"
a$(0)="A"
print a$

This will not work because there is a null char at a(3) so the print statement will print only till a(3)


a$="123"
a$(4)="A"
print a$

This will work.

a$="123"
a$(3)="A"
a$(4)="\x00"
print a$
Dim can be used to define String
with explicit sizes.

Ex: String of size 10000

Dim a$(10000)
a$="testing 123 "
print a$

Ex: Array of 10 Strings with 100 chars

Dim a$(10,100)
for i=0 to 9
a$(i)="Hello there " + i
next
for i=0 to 9
print a$(i)
next

Array of strings can also be used like a two dimensional array of characters.

print a$(0,0)

Will print the first character in the first string.Multi dimensional strings (upto 3D) can be declared using the Dim Ex: 2D Array of 10x10 Strings with 100 charsDim a$(10,10,100). You Can use Redim to resize numeric arrays and StrExpand to resize Strings.



Advanced Subroutines and Labels

GoDB supports jumping using the GoTo Statements.
iff a=1 then goto !Cond1
iff a=2 then goto !Cond2
goto !ENDPROG

!Cond1
print "Cond1"
goto !ENDPROG

!Cond2
print "Cond2"
!ENDPROG

To allow jumping based on a variable GoDB supports Label Dereferencing. Using Label Dereferencing the label can be decided based on a string variable and a
Dereferencing {operator.

j$="Cond"+a
goto !{j$}

goto !ENDPROG

!Cond1
print "Cond1"
goto !ENDPROG

!Cond2
print "Cond2"
!ENDPROG

Similarly you can use Dereferencing operator to call Subroutines too.

for i=1 to 3
a$="Test"+icall
{a$}
nextENDSub Test1print
"Test1"EndSubSub Test2print
"Test2"EndSubSub Test3print
"Test3"EndSub

Note:
Dereferencing supports string variables only and not string expressions.Ex: call {s$+1} is not legal.

 
  Variable Scope

The variables have three types of scopes

Any variable that starts with ~ is a global variable and is accessible from any function, subroutine and from any bas file in the project.
All variables declared outside the subroutines and functions becomes a page-scope variable. This type of variable is accessible in any function and subroutine within the same bas file. Variables created in a function or a sub have a LOCAL scope. They can be accessed only within the function.

Example

Home.Bas

Gnum1=10 'Page Variable - this variable can be accessed only in home.bas file.
~glob=20 'Global Variable - this variable can be accessed in all the .bas files.

sub test1

Lnum1=30 'local variable accessible in test1 sub only
print Gnum1 'gNum1 has PAGE scope, so it can be accessed in test1
print Lnum1
endsub

sub test2


print Gnum1 'OK
print ~glob 'OK
print Lnum1 'ERROR : LNum1 local variable accessible in test1 sub only
endsub


Home2.Bas

sub test3
print ~glob 'OK - if home.bas was loaded first and ~glob was initialized.
print Gnum1 'ERROR : Gnum1 is accessible only in home.bas
print Lnum1 'ERROR : LNum1 local variable accessible in test1 sub in home.bas only
endsub

 
  GoDB Lite Reviewed on All About Symbian

Below the review of GoDB Lite Edition. You will now surely understand why I stand by GoDB.

Source: www.allaboutsymbian.com

Published by Steve Litchfield at 15:57 GMT, October 14th 2005 under Applications in Series 60, N-Gage


Steve Litchfield reviews Go-DB Lite, a new development system for Symbian Series 60

Version Reviewed: 3.6

Score: 75

So you've thought about writing a little program for your Series 60 smartphone?

At the one end of the programming spectrum you have the wizards at Zingmagic, EMCC, Synergenix and so on, all working in Symbian-optimised C++. To become productive in C++ for Symbian OS takes a long time, a really long time. We're talking about man months. And at the end of this time if you've not got an IQ of at least 150 then the chances are all you'll have done is give yourself a headache. It's OK if someone's employing you to learn, but the chances are you're having to learn in your spare time, in which case you won't have much of a social life for a while.

Somewhere near the other end of the spectrum is your favourite and mine, OPL, the BASIC like language created by Psion and which has worked well on everything from Psion palmtops to Nokia and Sony Ericsson smartphones. There are keywords for menus and dialogs and a clutch of handy file and graphics routines, but you're largely on your own and can create anything you like. To produce a decent application in OPL, from scratch (with no prior knowledge), you're looking at a week of work, even if you'll be avoiding the headaches of C++. (For more on learning OPL, see Ewan's book). In addition, OPL doesn't currently run on any of the Symbian OS 8 devices, and that's most of the really cool ones.

Go-DB Lite is designed to sit even closer to the 'easy' end of the programming spectrum, letting you produce Series 60 applications quickly and efficiently, although with a few rather important caveats. It's unashamedly a form-based tool, making it superb for typical business 'calculator' or 'data collector' style applications and a pain in the neck for anything graphical or involving real time operations, for which you have to hand craft BASIC-like statements in the code editor windows. If you can define your application idea in terms of a number of separate 'screens' (forms), with text and numbers to be filled in and with other screens and windows appearing depending on what you entered, then you're on your way with Go-DB Lite.

GStudio IDE

The built-in 'emulator'Go-DB (without the Lite) is a lot more expensive and designed to handle 'enterprise' applications, run on any portable device with a Go-DB runtime for Palm, Pocket PC, Series 60, etc. Go-DB Lite is a new venture, with ConsignTech recognising that many hobbyist Series 60 users would find it rather fun to write their own programs. One example of the slightly changed focus of Go-DB here is the inclusion in the excellent Help screens of a section called 'Game functions', which include routines to display images and play sounds. These game functions are very much tacked on to main product, which remains focussed on string variables and forms, but they do work. To prove the point, here are a bouncing ball and TicTacToe in SIS format (try them), both examples supplied with Go-DB Lite. The integration of graphics and sound with the main development system is a little arcane and disappointing: having dragged an image onto a Go-DB form, it's shown only as a black rectangle of the wrong size (though GIF files can be 'rendered' if you dig deep into 'Options'). You then have to manually resize it and generally 'imagine' what it should look like.

Working on a simple application that uses forms and popup boxes is a lot more straightforward, I knocked up this VAT calculator in (literally) 10 minutes. And, unlike the current version of OPL, it runs on any Series 60 phone. Pretty cool if your intended application falls in this genre. Every application is forced to have a 'login' screen (where things like user tracking and activation happen), another result of Go-DB's enterprise heritage, although you can bypass this and move straight to your main form with a single command.

GStudio, the Go-DB IDE (Integrated Development Environment), is pretty comprehensive once you take into account the caveats mentioned above. A browser on the left shows project files (forms and BASIC code modules) and images, with each coming up in its own window in the main space, where it can be tiled, hidden or maximised. A properties pane is usually present on the right hand side and individual properties are easy to change, with alterations shown immediately in the appropriate form windows. An array of tools for designing forms is dominated by form controls (list boxes, etc). Finally, an output window at the bottom of the IDE shows warnings and any success messages, plus any debug information if you've asked for this.

GStudio has been pre-programmed with the right product IDs for most recent Symbian Series 60 devices and the IDE can build SIS files for a particular device if needed. For most purposes though, it's easy enough to specify a 'Generic Series 60 device', which will run on anything from a Nokia 7610 upwards. Your application gets packaged with the 320K Go-DB runtime, making even a trivial utility appear to be the best part of half a Megabyte. When run, the RAM useage is similar.

The build SIS optionsQuite apart from the omissions in the image-handling department, there are other signs that Go-DB Lite isn't a mature product yet. The main 'Build' menu has options for 'Compile', 'Build', 'Rebuild all', 'Clean', 'Run', and so on. I appreciate that there are probably distinctions between these at the code level, but all a new user wants to see is a single option: 'Build'. Or, better, 'Build and run'. Similarly for the multitude of device build options ('Nokia 6260, Nokia 6600, etc.), when the vast majority of people will simply want to build for a class of device (e.g. Symbian OS 7 or 8), so that their application runs on as many devices as possible without having to make lots of different versions. A 'Check for new updates' option on the main Help menu seems like a good idea but, when run, offers a page of 'more recent' modules - these are largely irrelevant to Go-DB Lite and they're all also around a year old, at which time Go-DB Lite hadn't even been created.

If all this seems over critical, then I make no apologies. If Go-DB wasn't any good then I'd just slam it and move on, but it's actually got potential and I'd rather the developers saw enough interest in the product that they put work into improving it. I'm going to persevere with Go-DB because (in the absence of a OPL runtime for modern devices) it's about the only way for users to program their smartphone without having to spend months learning Symbian dialects of Java or C++.

So, with a view to using Go-DB Lite in earnest, I set up trying to convert my Hangman game (previously written in OPL). First, a couple of screenshots, so that you can see that I did get there in the end:

Hangman image Hangman

Most of the core formulae could be used as-is, with GBasic only differing from OPL (or any other BASIC) by a few characters here and there. Even the graphics handling turned out to be similar to OPL. Having to store images on forms, retrieve them to a hidden string buffer and then draw them onto a form as needed, isn't so different from retrieving image files into graphics ids in OPL and then copying them into an on-screen window. The biggest difference was the form-based, object-oriented approach, which means that you have to think in terms of specific forms that paint themselves according to the BASIC code you've specified. Keypresses while a form is shown are handled within a Form_Keypress subroutine, and so on. Once you get used to this, most applications could be adapted fairly easily, although I suspect that real-time arcade games would be somewhat harder.

The main showstoppers I found were to do with the lack of maturity mentioned above. For example, I was trying to use a sprite array (for the Hangman 'hung' images), but a bug in the Go-DB system meant that sprites weren't always shown correctly. I also started getting an 'Internal error, please contact support', which is never a good sign in an application. The building to SIS format is also lacking in sophistication - there's currently no way to automatically include your own version number or include your own certification '.key' file, so that the SIS file is signed as being 'from' you. (In practice, you could build your own SIS using the standard Symbian MAKESIS utility, but this should really be handled by the IDE that you've paid good money for.) Finally, you can only write a single font on screen at present. For most applications this simply isn't good enough.

Back on the positive side, there are some pretty powerful Symbian smartphone-specific system functions, though you have to dig pretty deep into the Help screens to spot how to use them. You can send and receive SMS messages, check GPRS/Bluetooth/battery status, make and receive voice calls and even play back video files directly, which is very cool for such a RAD tool.

Although the purchase price of $200 is enough to put casual users off, there's a trial version, meaning that you've got no excuse for downloading and at least having a play. For the company looking to make a custom 'calculator' or database-driven application for deployment to its employees' smartphone, Go-DB Lite is just the ticket. For the home user with a good idea for an application or game, Go-DB Lite is a viable option, even if you do currently have to work rather harder than you ought to.

With more development and 'polishing' (and I'm sure this will happen in the very near future), Go-DB could become a genuinely mainstream system. Watch this space for an updated review in a month or so, once ConsignTech have released another version or two...

 
Wednesday, November 23, 2005
  Reviews & News on GoDB
Mobile app dev tool adds Windows Mobile 5.0

Source: www.windowsfordevices.com
Oct. 10, 2005


Consign Technology (Consigntech) has added support for Windows Mobile 5.0 to the latest release of its multi-platform tool for "rapid" development of mobile business applications. Consigntech characterizes GoDB as a "Develop Once, Deploy Anywhere" platform that runs applications on devices ranging from handhelds to desktops.

The GoDB IDE includes a GUI forms builder, scripting engine, and embedded RDBMS database with an ANSI SQL-92 engine, according to Consigntech. New features in version 3.6 include extending applications with native DLL-based objects, enterprise contols such as grids and lookup tables, and 2D gaming functions.


GoDB IDE screen shot
(Click for larger view)

GoDB applications can be designed to run offline, online, or in a "hybrid" mode, according to Consigntech. Offline appications cache their data on the client until a secure connection is available for synchronizing with the server. Online apps assume "always on" connectivity for real-time information exchange. Hybrid apps rely on "master data tables" stored on the device, which are periodically synchronized with the server. The user executes real-time transactions using the local tables.

Consigntech will shortly release a "Lite" edition of GoDB without the embedded database. The company says the Lite version will target non-enterprise developers looking to develop applications such as utilities and 2D games.

The GoDB Enterprise IDE retails for $499. Educational and non-commercial applcations can be deployed free. Commercial deployments require seperately purchased VM licenses. A 30-day free trial download is available here after registration.







 
  GoDB Enterprise Edition -- Data Sheet
Develop Once, Deploy Anywhere

GoDB is a Multi-Platform Application Development tool for developing handheld and wireless applications. GoDB lets you develop applications you code once and deploy them to multiple platforms like Windows Mobile (Pocket PC, Smart phone, Win CE), Palm OS, Symbian, Linux, Windows, etc. without any change.

GoDB SDK comes with an IDE that lets you create, modify, build, run, simulate, debug and deploy your applications to multiple platforms from familiar Microsoft Windows.

IDE has the following components:

  1. Form Builder.

  2. Simulators for devices/PCs.

  3. Integrated source level debugger.

  4. Single click CAB / SIS / Setup package creation

System requirements:


Recommended Hardware:

Features & Description:

Portability:

Application once developed using GoDB is portable across multiple platforms like Windows Mobile (Pocket PC, Smart phones, Win CE), Symbian, Palm, Linux, Embedded Linux and Windows.

Security:

Built in support for security at various level like on Device, data transfer and server side. GoDB by defaults provides support for AES encryption; other third party encryption can also be supported.

External Component:

Other platform requires separate licenses to be purchased for Embedded databases (SQL CE, Oracle Lite). In case of GoDB, the Run time client has the embedded database (ANSI SQL Compatible).

Form Factor:

GoDB has a browser based Interface, hence creating complicated scrolling forms is easy, in case of large forms the scroll buttons appears automatically. Fields for lookups auto populating transaction fields etc can be inserted into the form without the need for even a single line of code.

Focus Target

Unlike other platforms, which are for general-purpose application development, GoDB focus mainly on business application so the UI widgets required for biz apps are already a part of GoDB. Moreover, GoDB is optimized for database operations like lookups, filters, reports etc making GoDB apps much faster than other comparable platforms. This means that most of the business application components need not be coded from scratch.

Online - Offline:

GoDB applications can transition between online and offline seamlessly and can also operate in hybrid modes where transactions can be online with offline masters.

Compression:

GoDB comes with in-built compression technology, which compresses data up to 70% there by reducing the sync times between the device and the application.

Database Compatibility:

In Non-GoDB application, the Embedded RDBMS requires the server version of the same RDBMS (for eg Oracle lite requires Oracle on the server side). In case of GoDB it is compatible with SQL Server and Oracle.

Multi Lingual Support:

GoDB has a Language abstraction layer built in. Due to this GoDB can support multiple languages with one screen. GoDB can also support languages, which are not natively supported by the Hardware.

Power Management:

Built in support for software power management. This enhances the battery life of the PDA while running the business application.
 
  GBasic Variables and Objects

GBasic has two types of variables, numeric and string variables.

String variables and functions that return strings always terminate with a $.

Ex: A$,B$, Mid$(a$,1,2) etc

Variables without a $ at the end are considered to be numeric variables.

GBasic has two types of objects , Form Field Objects (Controls on a form) and Database Field objects.

Form field objects precede with a #

Ex: #UID , #UID$ etc.

Database field objects precede with a @

EX: @a.ID, @a.Name$




GBasic Operators

Operators For Numeric variables

+ ADD
- SUB
* MULT
/ Division
\ Integer Division
% MOD
^ Integer Exponent

GBasic supports the following Comparison Operators.

> Greater than
< Less Than
= Equal
<> Not Equal

GBasic supports the following Logical Operators.

AND OR

Operators For String Variables

+ Append
EX:

B$="Test1"
A$=" Hello " +B$


Note: When appending a large number of strings use Concat Function instead of the + operator.

You can also append numeric literals, variables and expressions to strings.

' Numeric Literal

A$=" Hello " + 100.25

'Numeric Variable

c=100
A$=" Hello " + b$ + c

'Numeric Expressions appended to strings

c=100
d=200
A$=" Hello " + b$ + (c+d*20)
A$= (c*10+23) + " Hello There "
A$ = "Ubound of array is " + ubound(st$)
A$ = "Len of String is " + len("Hello")
A$ = "Len of String is " + len("Hello") +20 +" Done "
A$ = "Len of String is " + ( len("Hello") +20 ) +" Done "

GBasic supports the following String Comparison Operators.

= Equal
<> Not Equal

EX:

if a$=b$ then
print "a is equal to b"
endif

String Escaping

Special chars like " etc are escaped with a back slash '\' in a string Literal.

Ex
a$="Hello there \"124\" "
a$="Hello there \n"
a$="C:\\Temp\\a.txt"

Special Chars

\n - New Line
\r - Carriage Return
\t - Tab
\" - Double Quote
\' - Single Quote
\\ - Backslash

Other chars can be specified by specifying the HEX value prefixed \x

EX:
a$="Hello there \x0D \x0A "

Special Numeric Statements

You can use C Style Increment ,Decrement and Cumulative Numeric
statements

Increment ++
Decrement --
Cumulative Numeric , +=
, -= , *=
etc
Ex:
a++
b--
a+=10
a-=20

Etc: Note these commands cannot be used in expressions.
Ex
: a = b+(c++) is not allowed.

Numeric Literals in other bases Hexadecimal and Binary.

GBasic Supports Hex Literals of the format &hAABBCC and binary Literals &b1010

Ex:
' Hex Literal
a=&hEF10D
'
Binary Literal
b=&b10101
'String Append with Hex Literal
a$="Test "
+ &amp;hEF10 + "*" + &b10101

' Convert Decimal to Hex
print
Format$("%x",1000)

 
  GBasic Introduction & Program Structure

GBasic is a variant of the Basic Language included in GoDB platform as the scripting language.It’s a simple and easy to language for the average and new entrant developer to program for mobile devices without the need for knowledge of the mobile platform concerned and high end language

Program Structure

GBasic programs are usually associated with a form and have the same name as that of the form.

For example

Home.Frm will have an associated BAS file in the project called home.bas.
When Home.Frm is loaded, GBasic scripting engine loads home.bas and executes all statements, till the END statement is not encountered.

Home.bas

a=10
b=20
print a,b
END
sub Button1_click
msgbox "Button clicked"
endsub

The program can also have subroutines that are event handlers for controls in the form, like a mouse click event on a control.

Event Handlers have names that are of the format ControlName_EventName

Ex: Button0_Click


 
Tuesday, November 22, 2005
  Lesson 1: Creating a project, Event Handling and General GoDB Files using GoDB Lite for Symbian S60 platform

The basics first. GoDB is a Multi-Platform Application Builder.


With GoDB you can :

Develop Once Deploy to any popular PDA,Laptop or Desktop.

Develop Online / Offline and Occasionally Connected applications.

GoDB VM has Two primary components.

  1. Microbrowser for rendering forms.

  2. GBasic Scripting engine.

GStudio IDE has the following components.


  1. Form Builder.
  2. Simulators for devices/PCs.
  3. Integrated source level debugger.
  4. Single click SIS Pckaging .

Creating a Project

In this tutorial we will see how to create a simple Hello World application.

Step 1: Launch GStudio

GStudio is the RAD(Rapid Application Development) IDE(Integrated Development Environment) for developing GoDB applications.


Start Menu-->Programs-->GoDB-->GStudio.





Step2: File->New Project.

Select the Project Type "Hello World Application".

Select the Project Directory by clicking on the button next to "Location".

Enter a Project Name in the "Project Name" box

Select the Platforms for which you want to build this project

Click OK button to create the project


Note: You may add additional platforms to the project any time later.





This should create a project, add some startup files.

Lets look at the files that were created now.

Logon.frm All GoDB projects start with a logon screen so that the user can login
before using the application.


Home.frm When the user logs in successfully, this page is loaded.
Config.frm,Config.ini These pages are for viewing and storing configuration
information. We will see how to use these pages in detail in later chapters.

Now Lets compile and run the project. Make Sure the Platform is in Symbian OS 7.0






Compile.





Run





You Should see the Login Screen in the Simulator





Click on Soft Key 2 or On the Keyboard Press F2. Soft Keys are Mapped to F1 and F2.





You Should see Home Page now click on the Soft Key 1 Or Click F1.





You can Click Enter (Joystick ) or Click on the C Button to dismiss the dialog.




Writing Event Handlers

Event handlers in GoDB are GBasic scripts that are invoked when an event on a control is fired.

In the IDE Open home.frm by Double clicking on it in the project tree.






When the form opens up Double click on the "Click Me" Button.






This should add a bas file called Home.bas and open up the code editor where you can write GoDB GBasic Scripts.










GoDB Files

GoDB Projects have three types of files.

FRM files that have forms.
BAS files that have scripts for event handlers.
BIN files for storing images.

When a project is compiled all these files are bundled into a single BDB file. The GoDB VM loads and executes this BDB file.

This BDB file is platform neutral so you can copy a BDB file created on one platform say Win32, copy it to an another platform say Linux your application should run without any change.

GoDB Achieves Platform neutrality by having separate GoDB VMs for separate platforms.

When you distribute your applications you just need to bundle the BDB file and the GoDB VM for the platform you wish to run the application on.

 
  Getting Started With GoDB

GoDB is a Multi-Platform Application Development tool. GoDB lets you develop applications you code once and deploy them to multiple platforms without any change. GoDB SDK comes with an IDE that lets you create, modify, build, run, simulate, debug and deploy your applications to multiple platforms from familiar Microsoft Windows.


Loading and Running a sample project

Step 1) Start --> Programs --> GoDB --> GStudio


Step 2) File --> Open

Step 3) Select the Project to load (Sample1)

Samples are located under the GoDB Installation Folder.
Ex: C:\Program Files\GoDB\Samples\Sample1\

Step 4) Select the Platform to target.


Step 5) Build .


Step 6) Build Results .

Step 7) Run.


Step 8) Log in


Step 9) Home Page.


Step 10) Hello World.

 
  GoDB : A multi platform Mobile Application Development Tool
Mobile Application Development Tool

GoDB is a multi-platform rapid application development tool for developing handheld and wireless applications. Applications developed once on the GoDB platform can run on devices ranging from Handhelds to Laptops to Desktops and on all popular Operating Systems like Windows, Linux, Palm OS, Windows CE, Symbian etc.

GoDB applications can be designed to be Offline, Online or Hybrid. Offline applications are those that do not require network connectivity to work. GoDB intelligently caches the required data on the client so the application can continue to run even when connectivity is not available. When the connection is restored the data is synchronized with the server securely.

Online applications can be built that utilize "always-on" connectivity for real-time information exchange. GoDB allows you to design Special Hybrid applications that store large master tables on the device which are synchronized periodically while allowing the user to execute realtime online transactions using the local tables.

Features

• Multi Platform - Write Once Deploy Anywhere.
• Develop Offline and Online applications.
• Develop Special Hybrid applications with local masters and Online transactions.
• Multi Layer Security Built in.

GoDB VM Features

• Microbrowser for rendering data capture forms.
• RDBMS with ANSI SQL-92 engine for storing data on handheld.
• Support for special GUI controls like Grids, Lookuptables, Signature capture fields etc.
• GoDB VM requires only 500KB storage and only a minimum of 256KB memory.
• Integration with IDE for secure remote debugging.
• Encrypted DataBase support.
• Native device features can be accessed using loadable modules.

GoDB Platform Features

• IDE with source level debugger.
• Simulator for all supported platforms and devices.
• Built-in code versioning system in the IDE.
• Integrated RDBMS with ANSI SQL-92 support.
• Simple scripting commands to be learnt.
• Support for multi-lingual and right to left fonts (Arabic/Hebrew).
 
Welcome to the unofficial GoDB Developer Network. This blog is completely dedicated to GoDB platform -- a multi platform Mobile RAD tool for developing handheld and wireless applications for Windows Mobile (Pocket PC,Win CE, Smartphones), Palm, Symbian, Embedded Linux, Linux, Win 32, etc. Fellow GoDB developers can find sample codes, contribute to the blog and Mobility related news for the benefit of the mobile development community as a whole.

ARCHIVES
2005-11-20 / 2005-11-27 / 2005-12-04 / 2005-12-11 / 2006-11-05 /


Powered by Blogger