where oo meets the gui for net n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Where OO meets the GUI for .NET PowerPoint Presentation
Download Presentation
Where OO meets the GUI for .NET

Loading in 2 Seconds...

play fullscreen
1 / 19

Where OO meets the GUI for .NET - PowerPoint PPT Presentation


  • 159 Views
  • Uploaded on

Session 135. Where OO meets the GUI for .NET. It’s new, it’s different, it’s still just ABL. Peter Judge Principal Software Engineer OpenEdge Development. What is the GUI for .NET?. Who does what?. OpenEdge Built-in Progress.* classes do the ABL-to-.NET talking

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Where OO meets the GUI for .NET' - dennis-navarro


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
where oo meets the gui for net

Session 135

Where OO meets the GUI for .NET

It’s new, it’s different, it’s still just ABL

Peter Judge

Principal Software Engineer

OpenEdge Development

who does what
Who does what?
  • OpenEdge
    • Built-in Progress.* classes do the ABL-to-.NET talking
    • All ABL classes inherit Progress.Lang.Object
      • All .NET classes inherit System.Object … which also inherits Progress.Lang.Object
  • You
    • Composition of UI
    • UI logic
    • Business logic procedures or classes (on AppServer)
building blocks used by demo
Building blocks used by Demo
  • .NET Controls
    • OpenEdge built-ins
    • Progress.Windows.FormProgress.Windows.UserControl
    • Progress.Data.BindingSource
    • MicrosoftSystem.Windows.FormsTextBox & LabelDataGridViewTreeViewSplitContainerPanelGroupBox
  • OOABL Classes
    • MainForm
    • ItemUserControl
    • DepartmentDataObjectCustomerDataObject SalesrepDataObject

Sports2000

form design
Form design
  • Start with static nodes
  • Easy resizing & layout
  • Multiple UI elements share ABL data
  • Compose complex controls: ABL User Controls
probindingsource binding ui controls to prodataset data
ProBindingSource:Binding UI controls to ProDataSet data

ProDataSet

  • Set DataSource, DataMember on dataGridOrder
  • Set BindingSourceProp on Item detail UserControl

eCustomer

eOrder

eOrderLine

dataGridOrder:DataMember = "eOrder".

dataGridOrder:DataSource = bsCustomer.

ucItems1:BindingSourceProp = bsCustomer.

eItem

ItemNum

edtItemNum:DataBindings:Add(new Binding(

"Text", BindingSourceProp, "eOrder.eOrderLine.eItem.ItemNum")).

interacting with the net ui handling ui events
Interacting with the .NET UI:Handling UI events

method private InitializeComponent():

/* lotsa stuff */

treeView1:NodeMouseClick:subscribe(treeView1_NodeMouseClick).

methodprivatevoid treeview1_NodeMouseClick(

sender as System.Object,

e as TreeNodeMouseClickEventArgs ):

System.EventArgs

Empty : System.EventArgs

System.Windows.Forms.MouseEventArgs

Button : MouseButtons

Clicks : integer

System.Windows.Forms.TreeNodeMouseClickEventArgs

Node : TreeNode

interacting with the net ui tree node click event handler
Interacting with the .NET UI:tree node click event handler

using System.Windows.Forms.*.

methodprivatevoid tree1_NodeMouseClick(

sender asSystem.Object,

e asTreeNodeMouseClickEventArgs ):

/* Deal with top level (zero-based) */

if e:Node:Level eq0then

do:

cNodeName = e:Node:Name.

/* only create the children once. */

if e:Node:Nodes:Count eq0then

casecNodeName:

when'CustomerNode' then

do:

CreateCustomerNodes().

DecorateCustomerNodes().

end./* customer */

  • Everything’s an object
  • e:Node - Just Like Any Other Node Object
  • Chained calls
  • Call ABL node creation method
  • Using USING Makes Life Easier!
createcustomernodes method
CreateCustomerNodes() method

defvaroParent, oNodeasTreeNode.

oData = GetCustomerData().

hBuffer = oData:DatasetHandle

:get-buffer-handle('eCustomer').

bsCustomer:Handle = oData:DatasetHandle.

oParent = treeView1:Nodes:Item['CustomerNode'].

/* create ABL query, set buffers */

hQuery:query-prepare

('preselecteacheCustomerbyName').

