How do I keep a tab
page from advancing to the next record?
How to reference a parent table field in a
child table's field rules
Can I transfer reports and forms from
my home computer to the office?
What do I have to do to set Alpha Five up on
a network?
How do I keep the cabinet guy from
showing up when I start Alpha Five version 4?
How do I center a form on the
screen?
How can I program an exit button for my
application?
|
How do I keep a tab
page from advancing to the next record?
By default, Alpha Five versions 3 and 4 will consider a record entry completed
when the user comes to the last object on a tab page. If entry of a single
record is being split over several tab pages, this creates a problem.
Fortunately, there is a solution. The solution is to prevent the user from
reaching the last object on the tab page. How is this done? It is
accomplished by placing a dummy object as the last object in tab order
on the tab page, and then writing code for the object's OnArrive event that will keep the user from
landing on that object.
It's more easily understood with an example:
Fig. 1. Inserting the dummy object.
In design mode we have several fields on this page of the tabbed form,
and a dummy button that I have named Place_holder. The OnArrive
event script for Place_holder is:
dim pagenum as n
pagenum=Tabbed1.Tab_Get()
tabbed1.tab_set(pagenum+1)
sys_send_keys("{TAB}")
In the button's Properties, you can set the button's text to contain
nothing, and set the border to None and the style to
Transparent:
Fig. 2. Properties of the dummy object.
Setting the properties this way and erasing the text on the button will make
the button invisible when the form is in form view.
Make sure that the dummy button is the last object in the tab order for
the page. Then when the user tabs through the page, she will seamlessly move
from this page to the next and won't even be aware that the button exists.
Return to FAQ list
How do I reference a parent table field in a child
table in a set?
Alpha Five versions 3 and 4 do not allow you to refer to a parent table's
field directly through field rules. However, using any of the lookup()
functions, you can refer to a linked table's fields. There are a 5 different
lookupx functions,
- lookupd()
- lookupl()
- lookupc()
- lookupn()
- and the general purpose lookup() function.
I'll illustrate an example with the general-purpose lookup().
Suppose you have a typical invoice.set, with 2 tables,
inv_hdr.dbf and inv_items.dbf, linked one-to-many on the
inv_no field. Let's say that there is a date field in
inv_hdr and a ship_date field in inv_items. You want to
set the default value for ship_date to be the same as the value
of date in the invoice header.
It's really very simple. In the default field rules for ship_date you
simply insert the expression
lookup("inv_hdr.dbf","inv_no='"+inv_no+"'","date")
The default field rule is found in the Data Entry tab of the Field Rules
editor:

Return to FAQ list
Can I edit my tables and reports at home and bring
them in to the office?
Yes you can, but you should follow a few rules:
- Keep all the tables related to an application in the same Windows
folder. If you create tables in different folders, then Alpha Five will
store the entire path names in the set linkages and the lookup specifications.
If all the tables are in the same folder, then Alpha Five will not store any
path information, and the tables and links are all portable.
- Don't copy the .dbf, .fpt and .cdx files. Those files contain your data.
- For sets, you can copy the .set, .sem, and .sex files. Those contain the
set linkages and the forms, reports, and browses defined for the set.
- For tables, copy the .ddm, .ddd, and .ddx files. Those contain the layouts
defined for the tables.
- Global scripts and functions are stored in the .adb, .alb and .adm file,
but I would not recommend copying those files over. If you write new global
functions and scripts copy them to the clipboard, paste them into Notepad or
another text editor, save them as .txt files, and then reverse the process to
bring them to computer you are updating. (I'm not saying that you can't
copy over the database files, but I have no experience of doing it and the
consequences of an error are severe. If anyone has copied those files without
problems, let me know.)
Return to FAQ list
What do I have to do to set Alpha Five up on a
network?
You don't have to do anything special. Both Alpha Five version 3 and version 4
are already network-ready. You must purchase a license for each workstation on
the network.
- For version 3, you should keep all the files for the application on
the network server. Use the same path to the network server at all your
workstations.
- For version 4, you can take advantage of Network
Optimization, which is covered in a
separate article on this site.
Network Optimization will dramatically increase the speed of your
application.
- If you do a lot of Xbasic programming, then you should be aware that Xbasic
methods that make changes to tables need error-trapping routines, in case a
record is locked by another user. An example of multiuser programming is found
in the article on Renumbering
browse lines on this site.
Return to FAQ list
How do I keep the cabinet guy from showing up
when I start Alpha Five version 4?
Add the -nosplash attribute to the properties for A5. If you have a
shortcut for A5v4 on your Windows desktop, then right-click on it, choose
Properties, and change the Target to include -nosplash.
On my desktop, the Target is defined as
"C:\Program Files\A5V4\Alpha5.exe" -nosplash. Here is where
you put it in the shortcut's Property editor:

If you have a shortcut to an Alpha Five database, change the shortcut to
something like this (it all goes on one line):
"c:\program files\a5v4\alpha5.exe" "c:\program
files\a5v4\samples\invoice\invoice.adb" -nosplash
Return to FAQ list
How can I center my form on the screen?
You can access some system information using A5v4's ui_info()
method. ui_info(0) returns the width of the user's screen in pixels
and ui_info(1) returns the height. This function will take the name of
a form and center it on the screen:
function centerform as L(fname as C)
dim hscreen as n
dim wscreen as n
dim height as n
dim width as n
wscreen=ui_info(0)
hscreen=ui_info(1)
f=obj(fname)
if is_object(f) then
f.restore()
else
f=form.load(fname)
end if
width=f.width
height=f.height
f.top=iif(height<hscreen,(hscreen-height)/2,0)
f.left=iif(width<wscreen,(wscreen-width)/2,0)
f.show()
f.activate()
centerform=.t.
end function
Return to FAQ list
How can I create a button on a form to exit Alpha
Five?
Place a button on your form with the label Exit, or something else
suitable. In the Actions for the button, edit the OnPush event to
read
a5.close()
Return to FAQ list |