Capture standard button click

Kevin, I recommend you approach it from the BPM, as opposed to event code on form controls.






________________________________
From: ksimon8fw <ksimon8fw@...>
To: vantage@yahoogroups.com
Sent: Tue, May 25, 2010 9:21:14 AM
Subject: [Vantage] Capture standard button click


Does anyone have any sample code where you "capture" a user clicking a standard Epicor button, you do some type of processing, then cancel the button-click based upon your processing.

I can do this with the a button I add, but can't get the syntax on a standard button.

The program I am trying to use is "Start Production Activity", and when the user clicks the "OK" button, I want to do some pre-processing and cancel unless certain conditions are met.

We're on Epicor 9, but I'm sure sample code on Vantage 8 would work as well.

Thanks in advance.
Kevin







[Non-text portions of this message have been removed]
Does anyone have any sample code where you "capture" a user clicking a standard Epicor button, you do some type of processing, then cancel the button-click based upon your processing.

I can do this with the a button I add, but can't get the syntax on a standard button.

The program I am trying to use is "Start Production Activity", and when the user clicks the "OK" button, I want to do some pre-processing and cancel unless certain conditions are met.

We're on Epicor 9, but I'm sure sample code on Vantage 8 would work as well.

Thanks in advance.
Kevin
My suggestion would be to create your own 'OK' button and execute your
code based on that. I am doing the same thing where I am executing a
pre process condition and then completing the transaction with a custom
'OK' button. Just hide the original, remove the tab sequence number (or
jack it way up) and put your own in place. Basically you use the
EpiGUID of the original 'OK' button and call a sub to click it after you
run your own code. See code below as an example.





Module Script





'// ** Wizard Insert Location - Do Not Remove 'Begin/End
Wizard Added Module Level Variables' Comments! **

'// Begin Wizard Added Module Level Variables **

private withevents btnOK as epibutton

'// End Wizard Added Module Level Variables **





'// Add Custom Module Level Variables Here **







Sub InitializeCustomCode()





'// ** Wizard Insert Location - Do not
delete 'Begin/End Wizard Added Variable Intialization' lines **

'// Begin Wizard Added Variable
Intialization





'// End Wizard Added Variable
Intialization

'// Begin Custom Method Calls



'// End Custom Method Calls

End Sub







Sub DestroyCustomCode()





'// ** Wizard Insert Location - Do not
delete 'Begin/End Wizard Added Object Disposal' lines **

'// Begin Wizard Added Object Disposal





'// End Wizard Added Object Disposal

'// Begin Custom Code Disposal



'// End Custom Code Disposal

End Sub



Private Sub StartProdForm_Load(ByVal sender As object, ByVal args As
EventArgs) Handles StartProdForm.Load

'//

'// Add Event Handler Code

'//

