首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> Tools SDK >> 正文
GoDB Tutorial: Form Fields
作者:佚名    文章来源:不详    更新时间:2006-5-7 11:24:25

Using Form Builder

GoDB Development Studio comes with a built-in form builder to Create / Modify forms in a GUI environment. GoDB (and the GStudio) supports many UI widgets that can be used in the forms.

A quick summary of the widgets 

Select
Text Box
Hidden
Radio
Button
Date
Polyline
Signature
Calculator Box

Label
Password
Multi Line
Lut
Submit Button
Divider
Grid
Script
Frame Toolbox

Link
Read Only
Check Box
Cancel Button
Image
Popup Box
Embedded Grid
Title Text



For the calculator application

  • Create a New project by the name Operators.
  • Open the home.txt file.
  • Select two LABELS, and change value property to Enter number 1 and Enter number 2respectively .
  • Select two TEXT BOXES and change the Value to 0.

Change the NAME property of the TEXT BOXES in the property window to fNum1 and fNum2 respectively.

To ensure that the user enters only numeric values and does not leave the text box empty the VALIDATE property can be set in the Properties Window"

How do I access the value in Form field variables in GBasic programs?

Preced # to the form field variables NAME property to get access the value in GBasic programs in .bas files.

Example: Print the values of the text fields

Print #Fnum1

result=#fnum1+#fnum2 ’result is local variable so no need to preced it with a #

Select five BUTTONS with values + , - , X , / and Result.

Change the Name property of + BUTTON to Add, - to Subt, X to Multiply, / to Divide and Result button to Result.

Now that the form is ready. Lets create the .bas file by creating the add_click , subt_click etc subroutines by right clicking on the button form fields selecting the script wizards and selecting OnClick option. The first time you do this a dialog box appears, asking you if you wish to create a new bas file. Select ok. Notice that a new .bas gets created with the same primary name as the .txt file. This file contains all the subroutines you will create.

flag=0 ’if the user selects + button then flag =1, if - then flag= 2,
’if he clicks X then flag =3 and / then flag=4

sub add_click
 Flag=1
endsub

sub subt_click
 Flag=2
endsub

sub multiply_click
 Flag=3
endsub

sub divide_click
 Flag=4
endsub

sub Result_Click 
if flag=0 then
MsgBox "Please click on an operator"
elseif flag=1 then
print #Fnum1 + #fnum2
elseif flag=2 then
if #Fnum1 > #Fnum2 then
print #Fnum1 - #fnum2
  elseif
#Fnum1 < #Fnum2 then
print #Fnum2 - #Fnum1
else
print "0"
endif
elseif flag=3 then
print #Fnum1 * #fnum2
elseif
flag=4 then
print #Fnum1 / #fnum2
endif
endsub ’GBasic supports endsub and end sub

Build and execute the project to see the results

 

 

相关文章:
GoDB Tutorial: Form Fields
GoDB Tutorial: Form Fields
GoDB Tutorial: Form Fields
GoDB Tutorial: Form Fields
GoDB Tutorial: Form Fields
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号