fngb__get_code (gb_func) - Retrieve .gbf String Data or Chunks of Code
Syntax
def fngb__get_code(gb__win_id$,gb__ctl_id$,gb__event_code$,gb__gbf_data$)
Description
This function is used to retrieve:
-
A single event handler routine.
-
All event handler routines for a given window ID and control ID.
-
All event handler routines for a given Window ID.
-
Initialization or End of Job routines.
-
A single user-defined subroutine/function.
-
All user-defined subroutines/functions.
-
Variables from the [Program] block of the .gbf file.
In the following routines, where n is the number of lines in a routine, remember that these lines might be made up entirely of spaces, tabs, and new line characters, meaning that they're effectively empty. To tell if there is any code in the returned string, use the following code:
is_code = sgn(len(cvs(cvs(gb__sub_code$,16),3)))
is_code = sgn(len(cvs(cvs(gb__sub_code$[i],16),3)))
For convenience, the following variable equivalents are defined:
gb__sub_name$ = gb__sub_name$[1]
gb__sub_code$ = gb__sub_code$[1]
gb__sub_info$ = gb__sub_info$[1]
To Get |
Use |
Notes |
Single event handler routine |
n = fngb__get_code("win-id", |
n = 1 if the routine was found, 0 if not found. gb__sub_name$ - Name of event handler subroutine. gb__sub_code$ - Body of event handler subroutine. gb__sub_info$ - Contains window ID + $0a$ + control ID + $0a$ + event code + $0a$ |
All event handler routines for a given Window ID and Control ID |
n = fngb__get_code("win-id", |
n = Number of routines found. gb__sub_name$[1..n] - Names of event handler subroutines. gb__sub_code$[1..n] - Bodies of event handler subroutines. gb__sub_info$[1..n] - Contain window ID + $0a$ + control ID + $0a$ + event code + $0a$ |
All event handler routines for a given Window ID |
n = fngb__get_code("win-id", |
n = Number of routines found. gb__sub_name$[1..n] - Names of event handler subroutines. gb__sub_code$[1..n] - Bodies of event handler subroutines. gb__sub_info$[1..n] - Contain window ID + $0a$ + control ID + $0a$ + event code + $0a$ |
End of Job or Initialization routine |
n = fngb__get_code("", |
n = 0 if the routine wasn't found, or the number of lines in gb__sub_code$ if it was found. gb__sub_name$ - Name of the special routine. gb__sub_code$ - Body of the special routine. |
Single user-defined subroutine or function |
n = fngb__get_code("", |
n = 0 if the routine wasn't found, or the number of lines in gb__sub_code$ if it was found. gb__sub_name$ - Name of the subroutine or function. gb__sub_code$ - Body of the subroutine or function. |
All user-defined subroutines or functions |
n = fngb__get_code("", |
n = Number of functions found. gb__sub_name$[1..n] - Names of subroutines or functions. gb__sub_code$[1..n] - Bodies of subroutines or functions. |
[Program] block variable |
n = fngb__get_code("", |
n = 0 if the variable wasn't found, 1 if it was found. gb__sub_name$ - Name of variable. gb__sub_code$ - Value of variable. |