GetFieldID
Description
Obtains the internal ID of a class instance variable.
Syntax
|
1 |
GetFieldID(pbclass cls, LPCTSTR fieldName) |
|
Argument |
Description |
|---|---|
|
cls |
The class in which the field resides |
|
fieldName |
The instance member name, in |
Return value
pbfieldID or 0xffff if a field ID cannot be found.
Examples
This function obtains the identifier of a class’s visible field,
if it exists, and uses it to set the value of the field:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
void CallBack::f_setvisible(IPB_Session* session, pbobject dwobj) { pbclass cls; IPB_Value* pv; pbfieldID fid; pbstring strtmp; bool isTrue; pbboolean isNull; cls = session-> GetClass(dwobj); fid = session-> GetFieldID(cls, "visible"); if (fid == kUndefinedFieldID) return; isTrue = session-> GetBoolField(dwobj, fid, isNull); if (isTrue) session -> SetBoolField(dwobj, fid, false); else session -> SetBoolField(dwobj, fid, true); return ; } |
Usage
GetFieldID is one of a set of functions that allows native code to
access the fields of Java objects and get and set their values. You use
GetFieldID to retrieve the value of a field, specifying the class name
and the field name. The field ID returned can be used as an argument to
the related functions.
See also
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest