programming tips for.netui tammy lonsberry sr. programmer/analyst sungate solutions, inc

36
Programming Tips for .NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc.

Upload: jailyn-lodge

Post on 14-Jan-2016

232 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Programming Tips for .NetUI

Tammy LonsberrySr. Programmer/Analyst

Sungate Solutions, Inc.

Page 2: Programming Tips for.NetUI Tammy Lonsberry Sr. 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

Page 3: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Agenda About .NetUI Data Setup Programming Do’s and Don’ts Frame Design Considerations Coding Tips and Common Fixes Summary Questions

Page 4: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

About .NetUI

Page 5: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

About .NetUI Same 4GL code under the covers Screens get rendered as HTML-style forms

Page 6: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Browser-like navigation• Back, Next

buttons• Toggle/check

boxes for logical fields

• Mouse clicks, not function keys

Page 7: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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

Page 8: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Data Setup

Page 9: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Data setup specific to the UI 36.3.21.1 Program Information Maintenance

Determines which method will be used to display your program

Page 10: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Same program, before & after

Without any code changes

Page 11: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Programming Do’s and Don’ts

Page 12: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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

Page 13: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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

Page 14: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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

Page 15: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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

Page 16: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

Page 17: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

Page 18: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Frame Design Considerations

Page 19: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

Page 20: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Sample frame – classic CHUI

Page 21: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

Page 22: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Result before code change Text is missing

Page 23: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

 

Page 24: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

Page 25: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

Page 26: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

To display text: Step 4 Display variables with frame a

display

form-text1

form-text2

form-text3

with frame a.

Page 27: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Result after code change

Page 28: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Coding Tips and Common Fixes

Page 29: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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.

Page 30: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

“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

Page 31: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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”

Page 32: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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

Page 33: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Summary

Page 34: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

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

Page 35: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Questions?

Page 36: Programming Tips for.NetUI Tammy Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc

Contact information For further information or a copy of this

presentation:

Tammy Lonsberry

(847) 628-4796

[email protected]