txtAssySeq =
CType(csm.GetNativeControlReference("dade67c9-c1e0-49fe-8051-73bb36c8bec
9"), EpiTextBox)

btnOK =
CType(csm.GetNativeControlReference("025fc115-fee3-4973-946e-ba209189d62
e"), EpiButton)





End Sub



Private Sub LaborDtl_AfterFieldChange(ByVal sender As object, ByVal
args As DataColumnChangeEventArgs) Handles LaborDtl_Column.ColumnChanged

'// ** Argument Properties and Uses **

'// args.Row("[FieldName]")

'// args.Column, args.ProposedValue, args.Row

'

'Add Event Handler Code

Dim edvSPA As EpiDataView = CType(oTrans.EpiDataViews("Start"),
EpiDataView)

Dim strMES As String =
edvSPA.dataView(edvSpa.Row)("ShortChar01")

Select Case args.Column.ColumnName



Case "JobNum"

txtAssySeq.Focus

edvSPA.dataView(edvSPA.Row)("ShortChar01") = "MES"

Case Else



End Select



End Sub



Private Sub btnOK2_Click(ByVal Sender As Object, ByVal Args As
System.EventArgs) Handles btnOK2.Click

'// ** Place Event Handling Code Here **

Dim edvSPA As EpiDataView = CType(oTrans.EpiDataViews("Start"),
EpiDataView)

Dim vRes As String = edvSPA.dataView(edvSpa.Row)("ResourceID")

Dim vJob As String = edvSPA.dataView(edvSpa.Row)("JobNum")

Dim vAssy As String = edvSPA.dataView(edvSpa.Row)("AssemblySeq")

Dim vOper As String = edvSPA.dataView(edvSpa.Row)("OprSeq")

Dim Hooks as Integer = 0



Dim adpJO As JobOperSearchAdapter = New
JobOperSearchAdapter(StartProdForm)

adpJO.BOConnect()



Dim record As Boolean = adpJO.GetByID(vJob, vAssy, vOper)

Dim dsJO As JobOperSearchDataSet = adpJO.JobOperSearchData

Dim dStd As Decimal =
dsJO.Tables("JobOper").Rows(0)("ProdStandard")

Hooks = Math.Ceiling((dstd*60)/17)

'msgbox(dStd)



adpJO.Dispose()

btnOK.PerformClick()







'msgbox(vRes)

If vRes = "PMB" Then

MessageBox.Show("Number of Hooks: " & Hooks)

End If



End Sub

End Module







Rob Bucek

Manufacturing Engineer

PH: (715) 284-5376 ext 3111

Mobile: (715)896-0590

FAX: (715)284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site) <http://www.dsmfg.com/>





From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of ksimon8fw
Sent: Tuesday, May 25, 2010 9:21 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Capture standard button click





Does anyone have any sample code where you "capture" a user clicking a
standard Epicor button, you do some type of processing, then cancel the
button-click based upon your processing.

I can do this with the a button I add, but can't get the syntax on a
standard button.

The program I am trying to use is "Start Production Activity", and when
the user clicks the "OK" button, I want to do some pre-processing and
cancel unless certain conditions are met.

We're on Epicor 9, but I'm sure sample code on Vantage 8 would work as
well.

Thanks in advance.
Kevin





[Non-text portions of this message have been removed]
Hi Kevin,

> Does anyone have any sample code where you "capture" a user clicking a standard Epicor button, you do some type of processing, then cancel the button-click based upon your processing.
>
> I can do this with the a button I add, but can't get the syntax on a standard button.
>
> The program I am trying to use is "Start Production Activity", and when the user clicks the "OK" button, I want to do some pre-processing and cancel unless certain conditions are met.

This is basically what a BPM does. Any reason you're not using a BPM?

Mark W.
Mark,

I would much prefer a BPM solution. However, there is workstation specific
information that we are capturing from the client that is running Vantage,
and I wouldn't have access to that information from the BPM, which runs
server side.

Good thought though.

Kevin

On Tue, May 25, 2010 at 1:05 PM, Mark Wonsil <mark_wonsil@...> wrote:

>
>
> Hi Kevin,
>
>
> > Does anyone have any sample code where you "capture" a user clicking a
> standard Epicor button, you do some type of processing, then cancel the
> button-click based upon your processing.
> >
> > I can do this with the a button I add, but can't get the syntax on a
> standard button.
> >
> > The program I am trying to use is "Start Production Activity", and when
> the user clicks the "OK" button, I want to do some pre-processing and cancel
> unless certain conditions are met.
>
> This is basically what a BPM does. Any reason you're not using a BPM?
>
> Mark W.
>
>
>


[Non-text portions of this message have been removed]
Rob,

Thanks for the idea, I'll give this a shot!

Kevin

On Tue, May 25, 2010 at 12:31 PM, Rob Bucek <rbucek@...> wrote:

>
>
> My suggestion would be to create your own 'OK' button and execute your
> code based on that. I am doing the same thing where I am executing a
> pre process condition and then completing the transaction with a custom
> 'OK' button. Just hide the original, remove the tab sequence number (or
> jack it way up) and put your own in place. Basically you use the
> EpiGUID of the original 'OK' button and call a sub to click it after you
> run your own code. See code below as an example.
>
> Module Script
>
> '// ** Wizard Insert Location - Do Not Remove 'Begin/End
> Wizard Added Module Level Variables' Comments! **
>
> '// Begin Wizard Added Module Level Variables **
>
> private withevents btnOK as epibutton
>
> '// End Wizard Added Module Level Variables **
>
> '// Add Custom Module Level Variables Here **
>
> Sub InitializeCustomCode()
>
> '// ** Wizard Insert Location - Do not
> delete 'Begin/End Wizard Added Variable Intialization' lines **
>
> '// Begin Wizard Added Variable
> Intialization
>
> '// End Wizard Added Variable
> Intialization
>
> '// Begin Custom Method Calls
>
> '// End Custom Method Calls
>
> End Sub
>
> Sub DestroyCustomCode()
>
> '// ** Wizard Insert Location - Do not
> delete 'Begin/End Wizard Added Object Disposal' lines **
>
> '// Begin Wizard Added Object Disposal
>
> '// End Wizard Added Object Disposal
>
> '// Begin Custom Code Disposal
>
> '// End Custom Code Disposal
>
> End Sub
>
> Private Sub StartProdForm_Load(ByVal sender As object, ByVal args As
> EventArgs) Handles StartProdForm.Load
>
> '//
>
> '// Add Event Handler Code
>
> '//
>
> txtAssySeq =
> CType(csm.GetNativeControlReference("dade67c9-c1e0-49fe-8051-73bb36c8bec
> 9"), EpiTextBox)
>
> btnOK =
> CType(csm.GetNativeControlReference("025fc115-fee3-4973-946e-ba209189d62
> e"), EpiButton)
>
> End Sub
>
> Private Sub LaborDtl_AfterFieldChange(ByVal sender As object, ByVal
> args As DataColumnChangeEventArgs) Handles LaborDtl_Column.ColumnChanged
>
> '// ** Argument Properties and Uses **
>
> '// args.Row("[FieldName]")
>
> '// args.Column, args.ProposedValue, args.Row
>
> '
>
> 'Add Event Handler Code
>
> Dim edvSPA As EpiDataView = CType(oTrans.EpiDataViews("Start"),
> EpiDataView)
>
> Dim strMES As String =
> edvSPA.dataView(edvSpa.Row)("ShortChar01")
>
> Select Case args.Column.ColumnName
>
> Case "JobNum"
>
> txtAssySeq.Focus
>
> edvSPA.dataView(edvSPA.Row)("ShortChar01") = "MES"
>
> Case Else
>
> End Select
>
> End Sub
>
> Private Sub btnOK2_Click(ByVal Sender As Object, ByVal Args As
> System.EventArgs) Handles btnOK2.Click
>
> '// ** Place Event Handling Code Here **
>
> Dim edvSPA As EpiDataView = CType(oTrans.EpiDataViews("Start"),
> EpiDataView)
>
> Dim vRes As String = edvSPA.dataView(edvSpa.Row)("ResourceID")
>
> Dim vJob As String = edvSPA.dataView(edvSpa.Row)("JobNum")
>
> Dim vAssy As String = edvSPA.dataView(edvSpa.Row)("AssemblySeq")
>
> Dim vOper As String = edvSPA.dataView(edvSpa.Row)("OprSeq")
>
> Dim Hooks as Integer = 0
>
> Dim adpJO As JobOperSearchAdapter = New
> JobOperSearchAdapter(StartProdForm)
>
> adpJO.BOConnect()
>
> Dim record As Boolean = adpJO.GetByID(vJob, vAssy, vOper)
>
> Dim dsJO As JobOperSearchDataSet = adpJO.JobOperSearchData
>
> Dim dStd As Decimal =
> dsJO.Tables("JobOper").Rows(0)("ProdStandard")
>
> Hooks = Math.Ceiling((dstd*60)/17)
>
> 'msgbox(dStd)
>
> adpJO.Dispose()
>
> btnOK.PerformClick()
>
> 'msgbox(vRes)
>
> If vRes = "PMB" Then
>
> MessageBox.Show("Number of Hooks: " & Hooks)
>
> End If
>
> End Sub
>
> End Module
>
> Rob Bucek
>
> Manufacturing Engineer
>
> PH: (715) 284-5376 ext 3111
>
> Mobile: (715)896-0590
>
> FAX: (715)284-4084
>
> <http://www.dsmfg.com/>
>
> (Click the logo to view our site) <http://www.dsmfg.com/>
>
> From: vantage@yahoogroups.com <vantage%40yahoogroups.com> [mailto:
> vantage@yahoogroups.com <vantage%40yahoogroups.com>] On Behalf
> Of ksimon8fw
> Sent: Tuesday, May 25, 2010 9:21 AM
> To: vantage@yahoogroups.com <vantage%40yahoogroups.com>
> Subject: [Vantage] Capture standard button click
>
>
> Does anyone have any sample code where you "capture" a user clicking a
> standard Epicor button, you do some type of processing, then cancel the
> button-click based upon your processing.
>
> I can do this with the a button I add, but can't get the syntax on a
> standard button.
>
> The program I am trying to use is "Start Production Activity", and when
> the user clicks the "OK" button, I want to do some pre-processing and
> cancel unless certain conditions are met.
>
> We're on Epicor 9, but I'm sure sample code on Vantage 8 would work as
> well.
>
> Thanks in advance.
> Kevin
>
> [Non-text portions of this message have been removed]
>
>
>


[Non-text portions of this message have been removed]
Kevin, I didn't see this until after I wrote the other email.
You can run VB.NET code on the form, tell me a little about what you're doing, maybe I can save you some time by offering my own hit or miss attempts for you to learn from, lol.

----- Original Message ----
From: Kevin Simon <ksimon8fw@...>
To: vantage@yahoogroups.com
Sent: Tue, May 25, 2010 3:52:47 PM
Subject: Re: [Vantage] Capture standard button click

Mark,

I would much prefer a BPM solution. However, there is workstation specific
information that we are capturing from the client that is running Vantage,
and I wouldn't have access to that information from the BPM, which runs
server side.

Good thought though.

Kevin

On Tue, May 25, 2010 at 1:05 PM, Mark Wonsil <mark_wonsil@...> wrote:

>
>
> Hi Kevin,
>
>
> > Does anyone have any sample code where you "capture" a user clicking a
> standard Epicor button, you do some type of processing, then cancel the
> button-click based upon your processing.
> >
> > I can do this with the a button I add, but can't get the syntax on a
> standard button.
> >
> > The program I am trying to use is "Start Production Activity", and when
> the user clicks the "OK" button, I want to do some pre-processing and cancel
> unless certain conditions are met.
>
> This is basically what a BPM does. Any reason you're not using a BPM?
>
> Mark W.
>
>
>


[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
Kevin -

Try inserting your code into the BeforeAdapterMethod on the Start
adapter.
This code launches upon OK button being clicked. Use the Form Event
Wizard
for the BeforeAdapterMethod. Specifically in the system default code:

Private Sub oTrans_startAdapter_BeforeAdapterMethod(ByVal sender As
object, ByVal args As BeforeAdapterMethodArgs) Handles
oTrans_startAdapter.BeforeAdapterMethod
Select Case args.MethodName
Case "Update"
'place your code here
End Select
End Sub


Hope this helps,
Calvin Dekker
Office: 630-672-7688
Email: calvin@...
http://www.codabears.com

*New software/hardware Support & Maintenance Programs


-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Kevin Simon
Sent: Tuesday, May 25, 2010 4:16 PM
To: calvind
Subject: Re: [Vantage] Capture standard button click

Rob,

Thanks for the idea, I'll give this a shot!

Kevin

On Tue, May 25, 2010 at 12:31 PM, Rob Bucek <rbucek@...> wrote:

>
>
> My suggestion would be to create your own 'OK' button and execute your
> code based on that. I am doing the same thing where I am executing a
> pre process condition and then completing the transaction with a
custom
> 'OK' button. Just hide the original, remove the tab sequence number
(or
> jack it way up) and put your own in place. Basically you use the
> EpiGUID of the original 'OK' button and call a sub to click it after
you
> run your own code. See code below as an example.
>
> Module Script
>
> '// ** Wizard Insert Location - Do Not Remove 'Begin/End
> Wizard Added Module Level Variables' Comments! **
>
> '// Begin Wizard Added Module Level Variables **
>
> private withevents btnOK as epibutton
>
> '// End Wizard Added Module Level Variables **
>
> '// Add Custom Module Level Variables Here **
>
> Sub InitializeCustomCode()
>
> '// ** Wizard Insert Location - Do not
> delete 'Begin/End Wizard Added Variable Intialization' lines **
>
> '// Begin Wizard Added Variable
> Intialization
>
> '// End Wizard Added Variable
> Intialization
>
> '// Begin Custom Method Calls
>
> '// End Custom Method Calls
>
> End Sub
>
> Sub DestroyCustomCode()
>
> '// ** Wizard Insert Location - Do not
> delete 'Begin/End Wizard Added Object Disposal' lines **
>
> '// Begin Wizard Added Object Disposal
>
> '// End Wizard Added Object Disposal
>
> '// Begin Custom Code Disposal
>
> '// End Custom Code Disposal
>
> End Sub
>
> Private Sub StartProdForm_Load(ByVal sender As object, ByVal args As
> EventArgs) Handles StartProdForm.Load
>
> '//
>
> '// Add Event Handler Code
>
> '//
>
> txtAssySeq =
>
CType(csm.GetNativeControlReference("dade67c9-c1e0-49fe-8051-73bb36c8bec
> 9"), EpiTextBox)
>
> btnOK =
>
CType(csm.GetNativeControlReference("025fc115-fee3-4973-946e-ba209189d62
> e"), EpiButton)
>
> End Sub
>
> Private Sub LaborDtl_AfterFieldChange(ByVal sender As object, ByVal
> args As DataColumnChangeEventArgs) Handles
LaborDtl_Column.ColumnChanged
>
> '// ** Argument Properties and Uses **
>
> '// args.Row("[FieldName]")
>
> '// args.Column, args.ProposedValue, args.Row
>
> '
>
> 'Add Event Handler Code
>
> Dim edvSPA As EpiDataView = CType(oTrans.EpiDataViews("Start"),
> EpiDataView)
>
> Dim strMES As String =
> edvSPA.dataView(edvSpa.Row)("ShortChar01")
>
> Select Case args.Column.ColumnName
>
> Case "JobNum"
>
> txtAssySeq.Focus
>
> edvSPA.dataView(edvSPA.Row)("ShortChar01") = "MES"
>
> Case Else
>
> End Select
>
> End Sub
>
> Private Sub btnOK2_Click(ByVal Sender As Object, ByVal Args As
> System.EventArgs) Handles btnOK2.Click
>
> '// ** Place Event Handling Code Here **
>
> Dim edvSPA As EpiDataView = CType(oTrans.EpiDataViews("Start"),
> EpiDataView)
>
> Dim vRes As String = edvSPA.dataView(edvSpa.Row)("ResourceID")
>
> Dim vJob As String = edvSPA.dataView(edvSpa.Row)("JobNum")
>
> Dim vAssy As String = edvSPA.dataView(edvSpa.Row)("AssemblySeq")
>
> Dim vOper As String = edvSPA.dataView(edvSpa.Row)("OprSeq")
>
> Dim Hooks as Integer = 0
>
> Dim adpJO As JobOperSearchAdapter = New
> JobOperSearchAdapter(StartProdForm)
>
> adpJO.BOConnect()
>
> Dim record As Boolean = adpJO.GetByID(vJob, vAssy, vOper)
>
> Dim dsJO As JobOperSearchDataSet = adpJO.JobOperSearchData
>
> Dim dStd As Decimal =
> dsJO.Tables("JobOper").Rows(0)("ProdStandard")
>
> Hooks = Math.Ceiling((dstd*60)/17)
>
> 'msgbox(dStd)
>
> adpJO.Dispose()
>
> btnOK.PerformClick()
>
> 'msgbox(vRes)
>
> If vRes = "PMB" Then
>
> MessageBox.Show("Number of Hooks: " & Hooks)
>
> End If
>
> End Sub
>
> End Module
>
> Rob Bucek
>
> Manufacturing Engineer
>
> PH: (715) 284-5376 ext 3111
>
> Mobile: (715)896-0590
>
> FAX: (715)284-4084
>
> <http://www.dsmfg.com/>
>
> (Click the logo to view our site) <http://www.dsmfg.com/>
>
> From: vantage@yahoogroups.com <vantage%40yahoogroups.com> [mailto:
> vantage@yahoogroups.com <vantage%40yahoogroups.com>] On Behalf
> Of ksimon8fw
> Sent: Tuesday, May 25, 2010 9:21 AM
> To: vantage@yahoogroups.com <vantage%40yahoogroups.com>
> Subject: [Vantage] Capture standard button click
>
>
> Does anyone have any sample code where you "capture" a user clicking a
> standard Epicor button, you do some type of processing, then cancel
the
> button-click based upon your processing.
>
> I can do this with the a button I add, but can't get the syntax on a
> standard button.
>
> The program I am trying to use is "Start Production Activity", and
when
> the user clicks the "OK" button, I want to do some pre-processing and
> cancel unless certain conditions are met.
>
> We're on Epicor 9, but I'm sure sample code on Vantage 8 would work as
> well.
>
> Thanks in advance.
> Kevin
>
> [Non-text portions of this message have been removed]
>
>
>


[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