|
Appendix J - pfc_w_master
by Sharon Weinstrom Buntz
Heres what well cover in this appendix about pfc_w_master
What is
pfc_w_master?
Why understandpfc_w_master?
Which of these six window type descendants ofpfc_w_master do I inherit from?
Would I ever customize mypfc_w_master?
Would I ever customize myw_master?
Two Big Pictures ofpfc_w_master
What does
pfc_w_master contain?
Tell me more about everything inpfc_w_master
pfc_w_masters
Instance Variables
pfc_w_masters
Functions
pfc_w_masters Key
Events ... Note: This section was too big to be included in this same web page
Tell me a little about
pfc_w_masters PFC descendants
Otherpfc_w_master-Related Objects
And what about the changes to
pfc_w_master in the
PFC 6.0 Release ?
Summary
About the Author
pfc_w_master is the Top-Most Ancestor of ALL windows
in the PFC;
"Great, Great Grandpa" of ALL PFC Windows.
Think about that for a minute
That means that there is a family tree for five generations (at least),
and so there are a lot of family members under Great, Great Grandpa!
Figure 1 - pfc_w_master is the "Great, Great Grandpa" of ALL PFC Windows
Using the PFC, ALL of your windows will descend from pfc_w_master.
So that means that every single window in your application is affected by what pfc_w_master does.
All of the main "plumbing" of the PFCs
"framework" is included in pfc_w_master.
It has to be there for the PFC to work properly, re-routing events of the window to all of
the proper services, other visual objects or other pfc_w_master events. By the way, if you arent yet familiar with the concept of
"Service-based Architecture", it would be a good idea to read up on it. Two good
sources for this are:
Powersofts white paper on PFC http://www.powersoft.com/products/devtools/pb50/pfcarch.html#overview William T. Greens white paper on SBA http://www.concentric.net/~Bgcastle/SBA/SBA_Main.html
Next down the chain of ancestry from pfc_w_master is w_master. W_master is pfc_w_masters
direct descendant, the only direct descendant in fact.
Continuing down from w_master, then descend all of the different types of windows, such as a Frame, a Sheet, a "Main SDI" window, a Response window and so on. There are six of them. Take a look at them in Figure 2. Notice how the descendants from w_master are "higher-level" PFC-level pfc_w_ objects, not just PFE-level w_ objects. Then come the w_<6 types> objects, the ones from which you will inherit all of your application-specific windows. These are w_frame, w_sheet, w_main, w_response, w_popup and w_child.
Figure 2 - pfc_w_master è w_master è six window type
descendants from which you will inherit
This picture was derived from PowerBuilders native Browser
Output Documentation
Try it out by pressing the PowerBuilder
PowerBar toolbar.
Note Take notice how the PFC/PFE/PFC/PFE objects spiral has you walk down the chain of
inheritance. Although we will not go into this in detail, it is important to realize this
early on. This is so that you can understand the regeneration implications
of the PFC objects being inherited from the PFE objects (which normally sounds backwards).
As a PFC programmer, all of your windows will always be descendants of pfc_w_master. (You should never inherit directly from the PowerBuilder Window type in a PFC application.) This is because PFC needs all of the "plumbing" for the PFC "framework" that is provided in pfc_w_master in all of its windows in order to work properly. And that is why it is so important to understand pfc_w_master. Because from him all of your PFC windows descend, and he drives all of the PFCs objects and main processes..
Understand pfc_w_master, and you shall understand a
lot about the PFC and how to manage all of your windows!
Which of these six window type
descendants of pfc_w_master do I inherit from?
You will always inherit from one of these six window type descendants (or lower) of pfc_w_master: w_frame, w_sheet, w_main, w_response, w_popup or w_child. The type that you select depends on the type of window you want for that particular situation.
If you are using MDI (Multiple Document Interface ~ like PowerBuilder itself does), then w_frame is the MDI frame ancestor, and your application's frame w_<your app>_frame will inherit from him. And w_sheet is the ancestor from which each of your frame's MDI sheets will be inherited from, for example w_se_transcript_maint.
If you are not using MDI, but rather SDI (Single Document Interface), where you don't need a frame with lots of sheets within it, then you would inherit from w_main rather than w_sheet for each of your main windows.
From either your MDI or SDI application, for other types of windows, inherit from either w_response, w_popup or w_child.
So basically, every time you open the Window Painter to create a new
application window, you will select "Inherit", and then you will select one of
these six windows to inherit from - w_frame, w_sheet, w_main, w_response, w_popup and w_child. You may have a need to inherit from a lower level down, but just realize that
you will never inherit directly from either pfc_w_master,
w_master or
PowerBuilders native window objects.
Keep in mind, the PFC follows this same scheme with the ready-made windows that it comes with. So, the PFC itself contains some descendants of these six window type descendants. Take for example, w_logon, which is inherited from pfc_w_logon, which is inherited from w_response.
Figure 3 illustrates how to inherit from the six window type descendants for MDI apps and SDI apps. It also shows how the PFC itself contains some descendants from these six window type descendants. Here we are using "se_***" as our naming convention for our application objects.
Figure 3 - You should inherit from these six window types,
such as w_frame è w_se_frame
for an MDI frame.
Note that there are already some PFC objects descending from these, such as w_response è pfc_w_logon è w_logon.
Would I ever
customize my pfc_w_master?
Probably not. You will probably never customize or change pfc_w_master. This is because you should almost never change the PFC-level source directly
yourself. Here are some reasons why
- For one, it will throw Powersofts customer support for a loop. It is probably even written in the support contract that they will not support you if you do so.
- Secondly, sticking to the base will benefit you because then you are in tune with all of the other PFCers out there. So everyone is on the "same page". Also, then you may easily take advantage of other PFC extensions written by others.
- Thirdly, you would normally take advantage of the PFE layer to enhance or correct the PFC level objects. That is why the PFE layer is there, that is its purpose. (Please see the next section for details.)
So only new releases of the PFC would change (actually replace) your PFC PBLs.
Now having said all that, there is one exception to this golden rule.
You may want to change the PFC-layer source code directly if a PFC release has already
come out with a known, existing, official fix, and you have not yet migrated
to that version. (Later, we will show you two specific cases of these, under Bug Alert!) Or perhaps Powersoft has announced a patch
or such.
In any case, you would want to document profusely just exactly what you
had changed (see Note below). This is because you would want to
double-check or re-implement any changes that you make to the PFC objects after installing
the new version of the PFC objects. Remember, new releases replace your PFC PBLs. And
remember, these cases where you change the PFC objects directly should be rare anyway.
Would I ever
customize my w_master?
Yes, there are a couple of cases where you may want to customizew_master.
Note
Lets add up front, that you should document profusely any changes that you make to w_master, in the actual object (preferably with a standard comment that you copy and paste from say a global function), and in an external document. This goes for w_master as well as any other PFE level object that you might enhance. This will help you incorporate future PFC releases. Another helpful tip on remembering to which PFE objects that your company has actually made changes, is to keep those objects in a separate PBL. So when you modify a PFE object, you would remove it from your regular PFE PBL, and add it to your extra PFE PBL.
- First case, you might change w_master if you were enhancing the PFC code in pfc_w_master, or making a temporary fix to the pfc_w_master code. In these cases, you would be either extending the pfc_w_master code, overriding the pfc_w_master code, or possibly adding new instance variables, new window functions or new user events. Which leads us to the second case
- And, secondly, you may have a need to create one or more "empty, placeholder, virtual" events yourself, modeled after how the PFC is designed and written. So you would define these user events in w_master. But still, even in this case, consider whether you really want these new empty events for all of your windows, rather than just a subset, or only for special case application windows. This is because events "fail silently", so they dont actually have to exist on a window that does not need the special event. But there may be cases where you would want to cover all windows
For example, perhaps you are in an environment where you always have some particular master or offline process to alert (via a special table) before and after performing your updates, that contains information about your updates.
In this case one might add pre-update and post-update user events to w_master for processes that fall within the Logical Unit of Work processing (as the PFC events that are already there, are processed outside of the database transaction). You might call these new events, say, (ue_PreUpdateInLUW and ue_PostUpdateInLUW) or (ue_TranPreUpdate and ue_TranPostUpdate), just as some examples. It is discouraged to use the pfc_ prefix on your own added user events.
Then, of course, you would have to trigger them in the appropriate place. In our example, w_masters pfc_update could be overridden, trigger the first new user event, call the ancestors event, and finally trigger the second new user event.
And now, all of your windows will have these empty events, ready to be extended in the appropriate descendants. And every window will know to execute them when the time comes.
We might add here though, that in the
PFC 6.0 Release, the Save Process in the
pfc_w_master will be dramatically enhanced. So be careful with any enhancements or changes that you make to the save process.
Other than those two cases though, usually you would not actually want
to modify w_master
directly. This is because any change that you make to w_master will affect ALL
of your windows since w_master is the ancestor of all PFC windows (other than pfc_w_master). So keep in mind, whenever you add
instance variables, events, and functions to w_master, the changes will impact all PFC windows. And so it follows that you should regenerate
all of your windows immediately thereafter. To reemphasize the impact, when you
regenerate all of your windows after adding new attributes and methods to w_master, you are affecting the
compiled version of all of your windows, including the PFC-level objects. This is due to
the spiraling dependancies between the PFC/PFE/PFC/PFE objects that we touched on in Figure 2 captions Note.
But, usually, rather than changing w_master, you would modify one of the six window type descendants (or lower) of pfc_w_master. For example, you would normally just want to change, say w_sheet, to add functionality to all of your sheets, not ALL of your windows.
Two Big Pictures of
pfc_w_master
Lets take one more look at the window hierarchy here in Figure 4
Figure 4 - Another viewpoint of the pfc_w_master relatives
And below, in Figure 5, heres the "Big picture" from your PFC 5.0.03 Online Help.
This is what we will cover in detail
We will be covering up through the 5.0.03 release with an indicator of 5.0.0# beside what is new
since 5.0.00.
The changes in thePFC
6.0 Release are drastic enough (and not finalized as of this
writing) to merit leaving them out of this section. It would actually confuse you more
than it would help you to interweave them into here. So we will just focus on 5.0.0#
versions. But dont worry, to satisfy your curiosity, and to tie in where the PFC is
going with 6.0, we will outline in detail what is projected for the PFC 6.0 Release in the
last section. So, as hard as it is now to say with certainty what will actually be
released in the next version, it is important to try ~ as you will probably be reading
this after 6.0 is out.
Figure 5 - All about pfc_w_master - Check out the PFC Help Often
What does pfc_w_master contain?
Now that we see the big pictures, roll up your sleeves! Its time
to get down to the technical details and learn all about pfc_w_master
pfc_w_master contains:
Instance variables to keep track of key information needed for the window,
such as flags, an array of all of the controls on the window which will be updated, a database error string, and all of the instances of the Window Services that are CREATEd when you call the window functions to turn them on.
Functions to access all of the
Instance variables which are
protected,
as every good Object-Oriented program provides.
(By the way, there are no private instance variables in pfc_w_master.)
Functions to turn on and off the Window Services,
specifically the Basic Window Service, the Window Preference Service and the Window Resize Service. Please note that the Sheet Management Service and the Status Bar Service are included in pfc_w_masters descendant, pfc_w_frame, not pfc_w_master itself.
Function to do pre-update checks
The key
of_UpdateChecks( ) function does an AcceptText( ) on all DataWindows, checks for pending updates, load an array of controls to update and perform validations.
Pre-coded
Native PowerBuilder events
that automatically handle a lot of the functionality that is needed by all windows. Key native PowerBuilder events, such as the Open, CloseQuery, Close, Resize and Move events, already have PFC code in them to handle basic window processing logic. Most of the code simply "re-routes" the processing off to the proper Non-visual User Object which handles a particular Services processing. The CloseQuery is a KEY, important PFC event, so be sure to read up on it below. Also, realize that at the bottom of the Close event, the PFC automatically does some housekeeping for you to turn off (DESTROY) any window services which may have been turned on for that window.
Pre-coded and
Partially-coded+Extendable PFC User Events
that automatically handle a lot of the functionality that is needed by all windows. Key PFC user events, such as the pfc_Save, pfc_MessageRouter, pfc_Help, pfc_MicroHelp, pfc_ControlGotFocus and pfc_Close events, already have PFC code in them to handle basic window processing logic. Some of them, like the Save event, spawns off a whole sequence of other pre-/extendable-/coded and "empty" events to automatically handle the flow of events for you. The pfc_MessageRouter "Message Router" is a special event that will go looking for an object which has a particular user event, and it will trigger the event on the object that it finds. Be sure to read up on the pfc_Save and the pfc_MessageRouter events, as they are KEY, important PFC events.
Note
Take note that on anyPartially-coded+Extendable User Event If you do have a need to "extend" the script for any of these
events, you should first check the ancestors return code. I say "extend" because in order to check the ancestors return code (at least pre-PowerBuilder 6.0), you must override the ancestor script. At any rate, it is important to check the ancestors return code because there is already script in the PFCs ancestor code, and it may fail.
The most common events in this category that PFCers sometimes "extend" are:
pfc_AcceptText
pfc_PostUpdate
pfc_Update
pfc_UpdatesPending
pfc_Validation
These events are often extended in order to have them recognize other controls such as the ListView and TreeView controls However, please note
Note: In the
PFC 6.0 Release, rather than having to extend these events to recognize such controls as the ListView and TreeView, you may take advantage of the new Self-Updating Object (SUO) architecture. To do so, you may either switch to using the new SUO objects. Or you may add the SUO API to your current objects. For more details, please see the section at the end of this appendix which covers the PFC 6.0 Release.
Empty, Placeholder, "Virtual" User Events
in which you are responsible for filling with the proper script.
Note
Take note throughout this document of any of these events which have thisindicator beside them. Again, you are responsible for providing the code for these events for your PFC application to function properly. Of all of the empty user events which exist, these five are very KEY and important, and therefore they are worth calling your attention to them upfront:
pfc_BeginTran Begin your database transaction
pfc_EndTran End your database transaction
Note
These two events control your database transactions. Therefore, they are the KEY to the success of your client/server application!
pfc_PreOpen Basically, this is the first script that executes (that you control)
In here you may:
- Turn on any Window Services
- Register the window with the Security Service
- Set your Help ID
- Disable the CloseQuery logic if appropriate
Since this event is triggered at the top of the Open event, you want to limit things done in here until after the Open event completes. That leads us to the next event
pfc_PostOpen This event is posted from the PFCs Open event, so it should execute after the window is actually open and is displayed.
In here you may perform longer-running processes such as:
- Of_SetTransObject( )s (if no tabs involved)
- Database retrievals
- Other long-running processes
- Things that can wait until this event executes
- Things that may need to close the opening window
pfc_Open Open your sheets from your frame here, and
Open another sheet, window or file from another sheet herePlease be sure to read up on these and other
empty user events in detail in the following section.
Tell
me more about everything in pfc_w_master
Now that you have an overview of whats in pfc_w_master, lets cover each of pfc_w_masters Instance Variables, Functions and Key Events in detail. Well list them all here for your quick reference convenience. And then well take each category one at a time, outlining the particulars of each and every Instance Variable, Function and Key Event.
Key | |
![]() |
è Instance Variable |
![]() |
è Event with PFC script |
![]() |
è Event with PFC script that you may want to extend |
![]() |
è Event Placeholder, intended for you to add script to |
![]() |
è Function |
![]() |
è Protected: scope |
![]() |
è Public: scope |
![]() |
è PowerScript Native |
![]() |
è New in PFC Release 5.0.02 |
Note ![]() |
è Breakpoint - Stop and take note! |
![]() |
è Self-explanatory <s> |
![]() |
![]()
any ia_HelpTypeID
boolean ib_CloseStatus
boolean ib_DisableCloseQuery
boolean ib_SaveStatus
5.0.02
u_dw idw_Active
n_cst_resize inv_Resize
n_cst_winsrv inv_Base
n_cst_winsrv_preference inv_Preference
powerobject ipo_PendingUpdates[ ]
![]()
string is_DBErrorMsg
5.0.02
Shared Variables
< None >
Structures
< None >
of_GetCloseStatus ( ) returns boolean
of_GetDWType ( datawindow adw_dw ) returns integer
of_GetSaveStatus ( ) returns boolean
5.0.02
of_SetBase ( boolean ab_switch ) returns integer
of_SetDBErrorMsg (string as_msg) returns integer
5.0.02
of_SetPreference ( boolean ab_switch ) returns integer
of_SetResize ( boolean ab_switch ) returns integer
of_UpdateChecks ( ) returns integer
External Functions
< None >
Close ( ) returns long
CloseQuery ( ) returns long
Pre-5.0.03
Move ( integer xpos, integer ypos ) returns long
Open ( ) returns long
pfc_AcceptText ( powerobject apo_control [ ], boolean ab_focusonerror ) returns integer
Pre-5.0.02
pfc_BeginTran ( ) returns integer
pfc_Close ( )
pfc_ControlGotFocus ( dragobject adrg_control )
pfc_DBError ( ) returns integer
5.0.02
pfc_Descendant ( ) returns boolean
pfc_EndTran ( integer ai_update_results ) returns integer
pfc_Help ( ) returns integer
pfc_MessageRouter ( string as_message ) returns integer
pfc_MicroHelp ( string as_microhelp )
pfc_New ( )
pfc_Open ( )
pfc_PageSetup ( ) returns integer
pfc_PostOpen ( )
pfc_PostUpdate ( powerobject apo_control [ ] ) returns integer
pfc_PreClose ( ) returns integer
pfc_PreOpen ( )
pfc_PreUpdate ( ) returns integer
pfc_Print ( ) returns integer
pfc_PrintImmediate ( ) returns integer
pfc_Save ( ) returns integer
pfc_SaveAs ( )
pfc_Update ( powerobject apo_control [ ] ) returns integer
pfc_UpdatesPending ( powerobject apo_control [ ] ) returns integer
Pre-5.0.03
pfc_Validation ( powerobject apo_control [ ] ) returns integer
Resize ( ) returns long
![]() |
of_SetSheetManager (boolean ab_switch) returns integer
of_SetStatusBar (boolean ab_switch) returns integer
Activate ( ) returns long
Move ( integer xpos, integer ypos ) returns long
pfc_Cascade ( ) returns integer
pfc_Layer ( ) returns integer
pfc_MicroHelp ( string as_microhelp )
pfc_MinimizeAll ( ) returns integer
pfc_Open ( )
pfc_PostOpen ( )
pfc_PreOpen ( )
pfc_PreToolBar ( n_cst_toolbarattrib anv_toolbarattrib )
pfc_TileHorizontal ( ) returns integer
pfc_TileVertical ( ) returns integer
pfc_ToolBars ( ) returns integer
pfc_UndoArrange ( ) returns integer
Resize ( ) returns long
![]() |
Activate ( ) returns long
pfc_ControlGotFocus ( dragobject adrg_control )
pfc_MicroHelp ( string as_microhelp )
pfc_PreOpen ( )
![]() |
pfc_Apply ( )
pfc_Cancel ( )
pfc_Default ( )
pfc_PreOpen ( )
![]() |
n_cst_AppManager Application Manager
n_cst_DWSrv_Linkage DataWindow Linkage Service
n_cst_WinSrv Basic Window Service
n_cst_WinSrv_Preference Window Preference Service
n_cst_Resize Window Resize Service
n_cst_WinSrv_SheetManager (Frame) Sheet Manager Service
n_cst_WinSrv_StatusBar (Frame) Status Bar Service
pfc_w_masters
Instance
Variables
![]()
any ia_HelpTypeID
boolean ib_CloseStatus
boolean ib_DisableCloseQuery
boolean ib_SaveStatus
5.0.02
u_dw idw_Active
n_cst_resize inv_Resize
n_cst_winsrv inv_Base
n_cst_winsrv_preference inv_Preference
powerobject ipo_PendingUpdates[ ]
![]()
string is_DBErrorMsg
5.0.02
Shared Variables
< None >
Structures
< None >
![]() ![]() ![]() |
What is it? | What is it used for? | ||
![]() ![]() |
Help Type ID for window The ID of the keyword or topic to show for Help for this window |
Tells the ShowHelp function which keyword or topic to jump
to automatically when the user hits F1 for Help from this window. You need to set it in your window if you would like Help to navigate for that window.
|
||
![]() ![]() |
Status - Closing? Are we in the middle of the closing process at this time? |
PFC sets this to TRUE at the top of the![]() ![]() Outside
of this window, you may check this flag if you need to know if the user is in the process
of closing via
|
||
![]() ![]() |
Disable Close Query? Do we want to skip CloseQuery logic when the user closes window? |
If you set this to TRUE, the entire PFC![]() ![]() It is helpful to set
this boolean instance variable to TRUE in cases where you know that the window should be
read-only, and therefore no updates should be allowed. This is because the PFC
|
||
![]() ![]()
|
Status - Saving? Is the window in the process of saving data? |
PFC sets this to TRUE in the pfc_Save event, temporarily around the ![]()
Whenever ib_SaveStatus is TRUE, no modal windows should be allowed to open, because we are in the middle of a save transaction. If you are outside of the window, you may call If ib_SaveStatus is TRUE, PFC calls |
||
![]() ![]() |
Last Active DataWindow control reference | PFC keeps this reference variable pointing to the Last
active DataWindow control for you. Whenever you send a message
from your menu, the "Message Router" has a prioritized list of objects to
attempt to route the message to
One of the last objects in the Message Routers
list is to check if there is a valid last active DataWindow control reference- IF IsValid(idw_Active). If so, then the You may also use this reference variable to refer to the (current and/or last) active DataWindow control.
|
||
![]() ![]() |
Window Resize Service instance | If/when you call ![]() Note: The Resize Service is not only a Window Service. It also services other objects, such as User Objects, Tab Controls, etc. Basically, it services any object that contains a control array of visual objects. Because the Resize Service is really a service to many different objects, not just a window, the Resize NVO is inherited from a native PowerBuilder NonVisualObject directly, rather than being inherited from n_cst_winsrv like the other two Window Services. Note: The Window Resize Service is grouped in the PFCWNSRV.PBL though because it is thought of as a Window Service. This is because the Window begins by re-routing a pfc_resize message to the Window Resize Service instance. In turn, the Window Resize knows which objects are registered with it, so it routes messages to all of them. They also may have their Resize Service turned on, and will therefore resize their controls. This resizing process trickles down nicely. Note: The instance of inv_Resize is automatically destroyed for you in PFCs Close event via
|
||
![]() ![]() |
Basic Window Service instance | If/when you call ![]() But because all window services are descendants of n_cst_winsrv (and have n_cst_winsrv functions available to them), use this object only when you require basic window services only. This basically boils down to only when you need to center a window that is not already using the Preference service. Note: The instance of inv_Base
is automatically destroyed for you in PFCs Close event via
|
||
![]() ![]() |
Window Preference Service instance | If/when you call ![]() The Window Preference Service is a big hit with the users. It is very helpful. There are however a few things to be aware about it Note Note Note Note: The instance of inv_Preference is automatically destroyed for you in PFCs Close event via
|
||
![]() ![]() |
Array of DataWindow controls (and other objects) with Updates Pending | PFC populates this array with all of the DataWindow
controls which have updates pending in the ![]() ![]() ![]() ![]() ![]() If you have extra objects which have updates
pending, you would extend the This array is then passed to the pfc_Validation, pfc_Update and pfc_PostUpdate events to validate, update and perform post-updates on each control in the array. |
||
![]() ![]()
|
DBError (event) message Stored error message from a database update (from a DataWindows DBError event) which is waiting to be displayed until after the entire transaction has ended (rolled back) |
If an database error occurs during the ![]() ![]()
PFC calls You should too if you are doing any special update processing within If there is an error during the |
of_GetCloseStatus ( ) returns boolean
of_GetDWType ( datawindow adw_dw ) returns integer
of_GetSaveStatus ( ) returns boolean
5.0.02
of_SetBase ( boolean ab_switch ) returns integer
of_SetDBErrorMsg (string as_msg) returns integer
5.0.02
of_SetPreference ( boolean ab_switch ) returns integer
of_SetResize ( boolean ab_switch ) returns integer
of_UpdateChecks ( ) returns integer
External Functions
< None >
![]()
|
What is it? Arguments Return Values |
What does it do? When should I call it? |
|
![]() ![]() |
Status - Closing? Are we in the middle of the closing process at this time? Returns boolean: TRUE = Window is closing FALSE = Window is not closing |
Reports whether or not the window is in the process of
closing. This function simply returns the value of the
|
|
![]() ![]() |
What kind of DataWindow is this?
Desc of u_dw? + Returns integer: -1 = Error |
Indicates whether a DataWindow is a descendant of u_dw and whether or not it uses the
linkage service
|
|
![]() ![]() ![]() |
Status - Saving? Is the window in the process of saving data? Returns boolean: TRUE = Window is in the save process |
Reports whether or not the window is in the process of
saving, specifically whether you are in the ![]() This
function simply returns the value of the
|
|
![]() ![]() |
Turn on/off Basic Window Services Argument boolean ab_switch: TRUE = Enable service Returns integer: 1 = Success |
Enables or disables n_cst_winsrv, which provides Basic Window Services. This function
simply creates or destroys an instance of n_cst_winsrv. If/when you call of_SetBase (TRUE) to turn on the Basic Window Service, an instance of Note: The instance of inv_Base is automatically destroyed for you in PFCs Close event via of_SetBase (FALSE)
Note
|
|
![]() ![]() ![]() |
Store the DBError Message to be displayed after
transaction has ended Argument string as_msg : Text of the DB Error message, for example a string containing information such as sqldbcode and sqlerrtext from u_dws DBError event Returns integer: 1 = Success |
Stores any DBError message that may have occurred during
the process of saving, specifically when it was in the ![]() This function simply stores the DBError
message in the
|
|
![]() ![]() |
Turn on/off Window Preference Service Argument boolean ab_switch: TRUE = Enable service Returns integer: 1 = Success |
Enables or disables
n_cst_winsrv_preference, which provides Window Preference Services. This function simply creates or destroys an instance of n_cst_winsrv_preference. If/when you call of_SetPreference (TRUE) to turn on the
Window Preference Service, an instance of Note: The instance of inv_Preference is automatically destroyed for you in PFCs Close event via of_SetPreference (FALSE)
|
|
![]() ![]() |
Turn on/off Window Resize Services Argument boolean ab_switch: TRUE = Enable service Returns integer: 1 = Success |
Enables or disables
n_cst_resize, which provides Window Resize services. This function simply creates or destroys an instance of n_cst_resize. If/when you call of_SetResize (TRUE) to turn on the window resize
service, an instance of Note: The instance of inv_Resize is automatically destroyed for you in PFCs Close event via of_SetResize (FALSE) Note The Please refer to
|
|
![]() ![]() |
Check for any validation errors or if there are any
unsaved changes pending Returns integer: 1 = Updates are pending and there are no validation errors |
Triggers the following events
Called in the Note: If the CloseQuery process is in progress, the
|
pfc_w_masters Key
Events ... Note: This section was too big to be included
in this same web page
Tell me a little about pfc_w_masters PFC descendants
The following are the extra Functions and Key Events for the PFC
descendants of pfc_w_master. Listed beside them are brief
notes about each one.
![]() |
of_SetSheetManager (boolean ab_switch) returns integer Turn on/off Sheet Manager Service
of_SetStatusBar (boolean ab_switch) returns integer Turn on/off Status Bar Service
Activate ( ) returns long Sets active frame of the application manager object to this one
Move ( integer xpos, integer ypos ) returns long Notifies Status Bar that frame has moved
pfc_Cascade ( ) returns integer Cascades all open sheets in frame
pfc_Layer ( ) returns integer Layers all open sheets in frame
pfc_MicroHelp ( string as_microhelp ) Displays specified microhelp
pfc_MinimizeAll ( ) returns integer Minimizes all open sheets in frame
pfc_Open ( ) You should add script to open your sheets for your frame here
pfc_PostOpen ( ) Opens Status Bar if service is turned on
pfc_PreOpen ( ) You should add script to turn on your Sheet Manager and Status Bar Services here, if desired
pfc_PreToolBar ( n_cst_toolbarattrib anv_toolbarattrib ) Populates values before passing object to toolbar window
pfc_TileHorizontal ( ) returns integer Tiles all open sheets in frame horizontally
pfc_TileVertical ( ) returns integer Tiles all open sheets in frame vertically
pfc_ToolBars ( ) returns integer Allows user to modify toolbar properties (Opens w_toolbars response window)
pfc_UndoArrange ( ) returns integer Undoes last sheet arrange
Resize ( ) returns long Notifies Status Bar that frame has resized
![]() |
Activate ( ) returns long Notifies frame that MicroHelp needs to be refreshed
pfc_ControlGotFocus ( dragobject adrg_control ) Displays MicroHelp stored in the tag value of current control - If DataWindow column has MICROHELP=x;, shows it - Else if control has MICROHELP=x;, shows it - (If MicroHelp tag "Ready")
is empty, showspfc_MicroHelp ( string as_microhelp ) Notifies frame to display microhelp
pfc_PreOpen ( ) You may wish to turn on Resize and Preference Services here - You may wish to register sheet here with Security Service
![]() |
pfc_Apply ( ) Trigger this user event from a cb_apply.Clicked event script. You may add code that applies dialog box specifications to the associated sheet or window. (For example, change toolbar settings.)
pfc_Cancel ( ) Trigger this user event from a cb_cancel.Clicked event script. - Sets ib_DisableCloseQuery = True so that no checks are done on the Cancels CloseQuery - You should add any specific actions prior to closing the window (after user presses the Cancel button) and then Close the response window here
pfc_Default ( ) Trigger this user event from a cb_ok.Clicked event script. - You may also trigger it from a Cancel, Close, or some other CommandButton. - You should add any specific actions prior to closing the window (after user presses the OK button) and then Close the response window here
pfc_PreOpen ( ) You may wish to add code here to turn on the Windows Basic Service that centers window in order to center all of your response windows.
Other pfc_w_master-Related
Objects
Related Objects to read up on
n_cst_AppManager Application Manager
n_cst_DWSrv_Linkage DataWindow Linkage Service
n_cst_WinSrv Basic Window Service
n_cst_WinSrv_Preference Window Preference Service
n_cst_Resize Window Resize Service
n_cst_WinSrv_SheetManager (Frame) Sheet Manager Service
n_cst_WinSrv_StatusBar (Frame) Status Bar Service
And what about the changes to pfc_w_master in the
PFC 6.0 Release ?
As we mentioned earlier, the changes in thePFC
6.0 Release for
pfc_w_master are drastic enough (and not finalized as of this writing) to merit leaving them
out of the detailed discussions of every instance variable, event and function. Trying to
weave the new ones in and talk about all of the changes would be too confusing anyway.
So, as hard as it is now to say with any certainty or any clear knowledge of what will actually be released in the next version, it is important to try ~ as you will probably be reading this after 6.0 is out.
The information contained below is current as of PFC 6.0 Beta 4 - Sept, 1997 to the best of my knowledge. To try to make this as useful and accurate as possible, I have obtained some help from the PFC Development Team themselves. However, they are very busy working on it even as I try to write about it!
So now, lets take a quick look at whats projected for the
future 6.0 release of the PFC for pfc_w_master.
![]()
of_SetUpdateObjects ( powerobject apo_objects[ ] ) returns integer
to specify on which objects and in what order the
pfc_Save event will perform the updates, versus just defaulting to using the control array
-or-
![]()
pfc_SaveObjects ( powerobject apo_objects[ ] ) returns integer
to specify the objects and the order, and to also trigger
pfc_Save; used for special, extra or separate save processes to augment the main one
- The new
of_SetUpdateObjects( ) function lets you specify which controls will be included in the normal pfc_Save process. This overrides the normal sequence and selection of what is in the windows control array. By the way, a new feature of the
PowerBuilder 6.0 Release is that all dynamically created controls are now automatically added to the windows control array. No more messing around with the control array behind the scenes is needed.
So you would call the
of_SetUpdateObjects( ) function when you need to change the content and/or the order of the controls that will be updated by the normal pfc_Save process. This content and order is then "remembered" so that whenever the normal pfc_Save process is triggered - pfc_Save knows what to update and in what order to update.
- The new
pfc_SaveObjects event lets you specify which controls will be included in a special save process, usually in lieu of the normal pfc_Save process. This not only overrides the normal sequence and selection of what is in the windows control array, but it also fires off the save process as well.
So you would trigger the new
pfc_SaveObjects event to fire off a special save process that will specifically update only those controls which you pass to it, in the order that you pass them.
of_AcceptText( )
of_UpdatesPending( )
of_Validation( )
of_UpdatePrep( )
of_Update( )
of_PostUpdate( )
So each object is responsible for how to accomplish these tasks, for themselves, as well as any of their "components". Having these set of functions, an object now implements the coined phrase "Self-Updating Object Application Programming Interface (SUO API)". The following PFC objects now include these "self-updating objects" functions:
DataWindow
DataStore
ListView *
TreeView *
Tab
UserObject
Window* Note: These 6.0 ListView and TreeView objects are new, separate PFC LV & TV objects which have the SUO API. This is for upwards compatibility issues. If you use these new objects, you no longer have to override events to have your ListViews and TreeViews update! Another option is to add the SUO API to your existing ListView and TreeView PFE layer objects (see next bullet), and change your pfc_w_master's pfc_save-related scripts.)
For example, if you were to create a Self-Updating Multi-Line Edit control (MLE) by adding the SUO API functions to it; And then you were to place that control on your window; Then, using the default processing, PFC will pick it up and include in the normal
pfc_save process.
I suppose this may be because
there is no SUO APIof_PreUpdate( )equivalent of the windowspfc_PreUpdate
as there is an SUO APIof_PostUpdate( ) equivalent of the windows
pfc_PostUpdate
instead, it uses SUO APIof_UpdatePrep( ) equivalent of the windows
pfc_UpdatePrep
which comes before the windowspfc_PreUpdate
- Populate the MRU attribute object with the text for the key
(so that the MRU service knows how to store the key)
For example, you may wish to include the window name and any special parameters to pass for retrieval arguments
- Save the current windows key to be included in the MRU list
(to be done near the opening and/or near the closing of the window)
- Open the particular window properly when the user selects the MRU menu item
Public:
Constant Integer NO_ACTION = 0
Constant Integer CONTINUE_ACTION = 0
Constant Integer PREVENT_ACTION = 1
u_st_SplitBar SplitBar
Now your application can have the "Explorer" look and feel, or
you can allow the user to easily maximize their window real estate.
You can use multiple splitbars on your window, and they work
in conjunction with the resize service
u_ProgressBar Progress Bar
Handier than its ActiveX counterparts
u_Calculator Calculator
Best suited for its DataWindow column uses,
but it can be placed on a window as well
u_Calendar Calendar
Best suited for its DataWindow column uses,
but it can be placed on a window as well,
possibly to select a processing period or something
n_cst_Resize Window Resize Service
New way to specify percentages of how to resize/move an object,
so you can have more control over how objects are resized & moved
For example, if there is a main control that is more important,
that control can stretch faster than the others.For example, before, there was no way to have two objects, side by side, stretch proportionally as the window stretches. You had to stretch one and move the other, but you couldn't stretch them both... With this enhancement, now you will be able to do this. Plus, you can say which one should stretch faster.
Sorry, the following enhancement to the existing
n_cst_WinSrv_SheetManager is no longer targeted as of this writing for the PFC 6.0 Release; it was dropped. Perhaps it will be included in a later release or perhaps it was abandoned for some other reason. I dont know.
n_cst_WinSrv_SheetManager Window Sheet Manager Service
Option to limit the total number of sheets which can be opened
Option to limit the number of sheets specified by class, title,etc
![]()
of_MessageBox ( string as_id, string as_title, string as_text, icon ae_icon, button ae_button, integer ai_default) returns integer
Please note that this new function is encapsulated into other appropriate objects as well, such as the new
pfc_n_base (ancestor of all non-visual user objects). Think of it along the same lines as the
of_GetParentWindow( ) functions, which can be done on any of 23 different controls, such as a DataWindow, a Tab, a TabPage, a DataWindow on a TabPage within a Tab, a CommandButton - whatever, and it still comes back with the window that it sits upon.
Also, please note that this
of_MessageBox( ) function is different from, and should not be confused with, the Error Services gnv_app.inv_error.of_Message( ) function.
Hopefully, this has given you a thorough understanding of the Great, Great GrandDaddy of all PFC
windows, pfc_w_master.
We have covered the 5.0.0# hierarchy and the functionality of your
windows in detail. And we have given you a heads up on what is projected for thePFC 6.0 Release as well. We hope you
have found this information useful, and we hope that you can easily flip back here as a
quick reference in the future.
If you have any questions or feedback on any of this, please feel free to drop me a line at sbuntz@texas.net . I will look forward to hearing from you. In honor of my commitment to quality and my efforts to not spread any misinformation, I will keep any corrections and/or clarifications available online at http://www.pfccheatsheet.com/ . (And if it ends up being elsewhere, there will at least be a pointer to it from there.) Because we live in an age now where things are rapidly changing. And even so, there is no longer one person, or even a small group of people, who really understand and know everything there is now to know.
Sharon Weinstrom Buntz is a CPD Professional who works for NewData Strategies (NDS), a company which provides "high-technology" software, consulting and education services. Sharon is currently a PFC/PowerBuilder mentor at Education Service Center (ESC), Region 20 in San Antonio, Texas.
Her "Cheat Sheet" for PFC/PowerBuilder "Help" is
available for your assistance and convenience at:
http://www.pfccheatsheet.com/
Another PFC resource to keep bookmarked is Boris Gasins (of Advent
2000, Inc.) PFC Guide at:
http://www.pfcguide.com/
And don't forget Rik Brooks' Dojo at:
http://www.pics.com/byte/dojo.htm
Please feel free to send Sharon an email at sbuntz@texas.net .
Sharon is forever grateful to the PFC Development Team and the other PFC experts that helped her create, compile and edit this appendix, especially Claudio Quant, Mark Overbey, Brian Grimm, Boris Gasin, Andrew "Brez" Bereznak, Steve Benfield, John Olson, Jon Credit, Bob Fields, Gregory R. George, Ken Howe, Jill Moritz, Judy Cote and Michael Campbell.
And, of course, Sharon would like to thank Rik Brooks for giving her this wonderful opportunity to be a part of this helpful PFC book. Rik is a true pleasure to work with and learn from.
Her heart also goes out to the wonderful people at ESC and NDS who have worked with Sharon, together learning all about the PFC Linda Sweet, David Terry, Emilio Flores, Mike Uhl, John McCauley, Dan Perez, Al Holden, Ching-Shen Chen, Ching-Shyong Li, Crystal Fox, Jesse Morales, Laura Ellison, Michael Stehling, Robert Okruhlik, Robert Pruski, Roland Gonzales, Thomas Evans, Robbie Hollis, Brenda Hutzler, Gwen Bolden, Joyce McDonald, Lesa Garcia, Paul Rector, Beth Rehn and, again, her wonderful and talented mentor Judy Cote.
Next, Sharon has not forgotten all of her PFC friends on the pfcsig mail list, the pfc-users mail list and the Powersoft newsgroups. The people there so graciously share all of their PFC wisdom and knowledge with other PFCers. And it is a most beautiful experience to be a part of that team spirit that makes anything possible. Hats off to all of them!
And, last but not least switching now to first person <g> I would like to personally thank all of my family, my puppies and my husband, John, for all of their love, patience and support... especially while I was submerged <s>.