Date post: | 14-Jan-2016 |
Category: |
Documents |
Upload: | jailyn-lodge |
View: | 228 times |
Download: | 0 times |
Programming Tips for .NetUI
Tammy LonsberrySr. Programmer/Analyst
Sungate Solutions, Inc.
About me Tailoring and customizing Progress 4GL code for
QAD users since 1995 Most versions (Mfg/Pro 7.3 – QAD EA 2013 SE) All User Interfaces (CHUI, GUI, Desktop, .NetUI) Progress and Oracle db’s
Active PEG member Long time consultant with exposure to many
different environments, processes, protocols … and lots of really smart people
Agenda About .NetUI Data Setup Programming Do’s and Don’ts Frame Design Considerations Coding Tips and Common Fixes Summary Questions
About .NetUI
About .NetUI Same 4GL code under the covers Screens get rendered as HTML-style forms
Browser-like navigation• Back, Next
buttons• Toggle/check
boxes for logical fields
• Mouse clicks, not function keys
Seems simple enough, but… More than just a different look or screen
appearance CHUI: Tightly integrated and responsive to
keyboard events .NetUI: Stateless, no interaction at the field
navigation or keystroke level .NetUI can detect (and therefore respond to)
frame events and database events Can: Next button - end of frame or update statement Cannot: Tab, function keys, other navigational
keystrokes
Data Setup
Data setup specific to the UI 36.3.21.1 Program Information Maintenance
Determines which method will be used to display your program
Same program, before & after
Without any code changes
Programming Do’s and Don’ts
Programming Do’s and Don’ts Not an all-inclusive list, but possibly the most
common Biggest offenders; program code that must be
changed Without these changes:
Program may not function properly or at all Screen may not be displayed correctly or
completely Program may hang or crash with no error visible to
the user
Do not use; not visible in .NetUI Pause
User will not see “Press spare bar to continue” “Processing….” and program appears to hang Can use “pause 0” but not “pause 0 before hide”
QAD STD-0039
Can use gpwait.i to pause for display-only frames QAD STD-0300
Help phrase Can display informational text on the screen
… more on that later
Do not use; not visible in .NetUI
Wrong: Right:
update part validate (can-find (pt_mstr where pt_domain = global_domain and pt_part = part), “Item Number does not exist”)with frame a.
update part with frame a.
if not can-find(pt_mstr where pt_domain = global_domain and pt_part = part) then do: /*ITEM NUMBER DOES NOT EXIST*/ {pxmsg.i &MSGNUM=16 &ERRORLEVEL=3} undo, retry.end.
Validate phrase
Messages Do not use Progress “message” statement Do not use Alert-box Do not use mfmsg.i or its variations
(mfmsg01.i, mfmsg02.i, etc) Do not use hard-coded message text Always use pxmsg.i (QAD STD-0277)
{pxmsg.i &MSGNUM=123 &ERRORLEVEL=3}
Always use msg_mstr
Field Lookups Do not use scrolling windows
Ex: window.i, sw*.i Do use browses and lookups as created by
Browse Maintenance (36.20.13) Browse Maintenance is entirely new in .NetUI Do not use 36.20.13 in Chui – always use the .NetUI
version Browses can be developed on one database,
exported and imported into other db’s Browse export/import will include supporting data
Labels, Program Info, etc.
Keyboard actions Keystrokes and other cursor movement is not
detectable in .NetUI Program logic cannot be based on keystrokes
or frame fields Do not use:
Keycode, Keyfunction Cursor-left, cursor-right, cursor-up, cursor-down Status default, ststatus Hard-coded “F4” or other keys
Can use database trigger events On assign, create, write, etc.
Frame Design Considerations
Frame considerations Text displayed in frame statements will not
appear in .NetUI Field labels will be displayed but not other
informational or hard-coded text Watch for “no-label” phrase – this may
indicate a frame made entirely of text.
Sample frame – classic CHUI
Sample frame codeform
skip(1)
"Here is some informational text" at 3
skip(1)
code colon 11
code1 colon 46 label {t001.i}
name colon 11
name1 colon 46 label {t001.i}
skip(1)
sort-by colon 20 format '9'
"1) Customer Number" at 26
"2) Customer Name" at 26
skip
with frame a side-labels width 80.
Result before code change Text is missing
To display text: Step 1 Define character variables They will be used to store the text
define variable form-text1 as char no-undo.
define variable form-text2 as char no-undo.
define variable form-text3 as char no-undo.
To display text: Step 2 Place the variables in the frame
form
skip(1)
form-text1 at 3 format 'x(40)' no-label
skip(1)
code colon 11
code1 colon 46 label {t001.i}
name colon 11
name1 colon 46 label {t001.i}
skip(1)
sort-by colon 20 format '9'
form-text2 at 26 format 'x(20)' no-label
form-text3 at 26 format 'x(20)' no-label
skip
with frame a side-labels width 80.
To display text: Step 3 Assign text to the variables
assign
form-text1 = "Here is some informational text"
form-text2 = "1) Customer Number"
form-text3 = "2) Customer Name"
.
Can also use Label Master or Master Comments to store frame text.
Allows for language translation.
To display text: Step 4 Display variables with frame a
display
form-text1
form-text2
form-text3
with frame a.
Result after code change
Coding Tips and Common Fixes
Determining the run-time mode {gpiswrap.i} Returns a logical
True = .NetUI mode False = Terminal/CHUI mode
if {gpiswrap.i} then do:
/* Some code here for .Net UI */
end.
else do:
/* Running in Terminal Mode */
end.
“Quick List” for common fixes To update your existing CHUI custom code and
enable for .NetUI, search for these commonly used words
These aren’t all indicative of a problem, but will give you a quick jump-start towards finding possible offenders
• Alert-box• Cursor• F2, F4• Frame• Help• Keycode
• Keyfunction• Label• Message• mfmsg• Pause• Validate
Follow QAD’s coding style 3 types of programs; very specific structure &
flow of control Maintenance, Inquiry, Report
Follow the recommended program structure for consistent behavior
Utilize standard .i include files as much as possible
K.I.S.S. – don’t reinvent the wheel or get needlessly “creative”
http://www.qad.com/erp/Support/ Get a login, it’s free! Click on:
General Reference Development Standards
Review these periodically – refreshers are good; we all forget things over time
Summary
Summary Write code for application functionality, not
the user’s keystrokes 36.3.21.1 Program Information Maintenance Use “Quick List” for quick conversion of
existing custom code Use QAD’s development standards
As the application has evolved, it has continually become more and more important to follow these rules
Follow the “When in Rome” principle
Questions?
Contact information For further information or a copy of this
presentation:
Tammy Lonsberry
(847) 628-4796