GetMethodID
Description
Returns the ID of the requested method.
Syntax
|
1 |
GetMethodID(pbclass cls, LPCTSTR methodName, PBRoutineType rt, LPCTSTR signature, pbboolean publicOnly) |
|
Argument |
Description |
|---|---|
|
cls |
pbclass containing the function. |
|
methodName |
The string name of the method in |
|
rt |
Type of the method: PBRT_FUNCTION for function or |
|
signature |
Internal signature of the PowerBuilder function, |
|
publicOnly |
A boolean that determines whether only public |
Return value
pbMethodID of the method or kUndefinedMethodID on error.
Examples
This function uses GetMethodID to obtain the identifier (mid) of
the onnewfont function so that the identifier can be used to initialize
the PBCallInfo structure and call the function:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
BOOL CALLBACK CFontEnumerator::EnumFontProc ( LPLOGFONT lplf, LPNEWTEXTMETRIC lpntm, DWORD FontType, LPVOID userData ) { UserData* ud = (UserData*)userData; pbclass clz = ud->session->GetClass(ud->object); pbmethodID mid = ud->session->GetMethodID(clz, "onnewfont", PBRT_EVENT, "IS"); PBCallInfo ci; ud->session->InitCallInfo(clz, mid, &ci); pbstring str = ud->session-> NewString(lplf->lfFaceName); ci.pArgs->GetAt(0)->SetPBString(str); ud->session->TriggerEvent(ud->object, mid, &ci); pbint ret = ci.returnValue->GetInt(); ud->session->FreeCallInfo(&ci); return ret == 1 TRUE : FALSE; } |
Usage
The GetMethodID function is used to obtain the ID of a method so
you can use it to invoke functions and trigger events.
See also