Character Mode Cookbook: Difference between revisions
m
Added to Character Mode category
(New page: on_key KCLEAR : F5 on_key KCANCEL Send Cancel : Esc on_key KENTER : Enter on_key KSAVE_RECORD Send Do_Report : F2 Promt commands df32 dfc...) |
Hsymington (talk | contribs) m (Added to Character Mode category) |
||
(15 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
=Keys and commands= | |||
<source lang="vdf"> | |||
on_key KCLEAR : F5 | |||
on_key KCANCEL Send Cancel : Esc | |||
on_key KENTER : Enter | |||
on_key KSAVE_RECORD Send Do_Report : F2 | |||
</source> | |||
Promt commands | |||
df32 | |||
dfcomp ex.src -pfv1 p=precompile | |||
dfcomp ex.src -fv1 fv1 creates prn-file (check errors) | |||
dfrun ex | |||
dfruncon ex with mouse support | |||
=Declaration= | |||
==Properties and variables== | |||
<source lang="vdf"> | |||
property integer piCount public 0 | |||
set piCount To (piCount(current_object)+1) | |||
</source> | |||
==Move== | |||
local integer liNumber | |||
<source lang="vdf"> | |||
move 0 To liNumber | |||
Move (key+1) to key key = key++ //Dont forget to use paratheses (a+(b*c))<>a+b*c | |||
</source> | |||
get myFunc of (oObj(current_object)) "tmp" to sAnswer // sAnswer = oObj->myFunc("tmp") | ==Set/Get== | ||
-------------- | <source lang="vdf"> | ||
SET | Set value of (oPop(current_object)) item 0 to sVar // item[0] = sVar | ||
Get Value item 0 to sVar // sVar = item[0] | |||
</source> | |||
==Be aware of the difference== | |||
<source lang="vdf"> | |||
Set A of object to B A=B | |||
Get A of object to B B=A | |||
Move A to B | |||
</source> | |||
You can only use Get and Set on properties | |||
=Functions and Procedures= | |||
<source lang="vdf"> | |||
get myFunc of (oObj(current_object)) "tmp" to sAnswer // sAnswer = oObj->myFunc("tmp") | |||
</source> | |||
-------------- | |||
SET | |||
value of OBJ ITEM to VAL | value of OBJ ITEM to VAL | ||
location X Y [ABSOLUTE/RELATIVE] | location X Y [ABSOLUTE/RELATIVE] | ||
focus_mode to POINTER_ONLY | focus_mode to POINTER_ONLY | ||
-------------- | -------------- | ||
Procedure MyProcedure | Procedure MyProcedure | ||
End_Procedure | End_Procedure | ||
Send MyProcedure | Send MyProcedure | ||
------------------ | ------------------ | ||
Procedure DisplayResult String lsValue1 String lsValue2 String lsValue3 | Procedure DisplayResult String lsValue1 String lsValue2 String lsValue3 | ||
set value of (oOutput(self)) item 0 to lsValue1 | set value of (oOutput(self)) item 0 to lsValue1 | ||
set value of (oOutput(self)) item 1 to lsValue2 | set value of (oOutput(self)) item 1 to lsValue2 | ||
set value of (oOutput(self)) item 2 to lsValue3 | set value of (oOutput(self)) item 2 to lsValue3 | ||
end_procedure | end_procedure | ||
send DisplayResult lsValue1 "" "" | send DisplayResult lsValue1 "" "" | ||
-------------- | -------------- | ||
Procedure_Section // used in reports to handle paging in a smarter way | Procedure_Section // used in reports to handle paging in a smarter way | ||
-------------- | -------------- | ||
get MyFunction(self) as iRet | Function MyFunction integer i returns Integer | ||
-------------- | |||
function myFunc string test returns string | End_Function | ||
get MyFunction(self) as iRet | |||
-------------- | |||
function myFunc string test returns string | |||
local string lsRval | local string lsRval | ||
move test to lsRval | move test to lsRval | ||
function_return lsRval | function_return lsRval | ||
end_function | end_function | ||
get myFunc of (oObj(current_object)) "tmp string" to sAnswer | |||
=Start "windows/console"= | |||
<source lang="vdf"> | |||
start_ui // starts a new console | start_ui // starts a new console | ||
ui_accept // has a return value | ui_accept // has a return value | ||
activate_scope // opens a new "window" | activate_scope // opens a new "window" | ||
</source> | |||
-------------- | =Content layout= | ||
/Answer.hdr | <source lang="vdf"> | ||
+--------------------+ | -------------- | ||
/Answer.dat | /Answer.hdr | ||
¦ Answer:_________ ¦ | +--------------------+ | ||
+--------------------+ | /Answer.dat | ||
/* | ¦ Answer:_________ ¦ | ||
register_object oAnswer | +--------------------+ | ||
Object oAnswer is a Client Answer.hdr | /* | ||
register_object oAnswer | |||
Object oAnswer is a Client Answer.hdr | |||
Set location 7 30 ABSOLUTE | |||
On_Key kcancel Send cancel | |||
Object oAnswData is a Form Answer.dat | Object oAnswData is a Form Answer.dat | ||
Line 87: | Line 120: | ||
End_Procedure | End_Procedure | ||
End_Object | End_Object | ||
Send OpenAnswerForm to (oAnswer(current_object)) "test string" | Send OpenAnswerForm to (oAnswer(current_object)) "test string" | ||
-------------- | -------------- | ||
</source> | |||
/oReportView1.SectionName | =Reports= | ||
<source lang="vdf"> | |||
/oReportView1.body | /oReportView1.SectionName | ||
__________________________________________________________________________ | |||
/oReportView1.body | |||
____________________ ______________________ | ____________________ ______________________ | ||
/* | /* | ||
//Activate_View Activate_Report1 for oReportView | //Activate_View Activate_Report1 for oReportView | ||
Object oReportView1 is a Report_View NO_IMAGE | Object oReportView1 is a Report_View NO_IMAGE | ||
Object oMainReport is a seq.Report NO_IMAGE | Object oMainReport is a seq.Report NO_IMAGE | ||
Line 143: | Line 179: | ||
send run_report to (oMainReport(self)) | send run_report to (oMainReport(self)) | ||
End_Procedure | End_Procedure | ||
End_Object | End_Object | ||
procedure Activate_Report_View_1 | procedure Activate_Report_View_1 | ||
send run_report to (oReportView1(self)) | send run_report to (oReportView1(self)) | ||
end_procedure | end_procedure | ||
--------------------------------------------------------------- | </source> | ||
--------------------------------------------------------------- | |||
Object oOrder is a Entry_View_Client oOrder.hdr | =Objects= | ||
<source lang="vdf"> | |||
Object oOrder is a Entry_View_Client oOrder.hdr | |||
Set location 5 8 ABSOLUTE | Set location 5 8 ABSOLUTE | ||
Line 195: | Line 234: | ||
End_Object | End_Object | ||
End_Object | End_Object | ||
</source> | |||
An object can be of different types | |||
Containers | |||
- Entry_View_Client : | |||
- View_Client : | |||
- ModalClient : Needs UI and brakes the flow | |||
Controles | |||
- Entry_Form : Data Aware | |||
- Form : Non Data Aware | |||
- List : Non Data Aware | |||
- Table : Data Aware | |||
[[Category:Basics]] | |||
[[Category:Cookbook]] | |||
[[Category:DataFlex (Character Mode)]] |