Exchanging Data with PowerBuilder – PB Docs 2017
Exchanging Data with PowerBuilder Contents About exchanging data with PowerBuilder Passing values between extensions and the PBVM Using the IPB_Session interface Saving data from IPB_Value to a local variable Using variables throughout a session Handling enumerated types About this chapter This chapter describes how PBNI extensions exchange data with PowerBuilder. Document get from Powerbuilder help…
GetGlobalVarID – PB Docs 2017
GetGlobalVarID Description Returns the internal ID of a global variable. Syntax
|
1 |
GetGlobalVarID(LPCTSTR name) |
Argument Description name The name of the global variable in lowercase Return value pbfieldID or null on failure. Examples This example gets the internal identifier of a long variable and uses it to get and set a global variable:
|
1 2 3 |
fid = session -> GetGlobalVarID("l_gvar"); l_val = session -> GetLongGlobalVar(fid, isNull); session -> SetLongGlobalVar(fid, l_val + 1); |
See also GetGlobalVarType…
Building PowerBuilder Extensions – PB Docs 2017
Building PowerBuilder Extensions Contents Nonvisual extension example Creating a PowerBuilder extension Adding an extension to a PowerBuilder target Using the extension Creating and using a visual extension Creating visual class instances Event processing in visual extensions Calling PowerScript from an extension Exception handling and debugging About this chapter This chapter describes how to build a…
Using an event name with return type and arguments – PB Docs 2017
Using an event name with return type and arguments The following description uses the first syntax. The class has two events, onclick and ondoubleclick:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
PBXEXPORT LPCTSTR PBXCALL PBX_GetDescription() { Â Â Â static const TCHAR desc[] = { Â Â Â Â Â Â "class visualext from userobject " Â Â Â Â Â Â "event int onclick() " Â Â Â Â Â Â "event int ondoubleclick() " Â Â Â Â Â Â "subroutine setcolor(int r, int g, int b) " Â Â Â Â Â Â "subroutine settext(string txt) " Â Â Â Â Â Â "end class " Â Â Â }; return desc; } |
Capturing messages and mouse clicks The code in the extension captures the Windows messages that cause the window to be drawn, as well as mouse clicks and double clicks:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
LRESULT CALLBACK CVisualExt::WindowProc(                                    HWND hwnd,                                    UINT uMsg,                                    WPARAM wParam,                                    LPARAM lParam                                    ) {    CVisualExt* ext = (CVisualExt*)::GetWindowLong(hwnd,       GWL_USERDATA);    switch(uMsg) {    case WM_CREATE:       return 0;    case WM_SIZE:       return 0;    case WM_COMMAND:       return 0;    case WM_PAINT: {       PAINTSTRUCT ps;       HDC hdc = BeginPaint(hwnd, &ps);       RECT rc;       GetClientRect(hwnd, &rc);       LOGBRUSH lb;       lb.lbStyle = BS_SOLID;  // Get color using the visual class's GetColor method       lb.lbColor = ext->GetColor();       HBRUSH hbrush = CreateBrushIndirect(&lb);       HBRUSH hbrOld = (HBRUSH)SelectObject(hdc,          hbrush);       Rectangle(hdc, rc.left, rc.top, rc.right-rc.left,          rc.bottom-rc.top);       SelectObject(hdc, hbrOld);       DeleteObject(hbrush); // Get text using the visual class's GetText method       DrawText(hdc, ext->GetText(),          ext->GetTextLength(), &rc,       DT_CENTER|DT_VCENTER|DT_SINGLELINE);       EndPaint(hwnd, &ps);       }       return 0; // Trigger event scripts in the PowerBuilder application    case WM_LBUTTONUP:       ext->TriggerEvent("onclick");       break;    case WM_LBUTTONDBLCLK:       ext->TriggerEvent("ondoubleclick");       break;    }    return DefWindowProc(hwnd, uMsg, wParam, lParam); } |
…
Using an event name with a PowerBuilder event ID – PB Docs 2017
Using an event name with a PowerBuilder event ID A simpler way to trigger events in a visual extension uses direct mapping of Windows messages to PowerBuilder events. The following class description contains the same two events, but in this case they use the alternative syntax that maps the event name to a PowerBuilder token…
Processing events sent to the parent of the window – PB Docs 2017
Processing events sent to the parent of the window Some Windows messages, such as WM_COMMANDÂ and WM_NOTIFY, are sent to the parent of an object and not to the object itself. Such messages cannot be caught in the visual extension’s window procedure. The PBVM calls the GetEventIDÂ method to process these messages, as follows: If the message…
IsArrayItemNull – PB Docs 2017
IsArrayItemNull Description Returns true if the array item contains a null value; otherwise it returns false. Syntax
|
1 |
IsArrayItemNull( pbarray array, pblong dim[ ]) |
Argument Description array A valid pbarray structure that you want to check for a null-valued array item. dim A pblong array to hold the indexes of each dimension of the array. The size of the array must…
IsByRef – PB Docs 2017
IsByRef Description Returns true if the IPB_Value instance contains a by reference argument; otherwise it returns false. Syntax
|
1 |
IsByRef() |
Return value pbboolean Examples This example shows how you would use IsByRef to test whether an argument is obtained by reference:
|
1 2 |
if(ci->pArgs->GetAt(i)->IsByRef()) ... |
See also IsArray IsEnum IsObject Document get from Powerbuilder help Thank you for watching.
RemoveProp – PB Docs 2017
RemoveProp Description Removes the specified variable from the list of properties of the current IPB session. You must free the memory to which the property points. Syntax
|
1 |
RemoveProp(LPCTSTR name) |
Argument Description name The name of the variable to be removed Return value None. Examples These statements remove prop_name from the list of variables associated with the…
Introduction to PBNI – PB Docs 2017
Introduction to PBNI Contents About PBNI The elements of PBNI The PBNI SDK Comparing PBNI and JNI About this chapter This chapter provides a brief introduction to the PowerBuilder Native Interface. Document get from Powerbuilder help Thank you for watching.