CallBack Function

CallBack Function

HJohn1
Advocate Advocate
690 Views
5 Replies
Message 1 of 6

CallBack Function

HJohn1
Advocate
Advocate
Can someone please help me implement the callback in this example http://through-the-interface.typepad.com/through_the _interf ace/2008/11/implementing-ta.html in VB .NET?
0 Likes
691 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

The link you posted doesn't work so I'm not sure what

post that is, but if you have C# code and need
the

equivalent VB code, the easiest way to do that is

to convert the code (using a number of online
code

converters - Google for them), or using
Reflector.


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Can
someone please help me implement the callback in this example
class=jive-link-external
href="http://through-the-interface.typepad.com/through_the_interface/...

in VB .NET?
0 Likes
Message 3 of 6

HJohn1
Advocate
Advocate
Thank you for your reply. I was not looking for the translation of the code, I was rather looking to see if I was missing something. I don't understand how the callback works in this example. I created a function with the proper signature and used the addressof operator to point the callback to this function. Here is the part where I get lost, I don't know how to pass the required parameters. Also, even if I don't use the callback, the example still works. Can you help me understand this? TIA. Here is the link, hope this time works.
http://through-the-interface.typepad.com/through_the_interface/2008/11/implementing-ta.html
0 Likes
Message 4 of 6

Anonymous
Not applicable


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


The link you posted doesn't work so I'm not sure what

post that is, but if you have C# code and need
the

equivalent VB code, the easiest way to do that
is

to convert the code (using a number of online
code

converters - Google for them), or using
Reflector.


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Can
someone please help me implement the callback in this example
class=jive-link-external
href="http://through-the-interface.typepad.com/through_the_interf...

in VB
.NET?
0 Likes
Message 5 of 6

chiefbraincloud
Collaborator
Collaborator


My implementation just looks like this:



Friend Shared Function tdCallBack(ByVal atd As Autodesk.Windows.ActiveTaskDialog, ByVal e As Autodesk.Windows.TaskDialogEventArgs, ByVal sender As Object) As Boolean





Select Case e.Notification



Case Autodesk.Windows.TaskDialogNotification.ButtonClicked

....

End Select

EdWrite(vbLf)

' Returning true will prevent the dialog from being closed

Return False

End Function



And in the main function where the taskdialog is declared it's just:



td.Callback = AddressOf tdCallBack



It all works for me.

Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 6 of 6

Anonymous
Not applicable

VB.NET does not support Anonymous methods, which is what the

delegate(...){...} is in that
code.

 

A delegate is just a function with no name, which is declared
at

the point where it is used.

 

If you know LISP, a delegate is analagous
size=2>to (lambda (arg) <expr>...)

 

You don't need to use a delegate to handle the event, you
can

just write a method that has the same signature and add it
to

the event the same way you add a handler to any
event.


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thank
you for your reply. I was not looking for the translation of the code, I was
rather looking to see if I was missing something. I don't understand how the
callback works in this example. I created a function with the proper signature
and used the addressof operator to point the callback to this function. Here
is the part where I get lost, I don't know how to pass the required
parameters. Also, even if I don't use the callback, the example still works.
Can you help me understand this? TIA. Here is the link, hope this time works.
http://through-the-interface.typepad.com/through_the_interface/2008/11/implementing-ta.html
0 Likes