Pass callback function to class object
There is a FORM in program.
I need to pass FORM's name to class object, and this object to run FORM.
Like it done in ALV:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_USER_COMMAND = 'MY_FROM'
here every thing will be done using the Event handling(local classes based on event definition) check this program
BCALV_TEST_GRID_EVENTS
Similar Messages
-
How to automate the creation of Function Module & Class Object (SE24)
Experts,
I have the requirement to automate the creation of any type of programs: ie function module (like how we normally create in SE37 together with the parameters), class object (like how we normally create in SE24 together with attribute & method), normal report (like how we did in SE38), module pool and so on.
For example. I backuped my program into a flat file (the entire source code in txt formal or HTML) through a download program and I need to upload back this flat file into another installation of SAP.
Does SAP provide any predefined FM to cater for the above cases or better still, does anyone know of any upload program which I can use for the above requirement.
Thanks in advance.Hi Kris, I can't use the transport system as these are 2 separate SAP installation in a different place. The requirement came in the form of creation of program to be able to generate FM/Class/Report on the go.
-
How do I pass a com object to a callback function
I am trying to program the PCI-6527 card within a COM object. With the DIG_Change_Message_Config command I'm setting the notification for when the input signal changes using a callback function. To make the callback function work I have to declare that function as a static member of the object class. This means that I have no access to the this pointer in this function. After I receive the notification, my actions in the callback function depend on settings in member variables in the class. MSDN gives as a solution to pass the this pointer as an argument to a static member function to have access to the class. I've tried this but the compiler keeps barfing at me.
The code used is:
stat = DIG_Change_Message_Config(
m_CardNum,1, msg,"",0,0, (unsigned long)DealWithInput );
with DealWithInput defined as: static void DealWithInput();
Is there a way of getting access to the class in DealWithInput either by passing it as an parameter or through some other ingenous trick that I can't find documentation forThe thing is that you cannot change the parameters of the callback functions. It is always :
void yourCallbackFunc (DAQEventHandle handle,
DAQEventMsg msg,
DAQEventWParam wParam,
DAQEventLParam lParam);
When yourCallbackFunc is called back, all the parameters get filled in the calling function in DAQ driver. What you have to do is pass the this pointer in message parameter in DIG_Change_Message_Config function, so that whatever you pass in message gets passed back in your callback function. Message can be any type. -
Calling a function on an object passed as argument
Hi everyone,
i'm trying to call an actionscript function on an object passed as argument to a c function. Here are how I do :
I have a class named test_class implemented as
package
public class test_class
public var bliblou:int;
and a C function that have to modify the bliblou var of an test_class object passed as argument. Here is my function :
static AS3_Val test_obj_param( void* self, AS3_Val args )
AS3_Val obj;
AS3_ArrayValue( args, "AS3ValType ", &obj );
AS3_Set( obj, AS3_String("bliblou"), AS3_Int( 123456 ) );
return AS3_Null();
Then I call the function in my actionscript main function like this :
var loader:CLibInit = new CLibInit;
var lib:Object = loader.init();
var test:test_class = new test_class();
lib.test_obj_param( test );
But when the test_obj_param is trying to run, I obtain an error saying "unable to access a propriety of a null object".
What am I doing wrong ? Is it possible to do what I try to (calling a function on an object passed as argument) ?
Thanks in advanceAfter a long trip to Alchemy possibilities and a lot of tests I have finally found a solution to my question.
Instead of using AS3ArrayValue to get my objet, I use the AS3 function shift on the args array to get my object. Here is how I do
static AS3_Val test_obj_param( void* self, AS3_Val args )
AS3_Val emptyParams = AS3_Array("");
AS3_Val obj = AS3_CallS( "shift", args, emptyParams );
AS3_SetS( obj, "bliblou", AS3_Int( 123456 ) );
AS3_Release(emptyParams);
return AS3_NULL();
Maybe there is a bug in the AS3ValType getter. -
Pass Class Object To FMS Using NetConnection.call Method
Hello All,
I have a custom class that defines several methods on itself
to retrieve its data. This class object is then sent to FMS via the
NetConnection.call method. Once received by FMS, FMS calls the
remote method to dispaly the class object on connected clients
(minus the originator).
Now, standard properties are displayed correctly, but when I
call the class method to retrieve the class data, no data is
retrieved.
My question is, can FMS handle class objects as parameters in
a NetConnection call. If not, is there a better practice of
applying methods to retrieve the class data? Example below...
class com.QuizItem
var numOfAnswers;
var getAnswer;
function QuizItem(question)
this.numOfAnswers = 0;//<-- Returns correct number of
answers
this.getAnswer = function(answerNumberToGet)//<-- Does
not return any data when called by client side script
return this.answers[answerNumberToGet];//Already populated
array
Regards,
ShackFirst, I know JAVA does not working "pass by
reference". It's only working pass by value. (or call
by value)But obviously you don't fully understand what it means.
Isn't main_a and method_a alias?
if there is not alias, why? please explain to me.No. They're two independent references coincidentally pointing to the same object. In your swap method, you move method_a to point to something else. This does not affect main_a.
and why main_a.hashcode() is main_a's value?why not? What else should it be?
I think It's mean copy object. but main_a and
method_a, they have same object id! @_@;;;It means "copy reference", same object. -
TCP Callback function passing data to teststand
Hi,
I'm trying to pass data via a TCP Callback function to teststand using the TCP steptype that I downloaded from Ni.
When I open a connection, container data is passed to the dll on which it creates a connection, the dll in part creates a TCP Callback function.
The handle obtained from the connection is then passed back through the container data, and the dll returns back to the sequence editor which will execute the next steps.
The problem is that when the TCP Callback function gets an TCP_READY event it can not pass data to TestStand because it can not access the container data.
How can this TCP Callback function pass/alter data to/in Testand?
Thank you...Yes ThiCop,
That's exactly what I want to establish!
Here is the example code:
//Function needed by the TCP functions
int CVICALLBACK MsgHandler (unsigned handle, int event, int error, void *callbackData)
char receiveBuf[256] = {0};
char displayBuf[7] = {0};
char * tempLookup;
int dataSize = sizeof (receiveBuf) - 1;
switch (event)
case TCP_CONNECT:
break;
case TCP_DISCONNECT:
break;
case TCP_DATAREADY:
if ((dataSize = ClientTCPRead (handle, receiveBuf, dataSize, 1000)) > 0)
// Send data from receiveBuf to a variable in teststand ????
// TS_PropertyGetValString (HandleObject, NULL, "Step.Result.Data", 0, &tempLookup);
// TS_PropertySetValString (HandleObject, NULL, tempLookup, 0, receiveBuf);
else
receiveBuf[dataSize] = '\0';
break;
return 0;
void __declspec(dllexport) TX_TEST TCPConnectF(tTestData * testData, tTestError * testError)
int error = 0;
int TCPerror;
double Port;
double Timeout;
char *HandleLookup;
char *ServerAdd;
char *CallbackData;
ErrMsg errMsg = {'\0'};
ERRORINFO errorInfo;
tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.Handle", 0, &HandleLookup));
tsErrChk (TS_PropertyGetValNumber (testData->seqContextCVI, &errorInfo, "Step.Result.Port", 0, &Port));
tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.IP", 0, &ServerAdd));
tsErrChk (TS_PropertyGetValNumber (testData->seqContextCVI, &errorInfo, "Step.Result.Timeout", 0, &Timeout));
tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.Data", 0, &CallbackData));
TCPerror = ConnectToTCPServer (((unsigned int *) &ConnectionHandle), ((unsigned int) Port), ServerAdd, MsgHandler, 0, Timeout);
if (TCPerror != 0)
//Get TCP Error Message
sprintf(errMsg,"%s",GetTCPErrorString ( TCPerror ));
error = TCPerror;
goto Error;
tsErrChk (TS_PropertySetValNumber (testData->seqContextCVI, &errorInfo, HandleLookup, 0, ((double) ConnectionHandle)));
Error:
// FREE RESOURCES
CA_FreeMemory(HandleLookup);
CA_FreeMemory(ServerAdd);
// If an error occurred, set the error flag to cause a run-time error in TestStand.
if (error < 0)
testError->errorFlag = TRUE;
testError->errorCode = error;
testData->replaceStringFuncPtr(&testError->errorMessage, errMsg);
return; -
How to pass class object as in parameter in call to pl/sql procedure ?
hi,
i have to call pl/sql proecedure through java. In pl/sql procedure as "In" parameter i have created "user defined record type" and i am passing class object as "In" parameter in call to pl/sql procedure. but it is giving error.
so, anyone can please tell me how i can pass class object as "In" parameter in call to pl/sql procedure ?
its urgent ...
pls help me...793059 wrote:
I want to pass a cursor to a procedure as IN parameter.You can use the PL/SQL type called sys_refcursor - and open a ref cursor and pass that to the procedure as input parameter.
Note that the SQL projection of the cursor is unknown at compilation time - and thus cannot be checked. As this checking only happens at run-time, you may get errors attempting to fetch columns from the ref cursor that does not exist in its projection.
You also need to ask yourself whether this approach is a logical and robust one - it usually is not. The typical cursor processing template in PL/SQL looks as follows:
begin
open cursorVariable;
loop
fetch cursorVariable bulk collect into bufferVariable limit MAX_ROWS_FETCH;
for i in 1..bufferVariable.Count
loop
MyProcedure( buffer(i) ); --// <-- Pass a row structure to your procedure and not a cursor
end loop;
..etc..
exit when cursorVariable%not_found;
end loop;
close cursorVariable;
end; -
Dealing with functions not in class Object
Hi,
while i was working on GJ i faced the following problem, when i write a generic class i have to take into my consideration those functions that i want to define for the row type class and not included in class Object (toSting() is in class Object but print() is not). of course every time i want to call print() from the generic class the compiler gives me an error becuz it is not in class Object.. is there anyway to get rid of this problem in a simple way without having to deal with more than one row type ?
thanks everyoneI think I see what you're getting at...the GJ compiler substitues Object for all unconstrained type parameters, and therefore tries to call methods on parametized type objects as if they were simply of type Object.
A solution would be to create a base class (or interface) AbstractRow that declares all the methods you need. Then constrain your parameters against AbstractRow. Eg:
public interface AbstractRow
public AbstractRow rowMethod();
public class MyClass<RowType extends AbstractRow>
public RowType doSomething(RowType rt) {
rt.rowMethod();
I think that should work. I'm not sure what you meant by "without having to deal with more than one row type." If you meant "without having to introduce an inheritance hierarchy," then no, this is not possible in GJ (as far as I can tell). If you meant "without having to write adapters for every single row type," then yes.
shaun -
Revision: 20936
Revision: 20936
Author: [email protected]
Date: 2011-03-21 13:40:50 -0700 (Mon, 21 Mar 2011)
Log Message:
Pass in the MessageBroker class loader to the FactorySettings::createFactory() function.
The supports situations where the MessageBroker class loader is not the same as the one that loaded ClassUtils (e.g. OSGi).
Modified Paths:
blazeds/trunk/modules/core/src/flex/messaging/config/FactorySettings.java
blazeds/trunk/modules/core/src/flex/messaging/config/MessagingConfiguration.javaSpryAccordion.css
You have an error that is killing the rest of your code shown below in red. Remove it.
.AccordionPanelContent {
margin: 0px;
padding: 2px; /**suggest using 12px or more**/
background-image: url(../infobkgd.png);
background-attachment: fixed;
background-repeat: repeat;
font-family: Verdana, Geneva, sans-serif;
font-size: 12px; /**suggest using 16px or more**/
color: #FFF;
overflow: hidden;
height: 40
[x;
height: 100%;
Nancy O. -
Calling a method from a callback function under ARC
Hi All
I previously wrote some HIDManager software. The HIDManager references were done in a Objective C class so within this object you have the code:
IOHIDManagerRegisterDeviceMatchingCallback( k8055HIDManager, k8055BoardWasAdded, (__bridge void*)self );
Which registers with the HIDManager
The Callback function which is outside the class was as follows:
static void k8055BoardWasAdded(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef k8055HIDDevice)
IOHIDDeviceOpen(k8055HIDDevice, kIOHIDOptionsTypeNone);
CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
[k8055 setHardwareConnectionStatus : YES];
Any how my problem is in converting the code to ARC as under OS X 10.9 SDK and 64bit I'm now getting a EXC_BAD_ACCESS (Code=EXC_I386_GPFLT) at this line
CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
although removing the method
[k8055 setHardwareConnectionStatus : YES];
will alow it to build but then obviously the app won't work as required.
Could someone suggest a ARC safe way of accessing the passed instance so I can again call methods on it.
Cheers
SteveTry using blocks instead. This is the callback I am using for libcurl.
static size_t callback(
void * contents, size_t size, size_t nmemb, void * context)
size_t (^block)(void *, size_t) =
(__bridge size_t (^)(void *, size_t))context;
size_t result = block(contents, size * nmemb);
return result; -
How to implement a callback function using LabView's Call Library Function Node?
I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
me and I do not have the source code, just the .dll and .h files.
The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
this one out. I am using LabView 8.6.
The SDK.h deacribes the function as:
// Function: SdkSetPropertyEventHandler
SdkError SDKAPI SdkSetPropertyEventHandler(
SdkCameraRef inCameraRef,
SdkPropertyEvent inEvnet,
SdkPropertyEventHandler inPropertyEventHandler,
SdkVoid* inContext );
// Description:
// Registers a callback function for receiving status
// change notification events for property states on a camera.
// Parameters:
// In: inCameraRef - Designate the camera object.
// inEvent - Designate one or all events to be supplemented.
// inPropertyEventHandler - Designate the pointer to the callback
// function for receiving property-related camera events.
// inContext - Designate application information to be passed by
// means of the callback function. Any data needed for
// your application can be passed.
// Out: None
// Returns: Any of the sdk errors.
A separate header file called SDKTypes.h contains the following data:
typedef SdkUInt32 SdkPropertyEvent;
typedef SdkUInt32 SdkPropertyID;
typedef void SdkVoid;
typedef struct __SdkObject* SdkBaseRef;
typedef SdkBaseRef SdkCameraRef;
SdkPropertyEventHandler
typedef SdkError ( SDKCALLBACK *SdkPropertyEventHandler )(
SdkPropertyEvent inEvent,
SdkPropertyID inPropertyID,
SdkUInt32 inParam,
SdkVoid * inContext );
Thanks for your help.
Alejandro
Solved!
Go to Solution.alejandroandreatta wrote:
I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
me and I do not have the source code, just the .dll and .h files.
The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
this one out. I am using LabView 8.6.
Basically you do not do that. LabVIEW does not know pointers and certainly not function pointers. What you should do instead is writing a C DLL that implements the callback and also exports a function to be called by LabVIEW that translates between the callback and a LabVIEW user event. Look for PostLVUserEvent() here on the NI site to find examples how to do that.
Rolf Kalbermatter
Message Edited by rolfk on 02-11-2009 08:00 PM
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Asynchronously writing and callback function
hi everybody,
i am working on an asynchronous write operation as described in
'Asynchronously Reading and Writing with the NI-DAQmx Visual C++ Class Library'
in the Visual Studio .NET documentation.
I've worked with asynchronous read functions and callbacks (the OnEvent function in this example) before, and it worked
well.
Atm i am doing output to 16 digital outputs on my PCI6259 card. I want to output a waveform stored in a vector containing about 1000 samples.
So i installed the event handler for my writer object, and started the output by calling
'WriteMultiSamplePortAsync'.
The problem is, that the callback function 'OnEvent' is called after the first sample of my vector is sent, and not after the complete vector.
i need to know when my whole buffer is through, because i have to recalculate it and send it again...
Anyone has an idea where the problem is?
Thx in advance
markusWell i've attached a somehow simplified code of my problem.
First i start two tasks, one counter, which acts as sample clock for my digital output, and the digital output task itself.
In this example i use a output frequency of 100kHz.
Then an event handler for my digital write operation is installed.
Next, i create a vector with size 1000, fill it with some data and write it out calling 'WriteMultiSamplePortAsync'
What i would expect now, is that the OnEvent-function is called, as soon as all of the 1000 samples of my output vector have been sent.
But what really happens is that OnEvent is called after the first of the 1000 samples has been written.
As i said before, the same procedure works fine with analog input tasks.
Regards
Markus
Attachments:
AsyncDigitalOut.cpp 3 KB -
How to share callback function between jar files?
I have jar file on client side with class A that download class B from jar from server side. Class A call method from class B. But parameter of this method should be callback function. What is the better approach to write with code? I want to use code “void my_method(Object ctx, Method m)” But I think it is not a good approach to set callback in class B.
Thanks, more questions:
I used method one since we already set up an additional user account in windows for my daughter. If I should use method two, then I would need to know how to delete this and reset the ipod to use under one user account.
My daughter's and my itunes music folders are located on a separate hard drive dedicated for our music files.
1. I was able to add individual songs to her music files using the instructions regarding "add a library". I was hoping to make a play list in my itunes account and export it to hers as a group, or do I have do add each one individually through the "add to library" command?
2. Step 4 in "To listen to another account's music files:"
is "Deselect the "Copy files to itunes Music folder when adding to library file" option". I assume I then re select this when I am done copying files. Right?
Thanks -
Serialization custom Class Object
Hi,
I'm kind of stuck with a problem.
I've been writing a servlet and applet that are communicating over
internet using a socket connection and Object Serialization.
The objects that are passed are custom:
public class mcuComObj implements Serializable{
static final long serialVersionUID = 2222;
private String name;
private Vector attributes;
...There are some more functions but those are not of any interest.
In the vector attributes, I've planted a jPanel (swing).
The weird thing is that this morning, it worked a few times...after that
I'm getting the:
javax.swing.JComponent; local class incompatible: stream classdesc serialVersionUID = 6954663636822719621, local class serialVersionUID = 5896976265092562486 ERROR message.
The send code:
Vector v = new Vector();
Object objButton = (Object) jButton1;
v.add(objButton);
obj.setAttributes(v); //obj = mcuComObj
con.sendObject(obj); //con = socket connection threadThe receive code:
Object input= (Object) objInpStr.readObject();When I serialize the mcuComObj class, does it also serialize the
embedded objects (in this case that are in the Vector)?
The main question is...how can I solve this? I can not guarantee that
both Servlet and Applet have the same JDK running...!
Have anyone of you got any ideas?
Thanks in advance,
Chris van DiemenIf the "magic numbers" (sent at the beginning of any writeObject() call) on the sending and receiving JDK differ, the object will not de-serialize properly on the receiving end.
The easist solution would be to use a common format to transmit the data. Say! That sounds like XML.
- Saish
"My karma ran over your dogma." - Anon -
Accessing parent function from class
Hey guys
I have a .fla file with some code in the actions panel.
A bit of code calls a function in a class from the actions panel
The function in the class is run, but I want to be able to call a function in the main actions panel code from the function in that class
The class doesn't extend anything so (parent as MovieClip).function() does not work
Any ideas?
Thanks
Chrisif you're trying to reference code attached to a timeline, your class will need a displayobject reference. you can pass it a reference when instantiating a class object:
// on a timeline:
var c:YourClass=new YourClass(this); // code your constructor to accept this movieclip reference.
you can then use that reference to access code in any timeline (that exists when trying to reference):
private var tl:MovieClip; // import the mc class.
public funciton YourClass(mc:MovieClip){
tl=mc;
Maybe you are looking for
-
Passing resultsets in a method
Hello all I am curious what the general thought/idea is about methods passing result sets to the caller - I am guessing bad idea correct ?
-
I have changed my username and password
I have changed my id and password i cant get my paid apps back
-
Hey there Ever since I've upgreaded to Lion, no computer (PC, we don't have any other macs) in my home or work networks can seem to access or view my shared folders. Further more, my Xtreamer can't find my shared folders as well. It worked perfectly
-
The old Date Timestamp question
Hi, In my prog I store the Date and Timestamp of a test result. I use them to populate a JTree. The JTree is populated according to the date and the timestamp gives me the test time. I have two methods that extract the Date and Timestamp and store th
-
I don't know what I did, but photoshop now says that abr is an unknown file format. My brushes thumbnail use to be what looked like a little greenish brown paint brush. now the thumbnail is the photoshop feathers. I know it has something to do with w