I eventually trial and errored my way into producing code that gets the tree focused to a point where the edit and save works.
There is lots going on in the code below If you have a question on a subs function or purpose let me know.
Here is the code that sets up and populates the ultracombo:
'//**************************************************
'// Custom VB.NET code for POEntryForm
'// Created: 10/23/2007 7:42:53 AM
'// bw
'//**************************************************
Imports System
Imports System.Collections
Imports System.Data
Imports System.Diagnostics
Imports System.Reflection
Imports System.Windows.Forms
Imports System.ComponentModel
Imports System.Text
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
Module Script
'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
Private WithEvents edvPODetail As EpiDataView
Private WithEvents edvPOHeader As EpiDataView
Private WithEvents edvPartView As EpiDataView
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
Private WithEvents dsMItem As DataSet
Private WithEvents dtMItem As DataTable
Private WithEvents dsUD10 As DataSet
Private WithEvents txtPartNum As EpiTextBox
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
edvPODetail = CType(oTrans.EpiDataViews("PODetail"), EpiDataView)
edvPOHeader = CType(oTrans.EpiDataViews("POHeader"), EpiDataView)
edvPartView = CType(oTrans.EpiDataViews("PartView"), EpiDataView)
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
'// End Custom Method Calls
dsMItem = New DataSet()
dsUD10 = New DataSet()
dtMItem = New DataTable("MItems")
CreateDataTableStructure()
dsMItem.Tables.Add(dtMItem)
SetupComboBox()
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
edvPOHeader = Nothing
edvPartView = Nothing
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
dsMItem = Nothing
dtMItem = Nothing
dsUD10 = Nothing
'// End Custom Code Disposal
End Sub
Private Sub PopulateMItemDataTable()
dtMItem.Clear()
Dim recordSelected As Boolean
Dim showSearch As Boolean = False
Dim whereClause As String = "Key1 = '" + edvPODetail.dataView(edvPODetail.Row)("PartNum") + "' By Int(Key2)"
dsUD10 = SearchFunctions.listLookup(POEntryForm, "UD10Adapter", recordSelected, showSearch, whereClause)
If recordSelected
Dim intLine As Integer = 0
For Each dr As DataRow In dsUD10.Tables(0).Rows
Dim LF As String
Dim RH as String
Dim Spaces As String = " "
Dim Row1 As DataRow = dtMItem.NewRow()
Row1.Item("Line") = intLine
Row1.Item("Manufacturer") = dr("ShortChar01").Trim()
Row1.Item("Mfr Item") = dr("ShortChar02").Trim()
Row1.Item("TR") = dr("ShortChar03").Trim()
If dr("CheckBox01") = True
LF = "LF"
Else
LF = " "
End If
Row1.Item("LF") = LF
If dr("CheckBox02") = True
RH = "RH"
Else
RH = " "
End If
Row1.Item("RH") = RH
Row1.Item("DM") = dr("ShortChar01").Trim() + Spaces + dr("ShortChar02").Trim() + Spaces + dr("ShortChar03").Trim() + Spaces + LF + Spaces + RH
dtMItem.Rows.Add(Row1)
intLine = intLine + 1
Next
End If
End Sub
Private Sub scbMItem_RowSelected(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.RowSelectedEventArgs) Handles scbMItem.RowSelected
'// ** Place Event Handling Code Here **
If (dtMItem.Rows.Count > 0) And (scbMItem.Focused)
Dim dsRow As Integer = scbMItem.Value
edvPODetail.dataView(edvPODetail.Row).BeginEdit
txtMfr.Text = dsUD10.Tables(0).Rows(dsRow)("ShortChar01")
edvPODetail.dataView(edvPODetail.Row)("ShortChar01") = dsUD10.Tables(0).Rows(dsRow)("ShortChar01")
edvPODetail.Notify( New EpiNotifyArgs(POEntryForm, edvPODetail.Row, edvPODetail.Column))
txtMfrItem.Text = dsUD10.Tables(0).Rows(dsRow)("ShortChar02")
edvPODetail.dataView(edvPODetail.Row)("ShortChar02") = dsUD10.Tables(0).Rows(dsRow)("ShortChar02")
edvPODetail.Notify( New EpiNotifyArgs(POEntryForm, edvPODetail.Row, edvPODetail.Column))
edvPODetail.dataView(edvPODetail.Row)("ShortChar03") = dsUD10.Tables(0).Rows(dsRow)("ShortChar03")
edvPODetail.Notify( New EpiNotifyArgs(POEntryForm, edvPODetail.Row, edvPODetail.Column))
edvPODetail.dataView(edvPODetail.Row)("CheckBox01") = dsUD10.Tables(0).Rows(dsRow)("CheckBox01")
edvPODetail.Notify( New EpiNotifyArgs(POEntryForm, edvPODetail.Row, edvPODetail.Column))
edvPODetail.dataView(edvPODetail.Row)("CheckBox02") = dsUD10.Tables(0).Rows(dsRow)("CheckBox02")
edvPODetail.Notify( New EpiNotifyArgs(POEntryForm, edvPODetail.Row, edvPODetail.Column))
edvPODetail.dataView(edvPODetail.Row).EndEdit
End If
End Sub
Private Sub CreateDataTableStructure()
Dim Line As DataColumn = New DataColumn("Line")
Line.DataType = System.Type.GetType("System.Int16")
dtMItem.Columns.Add(Line)
Dim Mfr As DataColumn = New DataColumn("Manufacturer")
Mfr.DataType = System.Type.GetType("System.String")
dtMItem.Columns.Add(Mfr)
Dim MfrItem As DataColumn = New DataColumn("Mfr Item")
MfrItem.DataType = System.Type.GetType("System.String")
dtMItem.Columns.Add(MfrItem)
Dim TR As DataColumn = New DataColumn("TR")
TR.DataType = System.Type.GetType("System.String")
dtMItem.Columns.Add(TR)
Dim LF As DataColumn = New DataColumn("LF")
LF.DataType = System.Type.GetType("System.String")
dtMItem.Columns.Add(LF)
Dim RH As DataColumn = New DataColumn("RH")
RH.DataType = System.Type.GetType("System.String")
dtMItem.Columns.Add(RH)
Dim DM As DataColumn = New DataColumn("DM")
DM.DataType = System.Type.GetType("System.String")
dtMItem.Columns.Add(DM)
End Sub
Private Sub ClearMItems()
dsUD10.Clear()
dtMItem.Clear()
scbMItem.DataBind()
scbMItem.SetInitialValue( "", "MItem")
End Sub
Private Sub SetupComboBox()
Dim showColumns() As String = {"Manufacturer", "Mfr Item", "TR", "LF", "RH"}
scbMItem.LimitToList = False
scbMItem.NullText = "MItem"
scbMItem.DataMember = "MItems"
scbMItem.DataSource = dsMItem
scbMItem.ValueMember = "Line"
scbMItem.DisplayMember = "DM"
scbMItem.SetColumnFilter(showColumns)
scbMItem.DropDownWidth = 0
scbMItem.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList
End Sub
Private Sub scbMItem_InitializeLayout(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles scbMItem.InitializeLayout
'// ** Place Event Handling Code Here **
args.Layout.Bands(0).Columns("Manufacturer").Width = 170
args.Layout.Bands(0).Columns("Mfr Item").Width = 270
args.Layout.Bands(0).Columns("TR").Width = 70
args.Layout.Bands(0).Columns("LF").Width = 43
args.Layout.Bands(0).Columns("RH").Width = 43
End Sub
Private Sub scbMItem_BeforeDropDown(ByVal Sender As Object, ByVal Args As System.ComponentModel.CancelEventArgs) Handles scbMItem.BeforeDropDown
'// ** Place Event Handling Code Here **
ClearMItems()
PopulateMItemDataTable()
End Sub
Private Sub edvPartView_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvPartView.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("[FieldName]")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
If (args.Row > -1) Then
ClearMItems()
End If
End If
End Sub
End Module
-----Original Message-----
From:
vantage@yahoogroups.com [mailto:
vantage@yahoogroups.com] On Behalf Of Ahmet Erispaha
Sent: Thursday, November 06, 2008 12:52 PM
To:
vantage@yahoogroups.com
Subject: Re: [Vantage] Customisation Question
bw,
I'm sorry I don't have a solution for you, but what you've accomplished sounds very much like something I'm trying to do. Would you mind sharing how to load a combo box from a UD table and then assign the selected value to another field?
Thanks,
ae
--- On Thu, 9/18/08, bw2868bond <bwalker@...> wrote:
From: bw2868bond <bwalker@...>
Subject: [Vantage] Customisation Question
To: vantage@yahoogroups.com
Date: Thursday, September 18, 2008, 12:35 PM
Tweaking a customization to our POEntry form. Form has a Ultracombo that is bound by custom code to data from a UD table - data is bound whenever PartNumber on POLine changes - that all works fine and good.
Here is issue I am trying to resolve: Existing PO is opened in POEntry Click on Lines Tab. Click on DropDown arrow on UltraCombo and list of possible selections is displayed. Select an item on the list. Code fires in the RowSelectedEvent handler that changes data in two text boxes on form bound to PODetail user fields, code also sets data directly in dataview as well. Click Save. Data in text boxes reverts back to previous value.
Now if a control on the line tab panel is clicked - the tree view focus changes to the line being changed and now selecting a different UltraCombo Item and clicking save works.
Anyone have an way to make the focus shift in the tree view to the proper node without the user (gasp) having to make an extra click in the form?
Thanks....
bw
[Non-text portions of this message have been removed]
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
[Non-text portions of this message have been removed]