RSS
热门关键字:
当前位置 : 主页>嵌入式开发>手机操作系统>列表

GoDB Tutorial: Form Fields

来源:我要研发网 作者: 时间:1970-01-01 点击:




Using Form Builder 字串4

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. 字串1

A quick summary of the widgets

字串5

字串1

(JPEG)

Select
Text Box
Hidden
Radio
Button
Date
Polyline
Signature
Calculator Box

字串6

(JPEG)

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

(JPEG)

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



字串1

For the calculator application 字串6

(JPEG)
  • 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.
(JPEG)
(JPEG)

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

字串1


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 #

字串9

(JPEG)

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. 字串2

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
字串9

sub add_click
Flag=1
endsub 字串4

sub subt_click
Flag=2
endsub

字串8

sub multiply_click
Flag=3
endsub

字串8

sub divide_click
Flag=4
endsub

字串4
(JPEG)

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 字串5
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
字串8

Build and execute the project to see the results

字串5

(JPEG)

字串9

字串6

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
相关文章