hQuery:query-open().

hQuery:get-first().

dowhilehBuffer:available:

cKey = hBuffer::CustNum.

cText = hBuffer::Name.

oNode = oParent:Nodes:Add(cKey, cText).

oNode:Tag = 'Some extra info'.

  • oData contains filled ProDataSet
  • DatasetHandle property same as handle variable
  • BindingSource uses ProDataSet
  • Nodes property collection of Node objects
  • Query stuff is all standardABL
  • Can work on new node
decoratecustomernodes method
DecorateCustomerNodes() method

defvaroCustomerNodesasTreeNodeCollection.

oCustomerNodes =

treeView1:Nodes['CustomerNode']:Nodes.

doiLoop = 0tooCustomerNodes:Count - 1:

oNode = oCustomerNodes[iLoop].

/* hBuffer from oData, as earlier */

hBuffer:find-unique(

' where CustNum = ' + quoter(oNode:Name)).

dPercent = hBuffer::Balance

/ hBuffer::CreditLimit * 100.

ifdPercent > 90then

oNode:BackColor = System.Drawing.Color:Red.

  • Get node by name or by index
  • Zero-based counting
  • Standard ABL query finds data to manipulate .NET UI
  • Node colour based on business rules
customer data binding
Customer data binding
  • OneBindingSource binds to oneProDataSet providing multi-level data to UI controls
  • Automatic “linkednavigation” via ProDataSet data-relations
  • WICKEDcool, no?

CustomerBindingSource

Orders

OrderLines

Items

probindingsource binding ui controls to an abl query
ProBindingSource: Binding UI controls to an ABL query
  • Not using ProDataSets? Use a query instead
  • Can even query PDS data
  • Always single-level to UI
  • Provides data to multiple controls

SalesrepBindingSource

createqueryhQuery.

hQuery:query-prepare('for each eSalesrep').

bsSalesrep:Handle = hQuery.

sorting the datagridview
Sorting the DataGridView
  • Standard event handler signature
  • Sorting location depends on control, could be on grid or BindingSource
  • Identity is not equality
  • Build standard ABL query off event args
  • Easily make this generic

methodvoidBindingSource_SortRequest(

sender asSystem.Object,

easProgress.Data.SortRequestEventArgs):

ifsender:Equals(bsSalesrep) then

do:

hQuery = bsSalesrep:Handle.

cSortBy = ' by ' + e:FieldName.

ifnot e:Ascending then

cSortBy = cSortBy + ' desc '.

hQuery:query-prepare

('for each eSalesrep ' + cSortBy).

hQuery:query-open().

end.

end method.

alternate controls same data same business logic much prettier different more features
Alternate controls: same data, same business logic, much prettier, different & more features
  • Microsoft controls do the basics
  • Vendor-specific functionality
    • Grouping, multi-column sorting, multi-level browsing
    • Filters, aggregates
    • Themes / skins
  • Presentation layer design opportunity: OERA, MVP et al
what you see is net what you get is abl
What you see is .NET, what you get is ABL
  • .NET …
    • Paints stuff on screen
    • Fires UI events : Click, Resize, Sort
  • ABL …
    • Works with data
      • Temp-tables, queries, ProDataSets
      • Built-in ProBindingSource talks both ways
    • Handles UI events
    • Invokes methods & classes, set properties
      • Same on all types: OO ABL and .NET
where can i learn more
Where can I learn more?
  • Right here at ExchangeOnlineOhNine
    • Shelley Chase’s Introducing OpenEdge GUI for .NET
    • Alex Herbstritt’s Advanced OO Techniques
    • Niels Bredegaard’s Tales from the Trenches: Using the GUI for .NET
  • OpenEdge Documentation’s Getting Started books
    • Object Oriented Programming
    • Introducing the OpenEdge Architect Visual Designer
    • GUI for .NET Mapping Reference
    • GUI for .NET Programming
  • OpenEdge Architect : Class browser, help files, etc
  • Progress Communities discussions (forums)
  • 3rd party control vendors’ documentation, support, forums
    • MSDN
conclusion
Conclusion
  • Pretty easy, right?
    • It’s Just ABL

… and you’re all experts in ABL

    • From the ABL, you don’t care if it’s .NET
slide19

Peter Judge

Principal Software Engineer, OpenEdge Development

pjudge@progress.com