Xbasic
OBJECT.COMMAND Function
Syntax
.Command([C command])
Arguments
- command
The command to send to the object.
Description
Send a command notification to an object that excepts commands.
Discussion
The <OBJECT>.COMMAND() method applies to:
- Alpha Anywhere (for <OBJECT> use the keyword "A5")
- Control Panel (for <OBJECT> use the keyword "CONTROLPANEL")
- Browses (for <OBJECT> use either the <BROWSE> pointer or the normalized name of the browse)
- Forms (for <OBJECT> use either the <FORM> pointer or the normalized name of the form)
- Form Controls (for <OBJECT> use the <CONTROL> pointer or the address of the control)
The <OBJECT>.COMMAND() method sends a command notification to an object that accepts commands.
Example
The following example shows how to use the CONTROLPANEL.COMMAND() method to limit the number of records that a user can save in a demonstration application.
dim t as P
dim new_code as C
dim tables as C
dim i as N
dim count as N
new_code = <<%code%
t = table.current()
if (t.recno()> 30) then
cancel()
ui_msg_box("Notice","Using an evaluation version. Can't save more than 30 records.")
end if
%code%
tables = a5.Table_Enum()
count = line_count(tables)
for i = 1 to count
StatusBar.percent(i,count)
table_i = word(tables,i,crlf())
table_name = table.name_normalize(table_i)
Xbasic_wait_for_idle()
controlPanel.SetFocus(table_i,"table")
Xbasic_wait_for_idle()
ControlPanel.command("fieldrules")
Xbasic_wait_for_idle()
cmd = "Rule_System:" + table_name + ".code.CanSaveRecord"
eval(cmd) = new_code
rule_system.command("FILE_SAVE")
Xbasic_wait_for_idle()
rule_system.close()
next iLimitations
Desktop applications only.
See Also