PB v8.0 PFC Object Reference Volume 1
PB v8.0 PFC Object Reference Volume 1
PowerBuilder
8
DOCUMENT ID: 37785-01-0800-01
To order additional documents, U.S. and Canadian customers should call Customer Fulfillment at (800) 685-8225, fax (617) 229-9845.
Customers in other countries with a U.S. license agreement may contact Customer Fulfillment via the above fax number. All other
international customers should contact their Sybase subsidiary or local distributor. Upgrades are provided only at regularly scheduled
software release dates. No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic,
mechanical, manual, optical, or otherwise, without the prior written permission of Sybase, Inc.
Sybase, the Sybase logo, ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive Server,
Adaptive Server Anywhere, Adaptive Server Enterprise, Adaptive Server Enterprise Monitor, Adaptive Server Enterprise Replication,
Adaptive Server Everywhere, Adaptive Server IQ, Adaptive Warehouse, AnswerBase, Anywhere Studio, Application Manager,
AppModeler, APT Workbench, APT-Build, APT-Edit, APT-Execute, APT-FORMS, APT-Translator, APT-Library, Backup Server,
ClearConnect, Client-Library, Client Services, Data Pipeline, Data Workbench, DataArchitect, Database Analyzer, DataExpress,
DataServer, DataWindow, DB-Library, dbQueue, Developers Workbench, Direct Connect Anywhere, DirectConnect, Distribution
Director, E-Anywhere, E-Whatever, Embedded SQL, EMS, Enterprise Application Studio, Enterprise Client/Server, Enterprise Connect,
Enterprise Data Studio, Enterprise Manager, Enterprise SQL Server Manager, Enterprise Work Architecture, Enterprise Work Designer,
Enterprise Work Modeler, EWA, Financial Fusion, Financial Fusion Server, Gateway Manager, ImpactNow, InfoMaker, Information
Anywhere, Information Everywhere, InformationConnect, InternetBuilder, iScript, Jaguar CTS, jConnect for JDBC, KnowledgeBase,
MainframeConnect, Maintenance Express, MAP, MDI Access Server, MDI Database Gateway, media.splash, MetaWorks, MySupport,
Net-Gateway, Net-Library, ObjectConnect, ObjectCycle, OmniConnect, OmniSQL Access Module, OmniSQL Toolkit, Open Client,
Open ClientConnect, Open Client/Server, Open Client/Server Interfaces, Open Gateway, Open Server, Open ServerConnect, Open
Solutions, Optima++, PB-Gen, PC APT Execute, PC DB-Net, PC Net Library, Power++, power.stop, PowerAMC, PowerBuilder,
PowerBuilder Foundation Class Library, PowerDesigner, PowerDimensions, PowerDynamo, PowerJ, PowerScript, PowerSite,
PowerSocket, Powersoft, PowerStage, PowerStudio, PowerTips, Powersoft Portfolio, Powersoft Professional, PowerWare Desktop,
PowerWare Enterprise, ProcessAnalyst, Report Workbench, Report-Execute, Replication Agent, Replication Driver, Replication Server,
Replication Server Manager, Replication Toolkit, Resource Manager, RW-DisplayLib, RW-Library, S-Designor, SDF, Secure SQL
Server, Secure SQL Toolset, Security Guardian, SKILS, smart.partners, smart.parts, smart.script, SQL Advantage, SQL Anywhere, SQL
Anywhere Studio, SQL Code Checker, SQL Debug, SQL Edit, SQL Edit/TPU, SQL Everywhere, SQL Modeler, SQL Remote, SQL
Server, SQL Server Manager, SQL SMART, SQL Toolset, SQL Server/CFT, SQL Server/DBM, SQL Server SNMP SubAgent, SQL
Station, SQLJ, STEP, SupportNow, Sybase Central, Sybase Client/Server Interfaces, Sybase Financial Server, Sybase Gateways, Sybase
MPP, Sybase SQL Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup, Sybase User Workbench, SybaseWare, Syber Financial,
SyberAssist, SyBooks, System 10, System 11, System XI (logo), SystemTools, Tabular Data Stream, Transact-SQL, Translation Toolkit,
UNIBOM, Unilib, Uninull, Unisep, Unistring, URK Runtime Kit for UniCode, Viewer, Visual Components, VisualSpeller, VisualWriter,
VQL, WarehouseArchitect, Warehouse Control Center, Warehouse Studio, Warehouse WORKS, Watcom, Watcom SQL, Watcom SQL
Server, Web Deployment Kit, Web.PB, Web.SQL, WebSights, WebViewer, WorkGroup SQL Server, XA-Library, XA-Server and XP
Server are trademarks of Sybase, Inc. 3/01
Unicode and the Unicode Logo are registered trademarks of Unicode, Inc.
All other company and product names used herein may be trademarks or registered trademarks of their respective companies.
Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-
7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.
VOLUME 1
C H APTE R 3 Menus............................................................................................. 59
m_dw.............................................................................................. 60
m_edit ............................................................................................ 62
m_frame ......................................................................................... 64
m_lvs .............................................................................................. 65
m_master ....................................................................................... 68
m_oc .............................................................................................. 73
m_tvs.............................................................................................. 75
iii
Contents
iv
Contents
s_printdlgattrib.............................................................................. 125
s_svalue ....................................................................................... 126
v
Contents
VOLUME 2
vi
Contents
vii
Contents
viii
About This Book
Subject This book describes the objects in the PowerBuilder Foundation Class
Library (PFC). Each object’s discussion includes:
• A diagram providing a quick overview of the object’s capabilities
• Instance variables
• Events and user events
• Object functions
Online Help
The PFC online Help (pbpfc80.hlp) contains all the objects, events, and
functions explained in this book. This Help file includes customized
buttons and links to help you navigate through inheritance hierarchies and
related objects.
ix
About This Book
x
CH A PTE R 1 Object Reference Conventions
About this chapter This chapter describes the conventions used in this book and the PFC
online Help file.
Contents
Topic Page
Naming conventions 2
Online Help 7
Sample application and code examples 8
1
Naming conventions
Naming conventions
Object naming PFC uses the following prefix standard for object names:
conventions
pfcobject_type_objectname
where:
• pfcobject indicates whether the object is part of the PFC level or the
extension level. Objects that are part of the PFC level have the prefix PFC_
• type indicates the object type
This table describes the object types.
Prefix Description
m_ Menu
n_ Standard class user object
n_cst Custom class user object
s_ Global structure
u_ Visual user object
w_ Window
For example:
• Pfc_w_master is the master window and is in the PFC level
• Pfc_u_tvs is the TreeView visual user object and is in the PFC level
• U_dw is the DataWindow visual user object and is in the extension level
• N_cst_dwsrv is the custom class user object for DataWindow services and
is in the extension level
• N_tr is the transaction standard class user object and is in the extension
level
Variable naming PFC uses the following standard for variable names:
conventions
<scope><datatype>_variablename
Scope is one of the following:
Prefix Description
a Argument to an event or function
g Global variable
i Instance variable
l Local variable
2
Chapter 1 Object Reference Conventions
Prefix Description
s Shared variable
3
Naming conventions
Prefix Description
dw DataWindow
dwc DataWindowChild
drg DragObject
drw DrawObject
ddplb DropDownPictureListBox
ddlb DropDownListBox
dwo DWobject
dda DynamicDescriptionArea
dsa DynamicStagingArea
ed EnumerationDefinition
eid EnumerationItemDefinition
em EditMask
env Environment
err Error
ext ExtObject
gr Graph
go GraphicObject
grax GrAxis
grda GrDispAttr
gb GroupBox
hsb HorizontalScrollBar
inet Inet
ir InternetResult
ln Line
lb ListBox
lv ListView
lvi ListViewItem
mfd MailFileDescription
mm MailMessage
mr MailRecipient
ms MailSession
mdi MDIClient
m Menu
mc MenuCascade
msg Message
mle MultiLineEdit
nv NonVisualObject
4
Chapter 1 Object Reference Conventions
Prefix Description
oc OleControl
oo OleObject
ostg OleStorage
omc OmControl
omcc OmCustomControl
omec OmEmbeddedControl
omo OmObject
omstm OmStream
omstg OmStorage
oval Oval
p Picture
pb PictureButton
pbcpp PBToCPPObject
plb PictureListBox
pl Pipeline
po PowerObject
procall ProfileCall
proclass ProfileClass
proln ProfileLine
prort ProfileRoutine
pro Profiling
rb RadioButton
rec Rectangle
rem RemoteObject
rte RichTextEdit
rrec RoundRectangle
rteo RteObject
scrd ScriptDefinition
sle SingleLineEdit
srv Service
st StaticText
std SimpleTypeDefinition
str Structure
tab Tab
tabpg TabPage
tcan TraceActivityNode
tcbe TraceBeginEnd
5
Naming conventions
Prefix Description
tcerr TraceError
tcf TraceFile
tcln TraceLine
tcgc TraceGarbageCollect
tco TraceObject
tcrt TraceRoutine
tcsql TraceSQL
tct TraceTree
tctn TraceTreeNode
tcterr TraceTreeError
tctsql TraceTreeSQL
tctgc TraceTreeGarbageCollect
tctln TraceTreeLine
tcto TraceTreeObject
tctrt TraceTreeRoutine
tctu TraceTreeUser
tcu TraceUser
td TypeDefinition
tr Transaction
trp Transport
tv TreeView
tvi TreeViewItem
uo UserObject
vrcd VariableCardinalityDefinition
vrd VariableDefinition
vsb VerticalScrollBar
wo WindowObject
w Window
Function naming Global functions use the f_ prefix and object functions use the of_ prefix.
conventions
6
Chapter 1 Object Reference Conventions
Online Help
Accessing Help The PFC online Help file contains all information found in this manual, as well
as hypertext links among related topics. There are many ways to access this
file:
• From the PowerBuilder Help Contents tab The PowerBuilder Help
screen includes a jump to PFC Help.
• Double-click the filename (pbpfc80.hlp) from the Explorer or File
Manager This displays the Contents tab, which you can use to view lists
of objects.
• Using SHIFT+F1 from the Script view This displays Help for the
selected object function or event.
Navigating through The PFC Help file provides many helpful links among objects, functions, and
the Help file events:
• From an object You can display a dialog box with jumps to instance
variables, events, and functions. You can also:
• Click the See Also button to jump to related objects
• Click the Descendants button to display a list of descendants, if any
• Click the Ancestor button to jump to the ancestor object
• From an event or function You can display a code example, if
appropriate, for the event or function. You can also:
• Click the See Also button to jump to related objects
• Click the Object button to jump to the parent object
7
Sample application and code examples
8
CH A PTE R 2 Window Objects
About this chapter This chapter describes the base-class windows in the PowerBuilder
Foundation Class Library (PFC). Each discussion includes information on
usage, instance variables, events, and functions.
Contents The windows are listed in alphabetical order. The information for each
window includes an alphabetical listing of instance variables, events, and
object functions.
9
w_child
w_child
Description Ancestor for all PFC child windows.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this window as the ancestor for all of your application’s child windows.
See also w_master
10
Chapter 2 Window Objects
w_frame
Description Ancestor frame window for all MDI applications.
It includes MicroHelp automatically. To create a frame window without
MicroHelp, either modify or rename your application’s frame window.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships m_frame
n_cst_toolbarattrib
w_statusbar
w_toolbars
Usage Use this window or a descendant as the frame window for all MDI applications
that use PFC.
See also m_frame
w_master
w_statusbar
w_toolbars
11
w_frame
Instance variables
W_frame includes instance variables:
Instance
variable Description Data type Access Usage
inv_sheetmanager Reference variable for n_cst_winsrv_sheetmanager Public Set with
sheet management of_SetSheetManager
service
inv_statusbar Reference variable for n_cst_winsrv_statusbar Public Set with
status bar service of_SetStatusBar
Events
W_frame includes precoded events:
Activate pfc_PostOpen
Close pfc_PreToolbar
Hide pfc_TileHorizontal
Move pfc_TileVertical
pfc_Cascade pfc_Toolbars
pfc_Layer pfc_UndoArrange
pfc_MicroHelp Resize
pfc_MinimizeAll Show
Activate
Description Calls the n_cst_appmanager of_SetFrame function to establish this window as
the active frame.
This event extends the ancestor Activate event.
Usage This event executes when the window becomes active.
Close
Description Destroys any instantiated services.
Usage This event executes when the window closes.
12
Chapter 2 Window Objects
Hide
Description Calls the n_cst_winsrv_statusbar pfc_Hide event.
Usage This event executes when the window is hidden.
Move
Description Positions the status bar when the user moves the window.
This event extends the ancestor Move event.
Usage This event executes when the user moves the frame window.
pfc_Cascade
Description Calls the n_cst_winsrv_sheetmanager pfc_Cascade event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event executes when the user selects Window>Cascade from the menu bar
of a menu descended from the PFC m_master menu.
pfc_Layer
Description Calls the n_cst_winsrv_sheetmanager pfc_Layer event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event executes when the user selects Window>Layer from the menu bar
of a menu descended from the PFC m_master menu.
pfc_MicroHelp
Description Displays the passed string in the status bar.
This event extends the w_master pfc_MicroHelp event.
Syntax instancename.EVENT pfc_MicroHelp ( microhelp )
Argument Description
instancename Instance name of w_frame
microhelp String to be displayed in the status bar
13
w_frame
pfc_MinimizeAll
Description Minimizes all open sheets.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event executes when the user selects Window>Minimize All from the
menu bar of a menu descended from the PFC m_master menu.
pfc_PostOpen
Description Opens the w_statusbar window if this capability has been requested through
the of_SetStatusBar function.
This event extends the w_master pfc_PostOpen event.
Usage This event executes after the window opens.
pfc_PreToolbar
Description Populates toolbar attributes.
Syntax instancename.EVENT pfc_PreToolbar ( attributes )
Argument Description
instancename Instance name of w_frame
attributes N_cst_toolbarattrib variable into which the event places toolbar
attributes (passed by reference)
Usage The pfc_Toolbars event calls this event before displaying the w_toolbars
dialog box.
pfc_TileHorizontal
Description Tiles sheets horizontally.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event executes when the user selects Window >Tile Horizontal from the
menu bar of a menu descended from the PFC m_master menu.
pfc_TileVertical
Description Tiles open sheets vertically.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
14
Chapter 2 Window Objects
Usage This event executes when the user selects Window>Tile Vertical from the
menu bar of a menu descended from the PFC m_master menu.
pfc_Toolbars
Description Displays the w_toolbars dialog box.
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the
w_toolbars dialog box, and -1 if an error occurs.
Usage This event executes when the user selects View>Toolbars from the menu bar
of a menu that descends from the PFC m_master menu.
pfc_UndoArrange
Description Calls the n_cst_winsrv_sheetmanager pfc_UndoArrange event.
Return value Integer. Returns the number of sheets undone if the event succeeds and -1 if an
error occurs.
Usage This event executes when the user selects Window>Undo Arrange from the
menu bar of a menu descended from the PFC m_master menu.
Resize
Description Positions the status bar when the user resizes the window.
Usage This event executes when the user resizes the frame window.
Show
Description Calls the n_cst_winsrv_statusbar pfc_Show event.
Usage This event executes when the window displays after being hidden.
Functions
W_frame includes precoded object functions:
of_SetSheetManager
of_SetStatusBar
15
w_frame
of_SetSheetManager
Description Creates or destroys an instance of n_cst_winsrv_sheetmanager, which provides
sheet management services.
Access Public
Syntax windowname.of_SetSheetManager ( boolean )
Argument Description
windowname Instance name of w_frame
boolean Boolean specifying whether to create (TRUE) or destroy (FALSE)
an instance of the n_cst_winsrv_sheetmanager object
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetSheetManager function:
of_SetSheetManager(TRUE)
of_SetStatusBar(TRUE)
of_SetStatusBar
Description Creates or destroys an instance of n_cst_winsrv_statusbar, which provides
status bar services and opens the w_statusbar at the bottom of the frame.
Access Public
Syntax windowname.of_SetStatusBar ( boolean )
Argument Description
windowname Instance name of w_frame
boolean Boolean specifying whether to create (TRUE) or destroy (FALSE)
an instance of the n_cst_winsrv_statusbar object
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetStatusBar function:
of_SetStatusBar (TRUE)
16
Chapter 2 Window Objects
w_main
Description Ancestor main window for all SDI applications.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use w_main as the ancestor window for all single document interface (SDI)
applications.
See also w_master
17
w_master
w_master
Description W_master is the ancestor for all PFC windows. It includes instance variables,
events, and functions that are accessed by many PFC objects.
W_master is a self-updating object.
Ancestry
Library PFCWNSRV.PBL
PFEWNSRV.PBL
Object relationships n_cst_appmanager
n_cst_dberrorattrib
n_cst_dwsrv_linkage
n_cst_luw
n_cst_winsrv
n_cst_winsrv_preference
n_cst_resize
u_dw
Usage When writing a PFC-based application, all windows must descend from
w_master.
W_master is the ancestor of all PFC windows. When you add instance
variables, events, and functions to w_master, they are immediately available in
all PFC windows.
Descendants w_child
w_frame
w_main
w_popup
18
Chapter 2 Window Objects
w_response
w_sheet
See also n_cst_appmanager
n_cst_winsrv
n_cst_winsrv_preference
n_cst_resize
Instance variables
W_master includes instance variables:
Instance variable Description Data type Access Usage
CONTINUE_ACTION Constant set to 1 Integer Public Internal
FAILURE Constant set to -1 Integer Public Internal
ia_helptypeid Controls whether PFC calls Any Protected Set programmatically
the ShowHelp function by
topic, keyword, or index
ib_alwaysvalidate Controls whether the save Boolean Protected Set with
process includes all objects of_SetAlwaysValidate
in the validation process (default is FALSE)
ib_closestatus Indicates whether the Boolean Protected Internal
window is closing
ib_disableclosequery Indicates whether Boolean Protected Internal
CloseQuery processing is
enabled
ib_isupdateable Indicates whether the Boolean Protected Set with
window can be updated of_SetUpdateable
(default is TRUE)
ib_savestatus Controls whether message Boolean Protected Internal
display during the save
process
idw_active Current DataWindow U_dw Protected Internal
inv_base Reference variable for basic n_cst_winsrv Public Set with of_SetBase
window services
inv_dberrorattrib Contains database error n_cst_ Protected Set with
information dberrorattrib of_SetDBErrorMsg
inv_luw Reference variable for n_cst_luw Protected Set with of_
logical unit of work service SetLogicalUnitOfWork
inv_preference Reference variable for n_cst_winsrv_ Public Set with
window preference service preference of_SetPreference
19
w_master
Events
W_master includes precoded events:
Activate pfc_Open
Close pfc_PageSetup
CloseQuery pfc_PostOpen
Move pfc_PostUpdate
Open pfc_PreClose
pfc_AcceptText pfc_PreMRUSave
pfc_BeginTran pfc_PreOpen
pfc_Close pfc_PreUpdate
pfc_ControlGotFocus pfc_Print
pfc_DBError pfc_PrintImmediate
pfc_Descendant pfc_Save
pfc_EndTran pfc_SaveAs
pfc_Help pfc_SaveObjects
pfc_MessageRouter pfc_Update
pfc_MicroHelp pfc_UpdateObjects
pfc_MRUClicked pfc_UpdatePrep
pfc_MRUProcess pfc_UpdatesPending
pfc_MRURestore pfc_UpdatesPendingRef
pfc_MRUSave pfc_Validation
pfc_New Resize
20
Chapter 2 Window Objects
Activate
Description Calls the n_cst_mru pfc_MRURestore event to restore changed menu items as
needed.
Usage This event executes when the window becomes active.
Close
Description Stores preference information and destroys any existing window service
objects.
Usage This event executes when a window closes.
CloseQuery
Description Accesses all DataWindows, checks for validation errors and, if changes are
pending, prompts the user to save the changes.
Usage This event executes when a window closes, just before the Close event. It calls
one or more of the following:
• Pfc_PreClose
• Of_UpdateChecks
• Pfc_Save
Move
Description Stores the window position and size.
Usage This event executes when the user moves a window.
Open
Description Triggers the pfc_PreOpen event and posts the pfc_PostOpen event. If the
preference and MRU services are enabled, this event also restores window
settings and MRU information.
Usage This event executes when the window opens. It's best to add application-
specific code to either the pfc_PreOpen or pfc_PostOpen events.
21
w_master
pfc_AcceptText
Description Calls the n_cst_luw of_AcceptText function, which in turn calls the
of_AcceptText function for all controls that implement it.
Syntax instancename.EVENT pfc_AcceptText ( controlarray, focusonerror )
Argument Description
instancename Instance name of the w_master-based descendant
controlarray PowerObject array containing the controls for which to accept text.
From within the pfc_AcceptText event, access this value through
the apo_control argument
focusonerror Boolean specifying whether to set focus on a DataWindow column
with errors. From within the pfc_AcceptText event, access this
value through the ab_focusonerror argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the of_UpdateChecks function.
pfc_BeginTran
Description Empty user event that you extend to perform start-of-transaction processing.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the pfc_Save event.
pfc_Close
Description Closes the window.
Usage Call this event to close a window.
pfc_ControlGotFocus
Description Triggered when a PFC visual control gets focus. This event keeps track of the
current control.
Syntax instancename.EVENT pfc_ControlGotFocus ( control )
Argument Description
instancename Instance name of the w_master-based descendant
control DragObject variable containing the control that just received focus
Usage This event is called by PFC visual controls when they get focus.
22
Chapter 2 Window Objects
pfc_DBError
Description Displays a database error encountered during the pfc_Save process.
Usage This event is called by pfc_Save if an update error occurs.
pfc_Descendant
Description PFC events and functions call this event to determine if the window is inherited
from w_master.
Return value Boolean. Always returns TRUE.
Usage Internal.
pfc_EndTran
Description Empty user event that you extend to initiate end-of-transaction processing,
such as COMMIT or ROLLBACK.
Syntax instancename.EVENT pfc_EndTran ( savecode )
Argument Description
instancename Instance name of the w_master-based descendant
savecode Integer specifying the return code from the pfc_Update function.
From within the pfc_EndTran event, access this value through the
ai_update_results argument
Return value Integer. Return 1 if the end transaction process succeeds and other application-
specific values as appropriate.
Usage This event is called by pfc_Save. The value passed in savecode indicates
whether previous updates succeeded or failed. Based on savecode, you extend
this event to add COMMIT, ROLLBACK, or other end-of-transaction
processing.
Examples This example extends the pfc_EndTran event to COMMIT all open
transactions. This example returns 0 if it succeeds and -1 if a COMMIT fails:
n_tr ltr_trans[ ]
Integer li_trans, li_count
23
w_master
Long ll_return
li_trans = &
gnv_app.inv_trregistration.of_GetRegistered &
(ltr_trans)
IF li_trans = 0 THEN Return 0
For li_count = 1 to li_trans
ll_return = ltr_trans[li_count].of_Commit()
IF ll_return < 0 THEN Return -1
Next
Return 0
pfc_Help
Description Calls the ShowHelp function by index, topic or keyword, based on the
ia_helptypeid instance variable.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is triggered when the window has focus and the user selects
Help>Help Topics from the menu bar of a menu that descends from the PFC
m_master menu. You can also trigger it directly (from a Help
CommandButton, for example).
If the Help type ID is not specified, this event opens the top-level Help contents
topic. Call the n_cst_appmanager of_SetHelpfile function to specify the
application’s Help filename.
pfc_MessageRouter
Description Triggers the passed user event. This event first attempts to trigger the passed
user event on the window, then the current control. If the user event is not
found, it then attempts to trigger the passed user event on the last active
DataWindow control.
Syntax instancename.EVENT pfc_MessageRouter ( userevent )
Argument Description
instancename Instance name of the w_master-based descendant
userevent String specifying the event to trigger. From within the
pfc_MessageRouter event, access this value through the
as_message argument
Return value Integer. Returns 1 if the event succeeds, 0 if no objects contain the user event,
and -1 if an error occurs.
24
Chapter 2 Window Objects
Usage This event is triggered when the user selects a menu choice that calls the
of_SendMessage menu function.
All PFC visual controls, including u_dw, include events that work with the
message router.
pfc_MicroHelp
Description Ancestor event to which descendants add code that displays MicroHelp.
Syntax instancename.EVENT pfc_MicroHelp ( microhelp )
Argument Description
instancename Instance name of the w_master-based descendant
microhelp String to be displayed in the status bar
pfc_MRUClicked
Description Checks for the existence of the specified menu item in the MRU DataStore and
calls the pfc_MRUProcess event if the menu item is found.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Internal.
pfc_MRUProcess
Description Empty user event that you extend to open the appropriate window based on the
clicked MRU menu item.
Syntax instancename.EVENT pfc_MRUProcess ( row )
Argument Description
instancename Instance name of the w_master-based descendant
row Integer specifying the MRU DataStore row that corresponds to the
clicked MRU menu item. From within the pfc_MRUProcess event,
access this value through the ai_row argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage You extend this event to open windows (SDI) or sheets (MDI) with or without
passing parameters.
The pfc_w_master ancestor contains sample code for this event.
25
w_master
Examples This example shows code you might add to the pfc_MRUProcess event:
window lw_frame, lw_window
n_cst_menu lnv_menu
n_cst_mruattrib lnv_mruattrib
// check parameters
if isnull(ai_row) or (ai_row < 1) then
return -1
end if
if not isvalid(gnv_app.inv_mru) then
return -1
end if
// retrieve row from datastore and do work with it
gnv_app.inv_mru.of_getitem(ai_row, lnv_mruattrib)
// get the mdi frame if necessary
lnv_menu.of_getmdiframe(this.menuid, lw_frame)
//example opens
// SDI Process
//open(lw_window, lnv_mruattrib.is_classname)
//openwithparm(lw_window, &
// lnv_mruattrib.is_menuitemkey, &
// lnv_mruattrib.is_classname)
// MDI Process
//opensheet(lw_window, lnv_mruattrib.is_classname, &
// lw_frame)
//opensheet(lw_window, lnv_mruattrib.is_classname, &
// lw_frame, 0, original!)
Return opensheetwithparm(lw_window, &
lnv_mruattrib.is_menuitemkey, &
lnv_mruattrib.is_classname, lw_frame, 0, &
original! )
pfc_MRURestore
Description Empty user event that you extend to restore MRU settings.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Add code to this event that calls the n_cst_mru of_Restore function.
The pfc_w_master ancestor contains sample code for this event.
Examples This example shows the code you add to the pfc_MRURestore event:
If IsValid(gnv_app.inv_mru) Then
Return gnv_app.inv_mru.of_Restore(ls_id, This)
End If
26
Chapter 2 Window Objects
pfc_MRUSave
Description Saves MRU information for the current window.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Call this event when the window opens (typically in the pfc_PreOpen event).
This event calls the pfc_PreMRUSave event. You must add code to
pfc_PreMRUSave that populates the n_cst_mruattrib object with the ID,
classname, key, menu item text, and menu item help to be saved.
pfc_New
Description Empty user event into which you place code that performs processing to add a
new entity to the current window, window control, or DataWindow.
Usage Use this event for application- and window-specific new entity processing.
This event is triggered when the user selects File>New from the menu bar of a
menu that descends from the PFC m_master menu.
Examples This example, which might be found in a descendent sheet or main window,
inserts a new row into the active DataWindow when the user selects File>New
from the menu bar:
idw_active.InsertRow(0)
pfc_Open
Description Empty user event into which you place code that performs processing to open
a new entity (typically a file) in the current window, window control, or
DataWindow.
Usage Use this event for application- and window-specific open processing.
This event is triggered when the user selects File>Open from the menu bar of
a menu that descends from the PFC m_master menu.
Examples This example, which might be found in a descendent sheet or main window,
displays the Open dialog box when the user selects File>Open from the menu
bar. Is_fullname and is_filename are instance variables:
Integer li_fileid
SetPointer (HourGlass!)
IF GetFileOpenName &
("Open", is_fullname, is_filename &
"txt", "Text Files (*.txt),*.txt) < 1 THEN
27
w_master
Return
END IF
// Open the new file and put results into the MLE.
li_fileid = FileOpen(is_fullname, StreamMode!)
FileRead (li_fileid, mle_notepad.text)
FileClose (li_fileid)
...
pfc_PageSetup
Description Empty user allowing you to add code to display a Page Setup dialog box and
print multiple DataWindows.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Call this event to synch page setup properties among multiple DataWindows.
Examples This example synchs the paper source for three DataWindows:
Integer li_rc
s_pagesetupattrib lstr_pagesetup
pfc_PostOpen
Description Empty user event into which you place code that performs processing just after
a window opens.
Usage Use this event for application- and window-specific post-open processing. This
event executes just after a window opens.
Examples This example calls the Retrieve function in a window’s pfc_PostOpen event:
Long ll_return
28
Chapter 2 Window Objects
gnv_app.of_getframe().SetMicroHelp &
(String(ll_return) + " rows retrieved")
END IF
pfc_PostUpdate
Description Calls the n_cst_luw of_PostUpdate function, which in turn calls the
of_PostUpdate function for all controls that implement it.
Syntax instancename.EVENT pfc_PostUpdate ( controlarray )
Argument Description
instancename Instance name of the w_master-based descendant
controlarray PowerObject array containing the controls for which to perform
post update processing. From within the pfc_AcceptText event,
access this value through the apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The pfc_Save user event calls this event after calling the pfc_DBError user
event.
You can extend this event to perform additional post-update processing.
pfc_PreClose
Description Empty user event that you extend to perform processing just before a window
closes.
Return value Integer. Return 1 if the pre-close process succeeds and -1 to prevent the
window from closing.
Usage Use this event for application- and window-specific pre-close processing.
This event executes just before CloseQuery processing.
Examples This example uses the pfc_PreClose function to write to a log file:
IF inv_filesrv.of_FileWrite &
(is_logfile, "Window: " + this.title &
+ " closing at " + String(Today()) &
+ String(Now()),TRUE) = 1 THEN
Return 1
ELSE
Return -1
END IF
29
w_master
pfc_PreMRUSave
Description Empty user event that you extend to create MRU information that you can later
access when opening windows.
Syntax instancename.EVENT pfc_PreMRUSave ( mruattrib )
Argument Description
instancename Instance name of the w_master-based descendant
mruattrib N_cst_mruattrib into which the event places window
information
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The pfc_MRUSave event calls this event.
The pfc_w_master ancestor contains sample code for this event.
Examples This example shows code you might add to the pfc_PreMRUSave event:
anv_mruattrib.is_id = "empinfo"
anv_mruattrib.is_classname = this.classname()
anv_mruattrib.is_menuitemname = this.title
anv_mruattrib.is_menuitemkey = this.classname()
anv_mruattrib.is_menuitemmhelp = &
"Opens " + this.classname()
pfc_PreOpen
Description Empty user event into which you place code that performs processing just
before a window opens.
Usage Use this event for application- and window-specific pre-open processing.
If you are using n_cst_mru to track most recently used windows, you typically
call the pfc_MRUSave event from this event.
This event executes just before a window opens.
Examples This example connects to the database in the frame window’s pfc_PreOpen
event:
String ls_file, ls_section
Long ll_return
ls_file = "c:\pbapp\pbapp.ini"
ls_section = "PBAppDB"
itr_pbapp.of_Init(ls_file, ls_section)
ll_return = itr_pbapp.of_Connect()
30
Chapter 2 Window Objects
pfc_PreUpdate
Description Empty user event into which you place pre-save processing.
Return value Integer. Return 1 if the pre-save processing succeeds and -1 if it does not.
Usage Extend this event to perform application-specific pre-save processing.
The pfc_Save user event calls this event before performing any save
processing. If you return -1, save processing terminates.
Examples This example adds code to the pfc_PreUpdate event to check for user ID:
String ls_user
ls_user = gnv_app.of_GetUserID()
IF ls_user = "RNielsen" THEN
Return -1
ELSE
Return 1
END IF
pfc_Print
Description Empty user event into which you place code that prints windows or
DataWindows, first displaying the Print dialog box.
Usage Extend this event to print application- and window-specific information. For
example, you might print a single DataWindow. Alternatively, you might call
the DataWindow report service’s of_CreateComposite function to create a
composite report of all the window’s DataWindows.
This event is triggered when the user selects File>Print from the menu bar of a
menu that descends from the PFC m_master menu.
Examples This example synchs the copies property of all DataWindows on the window:
Integer li_rc
s_printdlgattrib lstr_printdlg
31
w_master
lstr_printdlg.l_copies
dw_3.object.datawindow.print.copies = &
lstr_printdlg.l_copies
END IF
pfc_PrintImmediate
Description Empty user event into which you place code that prints windows or
DataWindows without displaying the Print dialog box.
Usage Extend this event to print application- and window-specific information.
This event is triggered when the user selects File>Print Immediate from the
menu bar of a menu that descends from the PFC m_master menu.
Examples This example prints the dw_employee DataWindow:
IF dw_employee.Event pfc_PrintImmediate( ) <> 1 THEN
Return -1
END IF
pfc_Save
Description Calls w_master user events and functions to save changes for all self-updating
objects in the window.
Return value Integer. Returns values as follows:
• 1 All save processes succeeded
• 0 No pending updates
• -1 Accept text error
• -2 Updates pending error
• -3 Validation error
• -4 Pre-update process failed
• -5 Pfc_BeginTran failed
• -6 Pfc_Update failed
• -7 Pfc_EndTran failed
• -8 Post-update process failed
• -9 Update prep process failed
32
Chapter 2 Window Objects
Usage The CloseQuery event calls this user event automatically to check for pending
updates and initiate the save process. You can call it from your application to
save changes, as needed.
For more on the save process, see n_cst_luw on page 1051.
pfc_SaveAs
Description Empty user event allowing you to save all or part of a window.
Usage This event is triggered when the user selects File>Save As from the menu bar
of a menu that descends from the PFC m_master menu.
Examples This example displays the Save As dialog box:
String is_docname, is_named
Integer li_value
pfc_SaveObjects
Description Performs a save on the specified controls.
Syntax instancename.EVENT pfc_SaveObjects ( controlarray )
Argument Description
instancename Instance name of the w_master-based descendant
controlarray PowerObject array containing the controls for which to perform
save processing. From within the pfc_SaveObjects event, access
this value through the apo_control argument
33
w_master
• -5 Pfc_BeginTran failed
• -6 Pfc_Update failed
• -7 Pfc_EndTran failed
• -8 Post-update process failed
• -9 Update prep process failed
Usage Call the of_SetUpdateObjects function to establish the array of controls to be
updated.
Examples This example calls the pfc_SaveObjects event:
PowerObject lpo_save[ ]
Integer li_return
lpo_save[1] = dw_1
this.of_SetUpdateObjects(lpo_save)
li_return = this.EVENT pfc_SaveObjects(lpo_save)
...
pfc_Update
Description Calls the pfc_UpdateObjects event.
Syntax instancename.EVENT pfc_Update ( controlarray )
Argument Description
instancename Instance name of the w_master-based descendant
controlarray PowerObject array containing the controls to be updated. From
within the pfc_Update event, access this value through the
apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if one or more DataWindow
update errors occur.
Usage The pfc_Save event calls this event.
pfc_UpdateObjects
Description Calls the n_cst_luw of_Update function, which in turn calls the of_Update
function for all controls that implement it.
Syntax instancename.EVENT pfc_UpdateObjects ( controls, accepttext, resetflags )
Argument Description
instancename Instance name of the w_master-based descendant
34
Chapter 2 Window Objects
Argument Description
controls PowerObject array containing the objects to update. This argument
is accessed through the apo_control argument
accepttext Boolean specifying whether n_cst_luw should automatically
perform an AcceptText before performing the Update (TRUE) or
not (FALSE)
resetflags Boolean specifying whether n_cst_luw should automatically reset
DataWindow update flags (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the event succeeds, 0 if no action was taken, and -1 if one
or more update errors occur.
Usage The of_Update function and the pfc_Update event call this event.
pfc_UpdatePrep
Description Empty user event to which you can add code that prepares for update.
Syntax instancename.EVENT pfc_UpdatePrep ( controls )
Argument Description
instancename Instance name of the w_master-based descendant
controls PowerObject array containing the objects to update. This argument
is accessed through the apo_control argument
Return value Long. Return 1 if the update preparation succeeds and -1 to halt the update
process.
Usage The of_UpdatePrep function calls this event.
pfc_UpdatesPending
Description Calls the pfc_UpdatesPendingRef event.
When CloseQuery calls this user event, validation messages are suppressed.
Syntax instancename.EVENT pfc_UpdatesPending ( controlarray )
Argument Description
instancename Instance name of the w_master-based descendant
controlarray PowerObject array containing controls to be tested for pending
updates
35
w_master
• 0 No pending updates
• -1 AcceptText failed
Usage The CloseQuery event calls this event to determine if there are pending
updates.
pfc_UpdatesPendingRef
Description Calls the n_cst_luw of_UpdatesPending function, which in turn calls the
of_UpdatesPending function for all controls that implement it.
Syntax instancename.Eventpfc_UpdatesPendingRef ( controls, pending )
Argument Description
instancename Instance name of the w_master-based descendant
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
pending PowerObject array to contain objects with pending updates. This
argument is accessed through the apo_pending argument
(passed by reference)
pfc_Validation
Description Calls the n_cst_luw of_Validation function, which in turn calls the
of_Validation function for all controls that implement it.
Syntax instancename.EVENT pfc_Validation ( controlarray )
Argument Description
instancename Instance name of the w_master-based descendant
controlarray PowerObject control array containing controls to be validate
Return value Integer. Returns 1 if there are no validation errors and -1 if a validation error
occurs.
36
Chapter 2 Window Objects
Usage The of_Validation and of_UpdateChecks functions call this event to determine
if there are validation errors.
Resize
Description Triggers automatic resize processing, if enabled in n_cst_resize.
Usage This event executes when the user resizes the window.
Functions
W_master includes precoded object functions:
of_AcceptText of_SetDBErrorMsg
of_GetCloseStatus of_SetLogicalUnitOfWork
of_GetDWType of_SetPreference
of_GetInfo of_SetResize
of_GetSaveStatus of_SetUpdateable
of_GetUpdateObjects of_SetUpdateObjects
of_IsAlwaysValidate of_SetUpdateRequestor
of_IsUpdateable of_Update
of_MessageBox of_UpdateChecks
of_PostUpdate of_UpdatePrep
of_SetAlwaysValidate of_UpdatesPending
of_SetBase of_Validation
of_AcceptText
Description Calls the pfc_AcceptText event.
Access Public
Syntax instancename.of_AcceptText ( focusonerror )
Argument Description
instancename Instance name of w_master
focusonerror Boolean indicating whether PFC sets focus to the first item in error
when an error occurs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
37
w_master
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize accept text processing,
extend the pfc_AcceptText event.
Examples This example is from the n_cst_luw of_AcceptText function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_AcceptText &
(ab_focusonerror)
If li_rc < 0 Then Return -1
...
of_GetCloseStatus
Description Reports the window’s close status (whether the window is closing.)
Access Public
Syntax windowname.of_GetCloseStatus ( )
Argument Description
windowname Instance name of w_master
Return value Boolean. Returns TRUE if the window is closing and FALSE if it is not.
Usage PFC does not report validation errors if the window is closing.
Examples This example calls the of_GetCloseStatus function:
IF al_row <> 0 AND &
(Not lw_parent. of_GetCloseStatus ( )) THEN
IF IsValid(gnv_app) THEN
MessageBox(gnv_app.iapp_object.Appname, &
"Required Value Missing for " &
+ as_colname + " on row " + &
String(al_row) + &
’. Please enter a value.’, StopSign!)
ELSE
...
of_GetDWType
Description Indicates whether a DataWindow is a descendant of u_dw and whether it uses
the linkage service.
Access Protected
38
Chapter 2 Window Objects
of_GetInfo
Description Retrieves object information.
Access Public
Syntax instancename.of_GetInfo ( infoobject )
Argument Description
instancename Instance name of w_master
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
w_emplist.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
39
w_master
of_GetSaveStatus
Description Reports the window’s save status (whether the window is in the process of
updating its DataWindows).
Access Public
Syntax windowname.of_GetSaveStatus ( )
Argument Description
windowname Instance name of w_master
Return value Boolean. Returns TRUE if the window is updating and FALSE if it is not.
Usage Call this function to determine whether a window is updating its
DataWindows.
Examples This example calls the of_GetSaveStatus function:
...
IF lw_parent.TriggerEvent &
("pfc_Descendant") = 1 THEN
lb_pfcsaveprocess = &
lw_parent.of_GetSaveStatus()
END IF
...
of_GetUpdateObjects
Description Retrieves the current default array of objects affected by the update process.
Access Protected
Syntax instancename.of_GetUpdateObjects ( objects )
Argument Description
instancename Instance name of w_master
objects PowerObject array into which the function places objects to be
updated (passed by reference)
Return value Integer. Returns the number of elements in the objects array if the function
succeeds and -1 if an error occurs.
Examples This example calls the of_GetUpdateObjects function:
PowerObject lpo_objs[ ]
Integer li_return, li_count
li_return = this.of_GetUpdateObjects(lpo_objs)
FOR li_count = 1 to li_return
40
Chapter 2 Window Objects
of_IsAlwaysValidate
Description Reports whether the default save process always performs validation.
Access Protected
Syntax instancename.of_IsAlwaysValidate ( )
Argument Description
instancename Instance name of w_master
Return value Boolean. Returns TRUE if the default save process always performs validation
and FALSE if it does not.
Examples This example calls the of_IsAlwaysValidate function:
IF this.of_IsAlwaysValidate() = TRUE THEN
MessageBox("Window", "Always validate")
ELSE
MessageBox("Window", "Sometimes validate")
END IF
of_IsUpdateable
Description Reports whether the window is updatable and should be included in save
processing.
Access Protected
Syntax instancename.of_IsUpdateable ( )
Argument Description
instancename Instance name of w_master
Return value Boolean. Returns TRUE if the window is updatable and FALSE if it is not.
Usage Internal.
41
w_master
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of w_master
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in windows.
The id argument is not used in the default implementation.
42
Chapter 2 Window Objects
of_PostUpdate
Description Calls the pfc_PostUpdate event.
Access Public
Syntax instancename.of_PostUpdate ( )
Argument Description
instancename Instance name of w_master
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize post-update processing,
extend the pfc_PostUpdate event.
Examples This example is from the n_cst_luw of_PostUpdate function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_PostUpdate()
...
of_SetAlwaysValidate
Description Specifies whether the default save process always performs validation.
Access Protected
Syntax instancename.of_SetAlwaysValidate ( boolean )
Argument Description
instancename Instance name of w_master
boolean Boolean specifying whether the default save process always
perform validation (TRUE) or only performs validation if a
control has pending updates (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAlwaysValidate function:
this.of_SetAlwaysValidate(TRUE)
43
w_master
of_SetBase
Description Enables or disables n_cst_winsrv, which provides basic window services.
Access Public
Syntax instancename.of_SetBase ( boolean )
Argument Description
instancename Instance name of w_master
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
an instance of the n_cst_winsrv object
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_winsrv. This instance
is named inv_base.
Because all window services are descendants of n_cst_winsrv (and have
n_cst_winsrv functions available to them), use this object when you require
basic window services only.
Examples This example calls the of_SetBase function in a window Open event to enable
basic window services:
this.of_SetBase (TRUE)
of_SetDBErrorMsg
Description Saves a database update error message for display after save processing
completes.
Access Public
Syntax windowname.of_SetDBErrorMsg ( message )
Argument Description
windowname Instance name of w_master
message String or n_cst_dberrorattrib containing the error message
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to save a database error message for display after
ROLLBACK processing completes.
44
Chapter 2 Window Objects
The u_dw DBError event populates this instance variable, suppressing the
display of a message dialog box. This allows you to roll back changes in the
pfc_EndTran event. After calling pfc_EndTran, the pfc_Save process displays
this message.
Examples This example is from the u_dw DBError event:
...
If IsValid(lpo_updaterequestor) Then
lpo_updaterequestor.Dynamic Function &
of_SetDBErrorMsg(lnv_dberrorattrib)
Else
...
of_SetLogicalUnitOfWork
Description Enables or disables n_cst_luw, which provides the logical unit of work service.
Access Public
Syntax instancename.of_SetLogicalUnitOfWork ( boolean )
Argument Description
instancename Instance name of w_master
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) n_cst_luw
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_luw. This instance is
named inv_luw. If you do not enable n_cst_luw, w_master enables it
automatically.
Examples This example calls the of_SetLogicalUnitOfWork function:
this.of_SetLogicalUnitOfWork(TRUE)
of_SetPreference
Description Enables or disables n_cst_winsrv_preference, the window preference service.
Access Public
Syntax instancename.of_SetPreference ( boolean )
Argument Description
instancename Instance name of w_master
45
w_master
Argument Description
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
an instance of the n_cst_winsrv_preference object
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_winsrv_preference.
This instance is named inv_preference.
Examples This example calls the of_SetPreference function:
this.of_SetPreference(TRUE)
of_SetResize
Description Enables or disables n_cst_resize, the resize service.
Access Public
Syntax instancename.of_SetResize ( boolean )
Argument Description
instancename Instance name of w_master
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
an instance of the n_cst_resize object
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_resize. This instance
is named inv_resize.
Examples This example calls the of_SetResize function:
this.of_SetResize(TRUE)
of_SetUpdateable
Description Specifies whether the window is updatable and should be included in a default
save process.
Access Protected
Syntax instancename.of_SetUpdateable ( boolean )
Argument Description
instancename Instance name of w_master
46
Chapter 2 Window Objects
Argument Description
boolean Boolean indicating whether the window is updatable
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to disable default save processing for windows that are not
updatable.
Examples This example calls the of_SetUpdateable function:
this.of_SetUpdateable(FALSE)
of_SetUpdateObjects
Description Sets a new default array containing objects for which updates are attempted.
Access Protected
Syntax instancename.of_SetUpdateObjects ( requestor )
Argument Description
instancename Instance name of u_dw
requestor PowerObject array containing the object to be updated
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to customize the objects updated by the save process. You
can even add other windows to the save process.
Examples This example calls the of_SetUpdateObjects function:
PowerObject lpo_objs[ ]
Integer li_count
lpo_objs = this.control
li_count = UpperBound(lpo_objs)
li_count++
// Update w_other as well as this window
lpo_objs[li_count] = w_other
Return this.of_SetUpdateObjects(lpo_objs)
of_SetUpdateRequestor
Description Creates a reference to the object requesting an update within a logical unit of
work.
Access Protected
Syntax instancename.of_SetUpdateRequestor ( requestor )
47
w_master
Argument Description
instancename Instance name of w_master
requestor PowerObject containing the object requesting the update
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_SetLogicalUnitOfWork function:
...
inv_luw = create n_cst_luw
inv_luw.of_SetRequestor (this)
inv_luw.of_SetUpdateRequestor (this)
...
of_Update
Description Calls the pfc_UpdateObjects event.
Access Public
Syntax instancename.of_Update ( accept, resetflag {, requestor } )
Argument Description
instancename Instance name of w_master
accept Boolean indicating whether the Update function performs an
AcceptText before saving rows to the database
resetflag Boolean indicating whether the Update function resets the update
flags
requestor PowerObject containing the requestor object
(optional)
Return value Integer. Returns 1 if the update succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update processing, extend
the pfc_Update event.
You typically call the pfc_Save event instead of this function.
Examples This example is from the n_cst_luw of_Update function:
...
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Update &
(ab_accepttext, ab_resetflag, &
lpo_updaterequestor)
48
Chapter 2 Window Objects
of_UpdateChecks
Description Determines whether edits are pending and whether there are any validation
errors.
Access Protected
Syntax instancename.of_UpdateChecks ( { controls } )
Argument Description
instancename Instance name of w_master
controls PowerObject array containing the objects to be checked
(optional)
of_UpdatePrep
Description Calls the pfc_UpdatePrep event, which allows you to code additional update
preparation logic.
Access Public
Syntax instancename.of_UpdatePrep ( )
49
w_master
Argument Description
instancename Instance name of w_master
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update preparation
processing, extend the pfc_UpdatePrep event.
Examples This example is from the n_cst_luw of_UpdatePrep function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_UpdatePrep()
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatesPending
Description Calls the pfc_UpdatesPendingRef event.
Access Public
Syntax instancename.of_UpdatesPending ( )
Argument Description
instancename Instance name of w_master
50
Chapter 2 Window Objects
of_Validation
Description Calls the pfc_Validation event.
Access Public
Syntax instancename.of_Validation ( )
Argument Description
instancename Instance name of w_master
Return value Integer. Returns 1 if the function succeeds and -1 if a validation error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize validation processing,
extend the pfc_Validation event.
Examples This example calls the of_Validation function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_Validation()
...
51
w_popup
w_popup
Description Ancestor for all PowerBuilder Foundation Class Library popup windows.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use w_popup as the ancestor window for all popup windows.
See also w_master
52
Chapter 2 Window Objects
w_response
Description Ancestor for all PFC response windows.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use w_response as the ancestor window for all response windows.
Add OK, Cancel, and window-specific CommandButtons to your w_response
descendant. Then add code to the CommandButtons’ Clicked events to trigger
the appropriate w_response user event. Typically, Cancel triggers pfc_Cancel,
Apply triggers pfc_Apply, and OK triggers pfc_Default.
See also w_master
Events
W_response includes predefined events:
pfc_Apply pfc_Default
pfc_Cancel
53
w_response
pfc_Apply
Description Empty user event to which you add code that applies dialog box specifications
to the associated sheet or window.
Usage Add code to this event to apply specifications to the associated sheet or
window. Trigger this user event from a cb_apply.Clicked event script.
Examples This example shows code you might add to pfc_Apply:
Integer li_cnt, li_arraysize, li_rc
Boolean lb
ToolbarAlignment lt
String ls
pfc_Cancel
Description Empty user event to which you add code that closes the window without
accepting changes.
Usage Add code to this user event to close the window without accepting changes.
Trigger this user event from the cb_cancel.Clicked event script.
Examples This example closes the window and passes a return value of 0:
CloseWithReturn(This, 0)
54
Chapter 2 Window Objects
pfc_Default
Description Event to apply changes and close a response window.
Usage Add code to this event to apply changes and close a response window. It is
meant to be triggered by the default CommandButton (typically cb_ok), but it
could be triggered by Cancel, Close, or some other CommandButton.
Examples This example shows code you might add to the pfc_Default:
SetPointer(HourGlass!)
SQLCA.dbms = "ODBC"
SQLCA.database = "expense"
SQLCA.logid = sle_userid.text
SQLCA.logpass = sle_password.text
SQLCA.dbparm = "Connectstring=’DSN=" + &
SQLCA.database + ";UID=" + &
SQLCA.logid + ";PWD=" + SQLCA.logpass + "’"
IF SQLCA.of_Connect() <> 0 THEN
MessageBox("Login Error", SQLCA.SQLErrText)
CloseWithReturn(This, 0)
ELSE
CloseWithReturn(This, 1)
END IF
55
w_sheet
w_sheet
Description Ancestor for all PowerBuilder Foundation Class Library sheet windows.
This window contains automatic MicroHelp display capability.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships n_cst_string
Usage Use this window as the ancestor for all of your application’s sheet windows.
If you want to display MicroHelp for controls within a sheet, associate the
MicroHelp text with each control’s tag value. The control’s tag value must
specify MICROHELP=microhelptext. When the control gets focus, the
pfc_ControlGotFocus event displays the tag text in the status bar.
See also w_frame
w_master
Events
W_sheet includes predefined events:
Activate
56
Chapter 2 Window Objects
pfc_MicroHelp
pfc_ControlGotFocus
Activate
Description Sets MicroHelp to the control with focus.
Usage This event executes whenever the window receives focus.
pfc_ControlGotFocus
Description Displays the MicroHelp stored in the control’s tag value.
This event extends the ancestor pfc_ControlGotFocus event.
Syntax instancename.EVENT pfc_ControlGotFocus ( control )
Argument Description
instancename Instance name of w_sheet-based descendant
control DragObject variable containing the control that just got focus
Usage This event is called by PFC visual controls when they get focus.
The control’s tag value must specify MICROHELP=microhelptext.
pfc_MicroHelp
Description Updates MicroHelp by calling the frame’s pfc_MicroHelp event.
This event extends the ancestor pfc_MicroHelp event.
Syntax instancename.EVENT pfc_MicroHelp ( microhelp )
Argument Description
instancename Instance name of w_sheet-based descendant
microhelp String to be displayed in the status bar
Usage This event executes whenever the sheet or a control on the sheet receives focus.
57
w_sheet
58
CH A PTE R 3 Menus
About this chapter This chapter describes the menus in the PowerBuilder Foundation Class
Library (PFC).
Contents The menus are listed in alphabetical order. The information for each menu
includes an alphabetical listing of instance variables, events, and menu
functions.
59
m_dw
m_dw
Description Popup menu displayed when the user releases the right mouse button over a
u_dw based DataWindow control.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Table menu
Menu items
Menu item Description
Cut Calls the pfc_Cut event
Copy Calls the pfc_Copy
Paste Calls the pfc_Paste event
Select All Calls the pfc_SelectAll event
Insert Calls the pfc_InsertRow event
Add Calls the pfc_AddRow event
Delete Calls the pfc_DeleteRow event
Restore Calls the pfc_RestoreRow event
Columns Calls the pfc_Columns event
Functions Calls the pfc_Functions event
Operators Calls the pfc_Operators event
Values Calls the pfc_Values event
DataWindow Calls the pfc_Debug event
Properties
Properties Empty menu item. Add calls to functions or events that
display properties for a DataWindow column
60
Chapter 3 Menus
Instance variables
M_dw includes one instance variable:
Instance variable Description Data type Access Usage
idw_parent Owning DataWindow DataWindow Protected Used to access the current
control. DataWindow control
Functions
M_dw includes one precoded object function:
of_SetParent
of_SetParent
Description Establishes the current DataWindow control.
Access Public
Syntax instancename.of_SetParent ( currentdw )
Argument Description
instancename Instance name of m_dw
currentdw DataWindow variable identifying the DataWindow that opened
this instance of m_dw
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage U_dw calls this function to establish a relationship with m_dw.
Examples This example is from the u_dw RButtonUp event:
...
lm_dw = create m_dw
lm_dw.of_SetParent(this)
...
61
m_edit
m_edit
Description Popup menu displayed when the user releases the right mouse button over
certain PFC visual controls.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Edit menu
Menu items
Menu
item Description
Cut Calls the pfc_Cut event for the current window or window control
Copy Calls the pfc_Copy event for the current window or window control
Paste Calls the pfc_Paste event for the current window or window control
Select All Calls the pfc_SelectAll event for the current window or window
control
62
Chapter 3 Menus
Instance variables
M_edit includes one instance variable:
Instance variable Description Data type Access Usage
idrg_current Current window or window DragObject Protected Used to access the current
control control
Functions
M_edit includes one precoded object function:
of_SetParent
of_SetParent
Description Establishes the current control.
Access Public
Syntax instancename.of_SetParent ( currentcontrol )
Argument Description
instancename Instance name of m_edit
currentcontrol DragObject containing the control that opened this instance of
m_edit
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage PFC visual objects call this function to establish a relationship with m_edit.
Examples This example is from the u_rte RButtonUp event:
Integer li_rc
m_edit lm_edit
Window lw_parent
String ls_selectedtext
...
lm_edit = create m_edit
lm_edit.of_SetParent(this)
...
63
m_frame
m_frame
Description The m_frame menu is a descendant of m_master with most items disabled and
hidden. Use this menu as the frame menu for your application, modifying and
adding menu items as necessary.
Ancestry
Library PFEWNSRV.PBL
File menu
Menu items
Menu
item Description
New Calls the pfc_New event for the frame window
Open Calls the pfc_Open event for the frame window
Exit Calls the pfc_Exit event for the frame window
Help menu
Menu items
Menu item Description
Help Topics Calls the pfc_Help event for the frame window
About Calls the n_cst_appmanager of_About function
64
Chapter 3 Menus
m_lvs
Description Popup menu displayed when the user releases the right mouse button over a
ListView based on u_lvs.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
View menu
Menu items
Menu item Description
View Changes the ListView display style. Options are:
• Large icon
• Small icon
• List
• Report
Arrange Icons Sorts the display by the specified column
Select All Calls the pfc_SelectAll event
Invert Selection Calls the pfc_InvertSelection event
Cut Calls the pfc_Cut event
Copy Calls the pfc_Copy event
Paste Calls the pfc_Paste event
Clear Calls the pfc_Clear event
New Calls the pfc_New event
Delete Calls the pfc_Delete event
Rename Calls the pfc_Rename event
65
m_lvs
Instance variables
M_lvs includes one instance variable:
Instance variable Description Data type Access Usage
ilv_parent ListView control displaying ListView Protected Used to access the associated
the popup menu. ListView control
Functions
M_lvs includes one precoded object function:
of_SetParent
of_SetParent
Description Establishes the ListView control associated with an instance of the m_lvs
popup menu.
Access Public
Syntax instancename.of_SetParent ( listview )
Argument Description
instancename Instance name of m_lvs
listview ListView variable containing the ListView that opened this
instance of m_lvs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage U_lvs calls this function to establish a relationship with m_lvs.
66
Chapter 3 Menus
67
m_master
m_master
Description Master menu for all PFC applications. Use this menu as the ancestor for your
application’s menus.
Ancestry
Library PFCWNSRV.PBL
PFEWNSRV.PBL
File menu
Menu items
Menu item Description
New Calls the pfc_New event for the current window or window control
Open Calls the pfc_Open event for the current window or window control
Close Calls the pfc_Close event for the current window or window control
Save Calls the pfc_Save event for the current window or window control
Save As Calls the pfc_SaveAs event for the current window or window
control
Print Calls the pfc_Print event for the current window or window control
Print Preview Calls the pfc_PrintPreview event for the current window or window
control
Page Setup Calls the pfc_PageSetup event for the current window or window
control
68
Chapter 3 Menus
Edit menu
Menu items
Menu item Description
Undo Calls the pfc_Undo event for the current window or window control
Cut Calls the pfc_Cut event for the current window or window control
Copy Calls the pfc_Copy event for the current window or window control
Paste Calls the pfc_Paste event for the current window or window control
Paste Special Calls the pfc_PasteSpecial event for the current window or window
control
Clear Calls the pfc_Clear event for the current window or window control
Select All Calls the pfc_SelectAll event for the current window or window
control
Find Calls the pfc_FindDlg event for the current window or window
control
Replace Calls the pfc_ReplaceDlg event for the current window or window
control
Update Links Calls the pfc_UpdateLinks event for the current window or window
control
Object>Edit Calls the pfc_EditObject event for the current window or window
control
Object>Open Calls the pfc_OpenObject event for the current window or window
control
View menu
Menu items
Menu item Description
Ruler Calls the pfc_Ruler event for the current window or window control
69
m_master
Insert menu
Menu items
Menu
item Description
File Calls the pfc_InsertFile event for the current window or window
control
Picture Calls the pfc_InsertPicture event for the current window or window
control
Object Calls the pfc_InsertObject event for the current window or window
control
70
Chapter 3 Menus
Tools menu
Menu items
Menu item Description
Customize Calls the pfc_Toolbars event for the current window or window
Toolbars control
Window menu
Menu items
Menu item Description
Cascade Calls the pfc_Cascade event for the frame window
Tile Horizontal Calls the pfc_TileHorizontal event for the frame window
Tile Vertical Calls the pfc_TileVertical event for the frame window
Layer Calls the pfc_Layer event for the frame window
Minimize All Calls the pfc_MinimizeAll event for the frame window
Undo Arrange Calls the pfc_UndoArrange event for the frame window
Help menu
Menu items
Menu item Description
Help Topics Calls the pfc_Help event for the current window or window
control
About Calls the n_cst_appmanager of_About function
Functions
The m_master menu includes one precoded object function:
of_SendMessage
of_SendMessage
Description Calls the n_cst_menu of_SendMessage function, which sends the passed
message to the current window through the pfc_MessageRouter event.
71
m_master
Access Public
Syntax instancename.of_SendMessage ( message )
Argument Description
instancename Instance name of m_master
message String specifying the user event to be triggered by the
pfc_MessageRouter event
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage PFC menu items call this function to trigger events on the associated window
and window controls.
Examples This example is from the m_master File>Open menu item’s Clicked event.
SetPointer (hourglass!)
of_SendMessage("pfc_open")
72
Chapter 3 Menus
m_oc
Description Popup menu displayed when the user releases the right mouse button over an
OLE control based on u_oc.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object menu
Menu items
Menu item Description
Edit Calls the pfc_EditObject event for the OLE control
Open Calls the pfc_OpenObject event for the OLE control
Cut Calls the pfc_Cut event for the OLE control
Copy Calls the pfc_Copy event for the OLE control
Paste Calls the pfc_Paste event for the OLE control
Instance variables
M_oc includes one instance variable:
Instance
variable Description Data type Access Usage
ioc_parent OLE control displaying the OLEControl Protected Used to access the associated
popup menu. OLE control.
73
m_oc
Functions
M_oc includes one precoded object function:
of_SetParent
of_SetParent
Description Establishes the OLE control associated with an instance of the m_oc popup
menu.
Access Public
Syntax instancename.of_SetParent ( olecontrol )
Argument Description
instancename Instance name of m_oc
olecontrol OLEControl variable containing the OLE control that opened this
instance of m_oc
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage U_oc calls this function to establish a relationship with m_oc.
Examples This example calls the of_SetParent function:
m_oc lm_oc
String ls_selectedtext
...
lm_view = create m_oc
lm_view.of_SetParent(this)
...
74
Chapter 3 Menus
m_tvs
Description Popup menu displayed when the user releases the right mouse button over a
TreeView based on u_tvs.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
View menu
Menu items
Menu item Description
Open Calls the pfc_Open event
Find Calls the pfc_FindDlg event
Cut Calls the pfc_Cut event
Copy Calls the pfc_Copy event
Paste Calls the pfc_Paste event
Clear Calls the pfc_Clear event
New Calls the pfc_New event
Delete Calls the pfc_Delete event
Rename Calls the pfc_Rename event
Properties Calls the pfc_Properties event
Instance variables
M_tvs includes one instance variable:
75
m_tvs
Functions
M_tvs includes one precoded object function:
of_SetParent
of_SetParent
Description Establishes the TreeView control associated with an instance of the m_tvs
popup menu.
Access Public
Syntax instancename.of_SetParent ( listview )
Argument Description
instancename Instance name of m_tvs
listview TreeView variable containing the TreeView that opened this
instance of m_tvs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage U_tvs calls this function to establish a relationship with m_tvs.
Examples This example calls the of_SetParent function:
...
im_view = CREATE m_tvs
im_view.of_SetParent(this)
...
76
CH A PTE R 4 Global Functions
About this chapter This chapter describes the global functions in the PowerBuilder
Foundation Class Library (PFC).
77
f_SetFilesrv
f_SetFilesrv
Description Enables or disables the platform-specific file-handling service. The file service
is implemented through the n_cst_filesrv user object and its descendants.
This function creates a descendant of n_cst_filesrv:
• n_cst_filesrvwin32
Access Public
Syntax f_SetFilesrv ( fileservice, boolean )
Argument Description
fileservice N_cst_filesrv variable into which the function creates the
platform-specific n_cst_filesrv descendant
boolean Boolean specifying whether to create an instance of
n_cst_filesrv (TRUE) or destroy an instance of n_cst_filesrv
(FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to enable and disable the file service.
These objects contain functions that make external function calls to perform
operating system-specific file processing.
Examples This example enables the file service. It assumes an inv_filesrv instance
variable:
f_SetFileSrv(inv_filesrv, TRUE)
See also f_SetPlatform
n_cst_filesrv
n_cst_platform
78
Chapter 4 Global Functions
f_SetPlatform
Description Enables or disables platform-specific services. The platform service is
implemented through the n_cst_platform user object and its descendants.
This function creates a descendant of n_cst_platform:
• n_cst_platformwin32
Access Public
Syntax f_SetPlatform ( platformservice, boolean )
Argument Description
platformservice N_cst_platform variable into which the function creates the
platform-specific n_cst_platform descendant
boolean Boolean specifying whether to create an instance of
n_cst_platform (TRUE) or destroy an instance of n_cst_platform
(FALSE).
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to enable and disable the platform service.
These objects contain functions that make external function calls to return
operating system-specific information and play sounds.
Examples This example enables the platform service. It assumes an inv_platform instance
variable:
f_SetPlatform(inv_platform, TRUE)
See also f_SetFilesrv
n_cst_filesrv
n_cst_platform
79
f_SetPlatform
80
CH A PTE R 5 Global Structures and Structure
Objects
About this chapter This chapter describes the global structures and structure objects in the
PowerBuilder Foundation Class Library (PFC).
Structure objects are autoinstantiated custom class user objects that
consist solely of instance variables. These objects provide all the
functionality of global structures and they also allow you to extend them
by adding instance variables, events, and object functions.
Contents The global structures and structure objects are listed alphabetically.
81
n_cst_aboutattrib
n_cst_aboutattrib
Description Structure object containing information displayed in w_about.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
is_application String
is_copyright String
is_logo String
is_version String
82
Chapter 5 Global Structures and Structure Objects
n_cst_baseattrib
Description Ancestor of all structure objects. This object contains no properties. To define
a global property or function for structure objects, define it in this object.
Library PFCMAIN.PBL
PFEMAIN.PBL
Properties No properties
See also All other structure objects
83
n_cst_calculatorattrib
n_cst_calculatorattrib
Description Structure object containing information used by u_calculator.
Library PFCMAIN.PBL
PFEMAIN.PBL
Properties
Field Data type
ib_dropdown Boolean
84
Chapter 5 Global Structures and Structure Objects
n_cst_calendarattrib
Description Structure object containing information used by u_calendar.
Library PFCMAIN.PBL
PFEMAIN.PBL
Properties
Field Data type
ib_dropdown Boolean
85
n_cst_columnattrib
n_cst_columnattrib
Description Structure object containing column information.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
is_colformat String
is_coltype String
is_columns String
86
Chapter 5 Global Structures and Structure Objects
n_cst_dberrorattrib
Description Structure object containing database error information.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
idwb_buffer DWBuffer
il_row Long
il_sqldbcode Long
ipo_inerror PowerObject
is_errormsg String
is_sqlerrtext String
is_sqlsyntax String
87
n_cst_dirattrib
n_cst_dirattrib
Description Structure object containing information used in n_cst_filesrv and its
descendants.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ib_archive Boolean
ib_drive Boolean
ib_hidden Boolean
ib_readonly Boolean
ib_subdirectory Boolean
ib_system Boolean
id_creationdate Date
id_lastaccessdate Date
id_lastwritedate Date
idb_filesize Date
is_altfilename String
is_filename String
it_creationtime Time
it_lastwritetime Time
88
Chapter 5 Global Structures and Structure Objects
n_cst_dssrv_multitableattrib
Description Structure object containing information used to control multitable updates.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
b_keyupdateinplace Boolean
i_whereoption Integer
s_keycolumns[ ] String
s_updatecolumns[ ] String
s_updatetable String
89
n_cst_dwcacheattrib
n_cst_dwcacheattrib
Description Structure object containing information about cached data.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
a_args[] Any
ds_originalcontrol DataStore
dw_originalcontrol DataWindow
ds_obj N_ds
tr_obj N_tr
po_originaldata[] PowerObject
s_id String
s_filename String
s_method String
s_originaldataobject String
90
Chapter 5 Global Structures and Structure Objects
n_cst_dwobjectattrib
Description Structure object containing information used in n_cst_dwcache, n_cst_dssrv,
n_cst_dwsrv, and its descendants.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
is_column String
is_datatype String
is_value String
91
n_cst_dwpropertyattrib
n_cst_dwpropertyattrib
Description Structure object containing DataWindow property information.
Library PFCUTIL.PBL
PFEUTIL.PBL
Properties
Field Data type
idw_requestor DataWindow
is_dataobjectbuffer String
is_dataobjectstatus String
is_objectname String
is_tabpages String
iw_mail Window
92
Chapter 5 Global Structures and Structure Objects
n_cst_dwsrv_dropdownsearchattrib
Description Structure object containing column and text information for dropdown
DataWindows.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
dwc_object DataWindowChild
s_columnname String
s_editstyle String
93
n_cst_dwsrv_multitableattrib
n_cst_dwsrv_multitableattrib
Description Structure object containing information used to control multitable updates.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
b_keyupdateinplace Boolean
i_whereoption Integer
s_keycolumns[ ] String
s_updatecolumns[ ] String
s_updatetable String
94
Chapter 5 Global Structures and Structure Objects
n_cst_dwsrv_querymodeattrib
Description Structure object storing querymode information for DataWindow columns.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
b_state Boolean
s_col String
s_protect String
95
n_cst_dwsrv_resizeattrib
n_cst_dwsrv_resizeattrib
Description Structure object containing information about registered columns and text
objects.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
b_scale Boolean
b_movex Boolean
b_movey Boolean
b_scalewidth Boolean
b_scaleheight Boolean
i_movex Integer
i_movex Integer
i_scalewidth Integer
i_scaleheight Integer
r_x Real
r_y Real
r_width Real
r_height Real
s_control String
s_typeof String
96
Chapter 5 Global Structures and Structure Objects
n_cst_errorattrib
Description Structure object containing information used in n_cst_error and w_message.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ib_print Boolean
ib_userinput Boolean
idt_date Datetime
ie_buttonstyle Button
ie_icon Icon
ii_buttonclicked Integer
ii_default Integer
ii_rc Integer
ii_severity Integer
ii_timeout Integer
is_text String
is_title String
is_user String
is_usertext String
97
n_cst_filterattrib
n_cst_filterattrib
Description Structure object containing information used in n_cst_dwsrv_filter and Filter
dialog boxes.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
idw_dw u_dw
is_colnamedisplay[ ] String
is_columns[ ] String
is_dbnames[ ] String
is_filter String
98
Chapter 5 Global Structures and Structure Objects
n_cst_findattrib
Description Structure object containing information used in n_cst_dwsrv_find, u_rte,
w_find, and w_replace.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ib_directionenabled Boolean
ib_directionvisible Boolean
ib_lookenabled Boolean
ib_lookvisible Boolean
ib_matchcase Boolean
ib_matchcaseenabled Boolean
ib_matchcasevisible Boolean
ib_wholeword Boolean
ib_wholewordenabled Boolean
ib_wholewordvisible Boolean
ii_lookindex Integer
ipo_requestor PowerObject
is_direction String
is_find String
is_lookdata[] String
is_lookdisplay[] String
is_replacewith String
99
n_cst_infoattrib
n_cst_infoattrib
Description Structure object containing information displayed by the DataWindow
Properties dialog box.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
is_description String
is_name String
100
Chapter 5 Global Structures and Structure Objects
n_cst_itemattrib
Description Structure object containing information used in u_lb, u_plb, and u_tv.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ii_index Integer
is_itemtext String
101
n_cst_linkageattrib
n_cst_linkageattrib
Description Structure object containing information used in n_cst_dwsrv_linkage.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
is_detailcolarg[ ] String
is_mastercolarg[ ] String
102
Chapter 5 Global Structures and Structure Objects
n_cst_logonattrib
Description Structure object containing information used in n_cst_appmanager.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ii_rc Integer
ipo_source PowerObject
is_appname String
is_logo String
is_password String
is_userid String
103
n_cst_lvsrvattrib
n_cst_lvsrvattrib
Description Structure object containing information used by ListView services.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ids_source n_ds
itr_obj n_tr
is_dataobject String
is_keycolumns[ ] String
is_labelcolumn String
is_method String
is_overlaycolumn String
is_picturecolumn String
is_statecolumn String
is_xposcolumn String
is_yposcolumn String
104
Chapter 5 Global Structures and Structure Objects
n_cst_mruattrib
Description Structure object containing information used by n_cst_mru.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ii_itemcount Integer
is_classname String
is_id String
is_menuitemkey String
is_menuitemmhelp String
is_menuitemname String
105
n_cst_propertyattrib
n_cst_propertyattrib
Description Structure object containing information used by the DataWindow Properties
dialog box.
Library PFCUTIL.PBL
PFEUTIL.PBL
Properties
Field Data type
ib_switchbuttons Boolean
is_description String
is_name String
is_propertypage[ ] String
is_propertytabtext String
106
Chapter 5 Global Structures and Structure Objects
n_cst_resizeattrib
Description Structure object containing information for tracking objects eligible for
resizing.
Library PFCWNSRV.PBL
PFEWNSRV.PBL
Properties
Field Data type
b_scale Boolean
b_movex Boolean
b_movey Boolean
b_scalewidth Boolean
b_scaleheight Boolean
wo_control GraphicObject
i_movex Integer
i_movex Integer
i_scalewidth Integer
i_scaleheight Integer
i_widthmin Integer
i_heightmin Integer
r_x Real
r_y Real
r_width Real
r_height Real
s_classname String
s_typeof String
107
n_cst_restorerowattrib
n_cst_restorerowattrib
Description Structure object containing information used by n_cst_dwsrv_rowmanager
when restoring deleted rows.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
idw_active DataWindow
is_filter String
is_sort String
108
Chapter 5 Global Structures and Structure Objects
n_cst_returnattrib
Description Structure object containing return code and associated text.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ii_rc Integer
is_rs String
109
n_cst_selectionattrib
n_cst_selectionattrib
Description Structure object containing information used in n_cst_selection and
w_selection.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ia_argument[20] Any
ia_returnval[ ] Any
ipo_data[ ] PowerObject
is_columnreturn[ ] String
is_dataobject String
is_title String
itr_object n_tr
110
Chapter 5 Global Structures and Structure Objects
n_cst_sortattrib
Description Structure object containing information used in n_cst_dwsrv_sort and the Sort
dialog boxes.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
ib_usedisplay[ ] Boolean
is_colnamedisplay[ ] String
is_origcolumns[ ] String
is_origorder[ ] String
is_sort String
is_sortcolumns[ ] String
111
n_cst_splashattrib
n_cst_splashattrib
Description Structure object containing information used in n_cst_appmanager and
w_splash.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ii_secondsvisible Integer
is_application String
is_copyright String
is_logo String
is_version String
112
Chapter 5 Global Structures and Structure Objects
n_cst_sqlattrib
Description Structure object containing information used in n_cst_sql.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
s_columns String
s_group String
s_having String
s_order String
s_tables String
s_values String
s_verb String
s_where String
113
n_cst_textstyleattrib
n_cst_textstyleattrib
Description Structure object used by u_rte-based RichTextEdit controls to access text style
information.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ib_bold Boolean
ib_italic Boolean
ib_strikeout Boolean
ib_subscript Boolean
ib_superscript Boolean
ib_underlined Boolean
114
Chapter 5 Global Structures and Structure Objects
n_cst_tmgregisterattrib
Description Structure object containing information used by n_cst_tmgmultiple.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ii_notifystyle Integer
il_notifyinterval Long
ipo_notify PowerObject
is_notifyevent String
115
n_cst_toolbarattrib
n_cst_toolbarattrib
Description Structure object containing information used in w_frame and w_toolbars.
Library PFCWNSRV.PBL
PFEWNSRV.PBL
Properties
Field Data type
b_visible Boolean
ib_largebuttonsenabled Boolean
ib_positionenabled Boolean
ib_tooltipsenabled Boolean
ib_visibleenabled Boolean
i_barindex Integer
s_displayname String
s_title String
e_alignment ToolbarAlignment
iw_owner Window
116
Chapter 5 Global Structures and Structure Objects
n_cst_trregistration
Description Structure object for tracking the Transaction object.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
b_used Boolean
tr_object n_tr
117
n_cst_tvattrib
n_cst_tvattrib
Description Structure object containing information used by tree views.
Library PFCMAIN.PBL
PFEMAIN.PBL
Properties
Field Data type
b_recursive Boolean
i_pictureindex Integer
i_selectedpictureindex Integer
i_statepictureindex Integer
i_overlaypictureindex Integer
ds_obj n_ds
tr_obj n_tr
s_datawindow String
s_labelcolumn String
s_retrieveargs String
s_pictureindexcol String
s_selectedpictureindexcol String
s_statepictureindexcol String
s_overlaypictureindexcol String
118
Chapter 5 Global Structures and Structure Objects
n_cst_tvsrvattrib
Description Structure object containing information used by n_cst_tvsrv_levelsource.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
ib_recursive Boolean
ii_deletestyle Integer
ids_obj n_ds
itr_obj n_tr
is_dataobject String
is_filtercols String
is_keycolumns String
is_labelcolumn String
is_method String
is_overlaycolumn String
is_picturecolumn String
is_retrieveargs String
is_selectedcolumn String
is_statecolumn String
119
n_cst_winsrv_sheetmanagerattrib
n_cst_winsrv_sheetmanagerattrib
Description Structure object containing information on the previous state of active sheets.
Library PFCWNSRV.PBL
PFEWNSRV.PBL
Properties
Field Data type
w_obj Window
e_state Windowstate
i_width Integer
i_height Integer
i_x Integer
i_y Integer
120
Chapter 5 Global Structures and Structure Objects
n_cst_winsrv_statusbarattrib
Description Structure object containing information on status bar items.
Library PFCWNSRV.PBL
PFEWNSRV.PBL
Properties
Field Data type
s_id String
s_type String
s_value String
i_width Integer
i_bordertype Integer
i_gapwidth Integer
121
n_cst_zoomattrib
n_cst_zoomattrib
Description Structure object containing information used in n_cst_dwsrv_printpreview and
w_zoom.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
idw_obj DataWindow
ii_zoom Integer
122
Chapter 5 Global Structures and Structure Objects
s_pagesetupattrib
Description Global structure containing information used in n_cst_platform and
w_pagesetup.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
b_disablemargins Boolean
b_disableorientation Boolean
b_disablepaper Boolean
i_minmarginleft Integer
i_minmarginright Integer
i_minmargintop Integer
i_minmarginbottom Integer
i_marginleft Integer
i_marginright Integer
i_margintop Integer
i_marginbottom Integer
i_papersize Integer
i_papersource Integer
b_portraitorientation Boolean
str_papersize[ ] s_paperattrib
str_papersource[ ] s_paperattrib
i_units Integer
b_actiontaken Boolean
123
s_paperattrib
s_paperattrib
Description Global structure containing information used in s_pagestupattrib.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
i_val Integer
s_type String
124
Chapter 5 Global Structures and Structure Objects
s_printdlgattrib
Description Structure object containing information used by n_cst_platform for printing.
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Properties
Field Data type
b_allpages Boolean
b_pagenums Boolean
b_selection Boolean
b_disablepagenums Boolean
b_disableselection Boolean
b_collate Boolean
l_copies Long
b_printtofile Boolean
b_disableprinttofile Boolean
b_hideprinttofile Boolean
l_frompage Long
l_topage Long
l_minpage Long
l_maxpage Long
125
s_svalue
s_svalue
Description Global structure containing information used in n_cst_dwsrv_querymode.
Library PFCDWSRV.PBL
PFEDWSRV.PBL
Properties
Field Data type
s_value String
126
CH A PTE R 6 Standard Visual User Objects
About this chapter This chapter describes the standard visual user objects in PFC.
Contents The standard visual user objects are listed in alphabetical order. Each
object’s discussion includes an alphabetical listing of instance variables,
events, and object functions.
127
u_cb
u_cb
Description Command button visual user object.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
CommandButton. U_cb event scripts provide integration with PFC menus.
See also m_master
w_master
Events
U_cb includes a precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent window.
Functions
U_cb includes precoded object functions:
of_GetParentWindow
of_MessageBox
128
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_cb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_cb GetFocus event calls this function.
Examples This example is from the u_cb GetFocus event:
Window lw_parent
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_cb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
129
u_cb
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in CommandButtons.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’cb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
130
Chapter 6 Standard Visual User Objects
u_cbx
Description CheckBox visual user object.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
CheckBox. U_cbx event scripts provide integration with PFC menus.
See also m_master
w_master
Events
U_cbx includes a precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_cbx includes precoded object functions:
of_GetParentWindow
of_MessageBox
131
u_cbx
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_cbx
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_cbx GetFocus event calls this function.
Examples This example is from the u_cbx GetFocus event:
Window lw_parent
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_cbx
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
132
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in CheckBoxes.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’cbx_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
133
u_ddlb
u_ddlb
Description DropDownListBox visual user object ancestor. This object provides:
• Integration with PFC menus for the cut, copy, paste, clear, and select all
Edit menu choices
• A function to display a popup Edit menu when the user points at the
DropDownListBox and right-clicks
• An event you can use to scroll to the matching letters in the list as the user
types
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
DropDownListBox. U_ddlb event scripts provide integration with PFC menus.
Additionally, u_ddlb supports:
• Cut, copy, paste, clear, and select all These are triggered
automatically by the message router.
• Popup menu support The ContextMenu event enables you to use the
right mouse button to perform editing actions. To disable right mouse
button support, set ib_rmbmenu to FALSE in the dropdown listbox’s
Constructor event.
• Autoselect This means that text is selected when a user tabs to the
dropdown listbox. To disable autoselect, set ib_autoselect to FALSE in the
dropdown listbox’s Constructor event.
134
Chapter 6 Standard Visual User Objects
Instance variables
U_ddlb includes instance variables:
Instance
variable Description Data type Access Usage
ib_autoselect Indicates whether PFC selects text Boolean Protected Set this to TRUE to
automatically when the control enable autoselect
receives focus (default is FALSE)
ib_rmbmenu Indicates whether the m_edit menu Boolean Protected Set this to FALSE to
displays when the user presses the disable right mouse
right mouse button button support
(default is TRUE)
ib_search Controls whether PFC automatically Boolean Protected Set this to TRUE to
scrolls to matching entries as the user enable autoscroll
types (default is FALSE)
Events
U_ddlb includes precoded event scripts:
CbnEditChange pfc_Cut
ContextMenu pfc_Paste
GetFocus pfc_PreRmbMenu
pfc_Clear pfc_SelectAll
pfc_Copy RButtonUp
CbnEditChange
Description Scrolls the DropDownListBox, based on the typed characters. For example, if
you press r, the event scrolls to the first entry beginning with r; if you then press
i, the event scrolls to the first entry beginning with ri.
135
u_ddlb
ContextMenu
Description Displays the m_edit popup menu.
Usage This event executes when the user releases the right mouse button over a
control based on u_ddlb.
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_Clear
Description Deletes selected text.
Return value Integer. Returns the number of characters deleted if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a DropDownListBox based on
u_ddlb has focus and the user selects Edit>Clear.
pfc_Copy
Description Copies selected text to the clipboard.
Return value Integer. Returns the number of characters copied if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a DropDownListBox based on
u_ddlb has focus and the user selects Edit>Copy.
This event is also called by the m_edit popup menu.
136
Chapter 6 Standard Visual User Objects
pfc_Cut
Description Deletes selected text and stores it on the clipboard.
Return value Integer. Returns the number of characters removed if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a DropDownListBox based on
u_ddlb has focus and the user selects Edit>Cut.
This event is also called by the m_edit popup menu.
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns the number of characters that were pasted if the event succeeds
and -1 if an error occurs.
Usage The message router calls this event when a DropDownListBox based on
u_ddlb has focus and the user selects Edit>Paste.
This event is also called by the m_edit popup menu.
pfc_PreRmbMenu
Description User event allowing you to modify m_edit contents before display.
Syntax instancename.Event pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_ddlb
editmenu M_edit variable containing the popup menu to be displayed
(passed by reference)
pfc_SelectAll
Description Selects all text in the DropDownListBox.
Return value Integer. Returns the number of characters selected if the event succeeds and -1
if an error occurs.
137
u_ddlb
Usage The message router calls this event when a DropDownListBox based on
u_ddlb has focus and the user selects Edit>Select All.
This event is also called by the m_edit popup menu.
RButtonUp
Description Empty user event. PFC code previously assigned to this event is now in the
ContextMenu event.
Usage This event executes when the user releases the right mouse button over a
control based on u_ddlb.
Functions
U_ddlb includes precoded object functions:
of_GetParentWindow
of_MessageBox
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_ddlb
window Window variable into which the function places a reference to
the parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_ddlb GetFocus event calls this function.
Examples This example is from the u_ddlb GetFocus event:
Window lw_parent
138
Chapter 6 Standard Visual User Objects
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_ddlb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in
DropDownListBoxes.
139
u_ddlb
140
Chapter 6 Standard Visual User Objects
u_ddplb
Description DropDownPictureListBox user object ancestor. This object provides:
• Integration with PFC menus for the cut, copy, paste, clear, and select all
Edit menu choices
• A function to display a popup Edit menu when the user points at the
DropDownPictureListBox and right-clicks
• An event you can use to scroll to the matching letters in the list as the user
types
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
DropDownPictureListBox. U_ddplb event scripts provide integration with
PFC menus. Additionally, u_ddplb supports:
• Cut, copy, paste, clear, and select all These are triggered
automatically by the message router.
• Popup menu support The ContextMenu event enables you to use the
right mouse button to perform editing actions. To disable right mouse
button support, set ib_rmbmenu to FALSE in the dropdown
picturelistbox’s Constructor event.
• Autoselect This means that text is selected when a user tabs to the
dropdown picturelistbox. To disable autoselect, set ib_autoselect to
FALSE in the dropdown picturelistbox’s Constructor event.
141
u_ddplb
Instance variables
U_ddplb includes instance variables:
Instance
variable Description Data type Access Usage
ib_autoselect Indicates whether PFC selects Boolean Protected Set this to TRUE to
text automatically when the enable autoselect (default
control receives focus is FALSE)
ib_rmbmenu Controls whether the m_edit Boolean Protected Set this to FALSE to
menu displays when the user disable right mouse
presses the right mouse button button support (default is
TRUE)
ib_search Controls whether PFC Boolean Protected Set this to TRUE to
automatically scrolls to matching enable autoscroll (default
entries as the user types is FALSE)
Events
U_ddplb includes precoded event scripts:
CbnEditChange pfc_Cut
ContextMenu pfc_Paste
GetFocus pfc_PreRmbMenu
pfc_Clear pfc_SelectAll
pfc_Copy RButtonUp
CbnEditChange
Description Scrolls the DropDownPictureListBox, based on the typed characters. For
example, if you press r, the event scrolls to the first entry beginning with r; if
you then press i, the event scrolls to the first entry beginning with ri.
This event maps to the pbm_cbneditchange event.
142
Chapter 6 Standard Visual User Objects
ContextMenu
Description Displays the m_edit popup menu.
Usage This event executes when the user releases the right mouse button over a
control based on u_ddplb.
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_Clear
Description Deletes selected text.
Return value Integer. Returns the number of characters deleted if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a DropDownPictureListBox based on
u_ddplb has focus and the user selects Edit>Clear.
pfc_Copy
Description Copies selected text to the clipboard.
Return value Integer. Returns the number of characters copied if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a DropDownPictureListBox based on
u_ddplb has focus and the user selects Edit>Copy.
This event is also called by the m_edit popup menu.
143
u_ddplb
pfc_Cut
Description Deletes selected text and stores it on the clipboard.
Return value Integer. Returns the number of characters removed if the event succeeds and -
1 if an error occurs.
Usage The message router calls this event when a DropDownPictureListBox based on
u_ddplb has focus and the user selects Edit>Cut.
This event is also called by the m_edit popup menu.
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns the number of characters that were pasted if the event succeeds
and -1 if an error occurs.
Usage The message router calls this event when a DropDownPictureListBox based on
u_ddplb has focus and the user selects Edit>Paste.
This event is also called by the m_edit popup menu.
pfc_PreRmbMenu
Description User event allowing you to modify m_edit contents before display.
Syntax instancename.Event pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_ddplb
editmenu M_edit variable containing the popup menu to be displayed
(passed by reference)
pfc_SelectAll
Description Selects all text in the DropDownPictureListBox.
Return value Integer. Returns the number of characters selected if the event succeeds and -1
if an error occurs.
144
Chapter 6 Standard Visual User Objects
Usage The message router calls this event when a DropDownPictureListBox based on
u_ddplb has focus and the user selects Edit>Select All.
This event is also called by the m_edit popup menu.
RButtonUp
Description Empty user event. PFC code previously assigned to this event is now in the
ContextMenu event.
Usage This event executes when the user releases the right mouse button over a
control based on u_ddplb.
Functions
U_ddplb includes precoded object functions:
of_GetParentWindow
of_MessageBox
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_ddplb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_ddplb GetFocus event calls this function.
Examples This example is from the u_ddplb GetFocus event:
Window lw_parent
145
u_ddplb
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_ddplb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in
DropDownPictureListBoxes.
146
Chapter 6 Standard Visual User Objects
147
u_dw
u_dw
Description Ancestor for all DataWindow controls in applications written using PFC. This
DataWindow user object includes:
• Functions to enable and disable DataWindow services
• Events that automatically make use of enabled DataWindow services
• Precoded user events that provide basic editing functionality
• Template user events to which you can add application-specific
functionality
U_dw is a self-updating object.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships m_dw
n_cst_conversion
n_cst_dwpropertyattrib
148
Chapter 6 Standard Visual User Objects
n_cst_findattrib
n_cst_platform
n_cst_restorerowattrib
n_cst_string
s_pagesetupattrib
s_printdlgattrib
Although u_dw contains substantial standalone functionality, the DataWindow
services user objects (those objects whose name starts with n_cst_dwsrv) must
be available to get the most out of it.
Usage To use u_dw:
1 Place a u_dw user object in your window.
2 In the window Open event (or some other appropriate place), enable
DataWindow services as needed by your application.
3 Extend basic u_dw functionality by adding PowerScript code to events
and user events.
4 Add application-specific functionality as needed.
See also n_cst_dwsrv
n_cst_dwsrv_dropdownsearch
n_cst_dwsrv_filter
n_cst_dwsrv_find
n_cst_dwsrv_linkage
n_cst_dwsrv_multitable
n_cst_dwsrv_printpreview
n_cst_dwsrv_property
n_cst_dwsrv_querymode
n_cst_dwsrv_report
n_cst_dwsrv_reqcolumn
n_cst_dwsrv_resize
n_cst_dwsrv_rowmanager
n_cst_dwsrv_rowselection
n_cst_dwsrv_sort
u_calculator
u_calendar
Instance variables
U_dw contains instance variables and one shared variable:
149
u_dw
150
Chapter 6 Standard Visual User Objects
151
u_dw
Events
U_dw contains two types of events/user events:
• Precoded events and user events that PFC uses to provide functionality
• Template user events to which you optionally add PowerScript code to
take advantage of DataWindow services
Clicked pfc_PrePrintDlg
DBError pfc_PreProperties
Destructor pfc_PreReplaceDlg
Dropdown pfc_PreRestoreRow
GetFocus pfc_PreRmbMenu
ItemChanged pfc_PreUpdate
ItemError pfc_PreviousPage
ItemFocusChanged pfc_Print
LButtonDown pfc_PrintDlg
152
Chapter 6 Standard Visual User Objects
LButtonUp pfc_PrintImmediate
pfc_AcceptText pfc_PrintPreview
pfc_AddRow pfc_Properties
pfc_Clear pfc_ReplaceDlg
pfc_Copy pfc_ResetUpdate
pfc_Cut pfc_RestoreRow
pfc_DDCalculator pfc_Retrieve
pfc_DDCalendar pfc_RetrieveDDDW
pfc_Debug pfc_RowChanged
pfc_DeleteRow pfc_RowValidation
pfc_Descendant pfc_Ruler
pfc_FilterDlg pfc_SelectAll
pfc_FindDlg pfc_SortDlg
pfc_FirstPage pfc_Undo
pfc_InsertRow pfc_Update
pfc_LastPage pfc_UpdatePrep
pfc_NextPage pfc_UpdatesPending
pfc_Operators pfc_Validation
pfc_PageSetup pfc_Values
pfc_PageSetupDlg pfc_Zoom
pfc_Paste RButtonDown
pfc_PopulateDDDW RButtonUp
pfc_PostInsertRow Resize
pfc_PostUpdate RetrieveEnd
pfc_PreDeleteRow RetrieveStart
pfc_PreFindDlg RowFocusChanged
pfc_PreInsertRow SQLPreview
pfc_PrePageSetupDlg
Clicked
Description Notifies DataWindow selection service, linkage service, and sort service
functions, if enabled.
Usage This event executes when the user clicks in the DataWindow. The functions
called in the Clicked event automatically handle row selection and sorting, if
enabled.
For the selection service, you may need to add logic in other places to access
selected rows and perform application specific processing.
153
u_dw
DBError
Description Displays a message box informing the user that a database error occurred.
Usage This event is called when there is a database error.
Destructor
Description Destroys all existing DataWindow service objects.
Usage This event executes when the DataWindow closes.
Dropdown
Description Indicates whether the current dropdown object is associated with u_calculator
or u_calendar.
Usage This event executes when a DropDownListBox or DropDownDataWindow
begins the dropdown process.
GetFocus
Description Notifies the parent window so it can track the current control.
Usage This event executes when the DataWindow control gets focus. It triggers the
pfc_ControlGotFocus event in the parent.
ItemChanged
Description Notifies the linkage service that an item has changed.
Usage This event executes when a field in the DataWindow control has been modified
and loses focus.
ItemError
Description When an error occurs, calls the required column service, if enabled, to set the
ActionCode to 3, causing the DataWindow to accept the value.
Usage Use this event to add application-specific error-handling functionality.
154
Chapter 6 Standard Visual User Objects
ItemFocusChanged
Description Notifies the linkage service that item focus has changed, Also, if MicroHelp is
enabled for the application, this event calls the pfc_Microhelp event on the
parent.
Usage This event executes when the user moves to a different item within a
DataWindow. It displays MicroHelp using text defined in the DataWindow
column’s tag value. The column’s tag value must specify
MICROHELP=microhelptext.
You enable MicroHelp display through the n_cst_appmanager
of_SetMicrohelp function.
If you are using the dropdown DataWindow search service
(n_cst_dwsrv_dropdownsearch), add code to this event that calls the
n_cst_dwsrv_dropdownsearch pfc_ItemFocusChanged event.
Examples This example shows the code you add to call the n_cst_dropdownsearch
pfc_ItemFocusChanged event:
inv_dropdownsearch.Event pfc_ItemFocusChanged &
(row, dwo)
LButtonDown
Description Calls the row selection service’s pfc_LButtonDown event.
Usage This event executes when the user presses the left mouse button over a
DataWindow.
LButtonUp
Description Calls the row selection service’s pfc_LButtonUp event.
Usage This event executes when the user releases the left mouse button over a
DataWindow.
pfc_AcceptText
Description Accepts text for the DataWindow control, optionally setting focus if an error
occurs.
Syntax instancename.Event pfc_AcceptText ( focusonerror )
Argument Description
instancename Instance name of u_dw
155
u_dw
Argument Description
focusonerror Boolean indicating whether focus should be set if an error occurs.
This argument is accessed through the ab_focusonerror argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the w_master event, as part of its default save process.
pfc_AddRow
Description Calls the row manager service to add a row at the end of the DataWindow. Also
notifies the linkage service, if enabled.
Return value Long. Returns the number of the new row if the event succeeds and -1 if an
error occurs.
Usage This event also calls the pfc_PreInsertRow and pfcPostInsertRow events.
pfc_Clear
Description Deletes selected text.
Return value Integer. Returns the number of characters deleted if the event succeeds and -1
if an error occurs.
Usage This event is triggered when the DataWindow has focus and the user selects
Edit>Clear from the menu bar of a menu descended from the PFC m_master
menu.
pfc_Copy
Description Copies selected text to the clipboard.
Return value Integer. Returns the number of characters copied if the event succeeds and -1
if an error occurs.
Usage This event is triggered when the DataWindow has focus and the user selects
Edit>Copy from the menu bar of a menu descended from the PFC m_master
menu. It is also triggered by the m_edit.m_copy clicked event.
pfc_Cut
Description Deletes selected text and stored it on the clipboard.
Return value Integer. Returns the number of characters removed if the event succeeds and -1
if an error occurs.
156
Chapter 6 Standard Visual User Objects
Usage This event is triggered when the DataWindow has focus and the user selects
Edit>Cut from the menu bar of a menu descended from the PFC m_master
menu. It is also triggered by the m_edit.m_cut clicked event.
pfc_DDCalculator
Description Displays the dropdown calculator if the current column has been registered and
uses a numeric data type.
Return value Integer. Returns 1 if the function succeeds, 0 if the current DataWindow
column has not been registered, and -1 if an error occurs.
Usage Call this event to display the dropdown calculator programmatically. If the
current DataWindow column has been registered and uses a numeric data type,
the dropdown calculator displays.
The Dropdown event displays the dropdown calculator automatically for
registered columns.
Examples This example calls the pfc_DDCalculator event:
Integer li_return
pfc_DDCalendar
Description Displays the dropdown calendar if the current column has been registered and
uses a Date data type.
Return value Integer. Returns 1 if the function succeeds, 0 if the current DataWindow
column has not been registered, and -1 if an error occurs.
Usage Call this event to display the dropdown calendar programmatically. If the
current DataWindow column has been registered and uses a Date data type, the
dropdown calendar displays.
The Dropdown event displays the dropdown calendar automatically for
registered columns.
Examples This example calls the pfc_DDCalendar event:
Integer li_return
157
u_dw
pfc_Debug
Description Calls the pfc_Properties event, which opens the DataWindow Properties
window, using either the inv_properties instance variable or the snv_properties
shared variable.
Usage This event is called when the user selects DataWindow Properties from the
m_dw popup menu.
pfc_DeleteRow
Description Deletes either the current row or, if the row manager service is enabled, all
selected rows. If the linkage service is enabled, this event calls that service’s
pfc_DeleteRow event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Call this event to delete one or more rows.
pfc_Descendant
Description PFC events and functions may trigger this event to determine if the
DataWindow control is inherited from u_dw.
Return value Boolean. Always returns TRUE.
Usage Internal.
pfc_FilterDlg
Description Displays a filter dialog box by calling the n_cst_dwsrv_filter service’s
pfc_FilterDlg event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the user selects View>Filter from the menu bar of a
menu descended from the PFC m_master menu.
pfc_FindDlg
Description Displays a find dialog box by calling the n_cst_dwsrv_find service’s
pfc_FindDlg event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the user selects Edit>Find from the menu bar of a
menu descended from the PFC m_master menu.
158
Chapter 6 Standard Visual User Objects
pfc_FirstPage
Description Scrolls to the first page of the DataWindow.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Call this event to scroll the DataWindow to the first page.
pfc_InsertRow
Description Inserts a row just before the current row and calls the n_cst_dwsrv_linkage
pfc_InsertRow event. It calls the pfc_PostInsertRow event for post-insert
functionality.
Return value Integer. Returns the number of the inserted row if the event succeeds and -1 if
an error occurs.
Usage Call this event to insert a row.
pfc_LastPage
Description Scrolls to the last page of the DataWindow.
Return value Long. Returns the row number displayed at the top of the last page if the event
succeeds and -1 if an error occurs.
Usage Call this event to scroll the DataWindow to the last page.
pfc_NextPage
Description Scrolls to the next page of the DataWindow.
Return value Long. Returns the row number at the top of the page if the event succeeds and
-1 if an error occurs.
Usage Call this event to scroll the DataWindow to the next page.
pfc_Operators
Description Calls the n_cst_dwsrv_querymode pfc_Operators event, which displays a
w_selection dialog box containing operators.
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage This event is called by the m_dw popup menu.
159
u_dw
pfc_PageSetup
Description Calls the pfc_PageSetupDlg event to display the Page Setup dialog box.
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage This event is called when the user selects File>Page Setup from the menu bar
of a menu descended from the PFC m_master menu.
pfc_PageSetupDlg
Description Displays the Page Setup dialog box by calling the n_cst_platform
of_PageSetupDlg function, passing the DataWindow’s page display properties.
Syntax instancename.Event pfc_PageSetupDlg ( attributes )
Argument Description
instancename Instance name of u_dw
attributes S_pagesetupattrib variable into which the event places page setup
information. This argument is accessed through the astr_pagesetup
argument (passed by reference)
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage This event is called by the pfc_PageSetup event.
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns the number of characters that were pasted if the event succeeds
and -1 if an error occurs.
Usage This event is triggered when the DataWindow has focus and the user selects
Edit>Paste from the menu bar of a menu descended from the PFC m_master
menu. It is also triggered by the m_edit.m_paste Clicked event.
pfc_PopulateDDDW
Description Empty user event that you extend to populate the specified
DropDownDataWindow.
Syntax instancename.Event pfc_PopulateDDDW ( column, dddw )
160
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_dw
column String specifying the column containing the dropdown
DataWindow for which rows are retrieved. Access this value
through the as_colname argument
dddw DataWindowChild instance referencing the
DropDownDataWindow column. This argument is accessed
through the adwc_obj argument (passed by reference)
Return value Long. Returns the number of rows populated if the event succeeds and -1 if an
error occurs.
Usage The code you add to this event can populate the DropDownDataWindow in any
manner, including database retrieval, DataWindow caching, and retrieving
from a file.
Examples This example shows code you might add to the pfc_PopulateDDDW event:
IF adwc_obj.SetTransObject(SQLCA) = -1 THEN
Return -1
ELSE
Return adwc_obj.Retrieve()
END IF
pfc_PostInsertRow
Description Empty user event allowing you to perform post-insert processing.
Syntax instancename.Event pfc_PostInsertRow ( row )
Argument Description
instancename Instance name of u_dw
row Number of row added or inserted
Usage This event is posted from the pfc_AddRow and pfc_InsertRow events.
pfc_PostUpdate
Description Clears the DataWindow update flags.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage You can extend this event to code additional post-update processing.
Examples This example is from the of_PostUpdate function:
...
161
u_dw
If IsValid(inv_linkage) Then
li_rc = inv_linkage.of_PostUpdate()
Else
li_rc = this.Event pfc_postupdate()
End If
...
pfc_PreDeleteRow
Description Calls the n_cst_dwsrv_linkage pfc_PreDeleteRow event to allow for linkage
processing. This may include database updates as well as the prevention of
deletion processing.
Syntax instancename.Event pfc_PreDeleteRow ( )
Argument Description
instancename Instance name of u_dw
Return value Return 1 to continue deletion, 0 to prevent deletion, and -1 if an error occurs.
Usage You can extend this event to perform additional predelete processing.
pfc_PreFindDlg
Description Empty user event allowing you to modify the properties passed to the
pfc_FindDlg event.
Syntax instancename.Event pfc_PreFindDlg ( attributes )
Argument Description
instancename Instance name of u_dw
attributes N_cst_findattrib variable into which the event places additional
information. This argument is accessed through the anv_findattrib
argument (passed by reference)
Usage Use this event to modify or extend the information passed in the
n_cst_findattrib object.
pfc_PreInsertRow
Description Calls the n_cst_dwsrv_linkage pfc_PreInsertRow event to allow for linkage
processing. This may include prevention of insert processing.
Syntax instancename.Event pfc_PreInsertRow ( )
162
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_dw
Return value Return 1 to continue insertion, 0 to prevent insertion, and -1 if an error occurs.
Usage You can extend this event to perform additional preinsert processing.
pfc_PrePageSetupDlg
Description Empty user event allowing you to modify the properties passed to the
n_cst_platform of_PageSetupDlg function.
Syntax instancename.Event pfc_PrePageSetupDlg ( attributes )
Argument Description
instancename Instance name of u_dw
attributes S_pagesetupattrib variable into which the event places additional
page setup information. This argument is accessed through the
astr_pagesetup argument (passed by reference)
Usage This event is called by the pfc_PageSetupDlg event before calling the
n_cst_platform of_PageSetupDlg function.
You can use this event to modify or extend the information passed in the
s_pagesettupattrib structure.
Examples This example contains code you might add to the pfc_PrePageSetupDlg event:
// Sets page setup to portrait
astr_pagesetup.b_portraitorientation = TRUE
pfc_PrePrintDlg
Description Empty user event allowing you to modify the properties passed to the
n_cst_platform of_PrintDlg function.
Syntax instancename.Event pfc_PrePrintDlg ( attributes )
Argument Description
instancename Instance name of u_dw
attributes S_printdlgattrib variable into which the event places additional
printing information. This argument is accessed through the
astr_printdlg argument (passed by reference)
163
u_dw
pfc_PreProperties
Description Empty user event allowing you to modify the properties passed to the
DataWindow Properties dialog box.
Syntax instancename.Event pfc_PreProperties ( attributes )
Argument Description
instancename Instance name of u_dw
attributes N_cst_dwpropertyattrib variable into which the event places
additional information. This argument is accessed through the
anv_dwpropertyattrib argument (passed by reference)
Usage This event is called by the pfc_Debug event before calling the n_cst_property
of_OpenProperty function.
You can use this event to modify or extend the information passed in the
n_cst_propertyattrib object.
pfc_PreReplaceDlg
Description Empty user event allowing you to modify the properties passed to the
pfc_ReplaceDlg event.
Syntax instancename.Event pfc_PreReplaceDlg ( attributes )
Argument Description
instancename Instance name of u_dw
attributes N_cst_findattrib variable into which the event places additional
information. This argument is accessed through the anv_findattrib
argument (passed by reference)
Usage Use this event to modify or extend the information passed in the
n_cst_findattrib object.
164
Chapter 6 Standard Visual User Objects
pfc_PreRestoreRow
Description Prepares the w_restorerow dialog box for display.
Syntax instancename.Event pfc_PreRestoreRow ( attributes )
Argument Description
instancename Instance name of u_dw
attributes N_cst_restorerowattrib variable into which the event places
additional information. This argument is accessed through the
anv_restorerowattrib argument (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The n_cst_rowmanager of_UnDelete function calls this event before opening
the w_restorerow window. It adds filter and sort information to the
n_cst_restorerowattrib structure.
You can extend this event to modify the information passed to the
w_restorerow window.
Examples This example is from the n_cst_dwsrv_rowmanager of_UnDelete function:
n_cst_restorerowattrib lnv_restorerowattrib
lnv_restorerowattrib.idw_active = idw_requestor
idw_requestor.Event pfc_PreRestoreRow &
(lnv_restorerowattrib)
OpenWithParm(w_restorerow, lnv_restorerowattrib)
...
pfc_PreRmbMenu
Description Empty user event allowing you to modify m_dw contents before display.
Syntax instancename.Event pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_dw
editmenu M_dw variable containing the popup menu to be displayed. This
argument, which is accessed through the am_dw argument, is
passed by reference
Usage Optionally add logic to this event to selectively enable and disable m_edit
menu items.
Examples This example contains code you might add to the pfc_PreRmbMenu event:
// Always disable delete
165
u_dw
am_dw.m_table.m_delete.Enabled = FALSE
pfc_PreUpdate
Description Empty user event called by pfc_Update before updating rows.
Syntax instancename.Event pfc_PreUpdate ( )
Argument Description
instancename Instance name of u_dw
Return value Return 1 if the event succeeds and -1 to terminate update processing.
Usage Extend this event to add site-specific preupdate processing.
Examples This example contains code you might add to the pfc_PreUpdate event:
// Sets page setup to portrait
astr_pagesetup.b_portraitorientation = TRUE
pfc_PreviousPage
Description Scrolls to the previous page of the DataWindow.
Return value Long. Returns the row number at the top of the page if the event succeeds and
-1 if an error occurs.
Usage Call this event to scroll the DataWindow to the previous page.
pfc_Print
Description Calls the pfc_PrintDlg function and prints the DataWindow, as specified in the
Print dialog box.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is triggered when the DataWindow has focus and the user selects
File>Print from the menu bar of a menu descended from the PFC m_master
menu.
pfc_PrintDlg
Description Initializes the s_printdlgattrib structure with the DataWindow’s current
settings, displays the Print dialog box by calling the n_cst_platform
of_PrintDlg function, and resets the DataWindow’s settings, as specified by the
user.
166
Chapter 6 Standard Visual User Objects
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the pfc_Print event.
pfc_PrintImmediate
Description Prints the current DataWindow without displaying the Print dialog box.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the DataWindow has focus and the user selects
File>Print Immediate from the menu bar of a menu descended from the PFC
m_master menu.
pfc_PrintPreview
Description Toggles the DataWindow between preview and edit modes.
Return value Boolean. Returns TRUE if the DataWindow is placed in preview mode and
FALSE if the DataWindow is placed in edit mode.
Usage To use this event, you must enable the print preview service by calling the
of_SetPrintPreview function.
This event is called when the DataWindow has focus and the user selects
File>Print Preview from a menu that descends from the PFC m_master menu.
pfc_Properties
Description Displays the DataWindow properties window.
Return value None.
167
u_dw
Usage To use this event, you must enable the DataWindow property service by calling
either of_SetProperty or of_SetSharedProperty.
This event is called when the user selects Properties from the m_dw popup
menu.
pfc_ReplaceDlg
Description Displays a Replace dialog box by calling the n_cst_dwsrv_find service’s
pfc_ReplaceDlg event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the user selects View>Replace from the menu bar of
a menu descended from the PFC m_master menu.
pfc_ResetUpdate
Description Clears the DataWindow’s update flags.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called as part of the default pfc_Save process.
pfc_RestoreRow
Description Calls the row manager pfc_RestoreRow event, which displays the
w_restorerow dialog box.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the m_dw popup menu.
pfc_Retrieve
Description Empty user event to contain all database retrieve logic. PFC calls this event for
all database retrieves.
Return value Long. Returns the result of the Retrieve function.
Usage Add code to this event to retrieve rows for the DataWindow.
This event is called by the u_dw of_Retrieve function and by the
n_cst_dwsrv_linkage of_Retrieve function.
Examples This example shows the code you add to this event:
Return this.Retrieve()
168
Chapter 6 Standard Visual User Objects
pfc_RetrieveDDDW
Description Obsolete. Use pfc_PopulateDDDW instead.
Syntax instancename.Event pfc_RetrieveDDDW ( column )
Argument Description
instancename Instance name of u_dw
column String specifying the column containing the dropdown
DataWindow for which rows are retrieved. Access this value
through the as_column argument
pfc_RowChanged
Description Calls the linkage service’s pfc_RowFocusChanged function.
Usage This event is called whenever the DataWindow buffer has been sorted, filtered,
or otherwise modified such that the current row has not changed but the actual
row at that location is different.
pfc_RowValidation
Description Empty user event that you extend to perform site-specific row validation.
Syntax instancename.Event pfc_RowValidation ( row )
Argument Description
instancename Instance name of u_dw
row Long specifying the row to validate. Access this value through the
al_row argument
pfc_Ruler
Description Toggles the DataWindow between displaying and hiding rulers in print
preview mode.
Return value Boolean. Returns TRUE if print preview rulers are displayed and FALSE if
they are hidden.
169
u_dw
Usage To use this event, you must enable the print preview service by calling the
of_SetPrintPreview function.
This event is called when the DataWindow has focus and the user selects
View>Ruler from the menu bar of a menu descended from the PFC m_master
menu.
pfc_SelectAll
Description Selects all text in the current DataWindow cell.
Return value Integer. Returns the number of characters selected if the event succeeds and -1
if an error occurs.
Usage This event is triggered when the DataWindow has focus and the user selects
Edit>Select All from the menu bar of a menu descended from the PFC
m_master menu.
pfc_SortDlg
Description Displays a sort dialog box by calling the n_cst_dwsrv_sort service’s
pfc_SortDlg event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the user selects View>Sort from the menu bar of a
menu descended from the PFC m_master menu.
pfc_Undo
Description Cancels the last edit to the DataWindow.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs or there is
nothing to undo.
Usage This event is triggered when the DataWindow has focus and the user selects
Edit>Undo from the menu bar of a menu descended from the PFC m_master
menu.
pfc_Update
Description Updates the DataWindow. If the multitable update service is enabled, this event
updates all specified tables.
Syntax instancename.Event pfc_Update ( accepttext, resetflags )
170
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_dw
accepttext Boolean specifying whether the DataWindow control should
automatically perform an AcceptText before performing the update
(TRUE) or not (FALSE)
resetflags Boolean specifying whether the DataWindow control should
automatically reset the update flags (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage This event calls the pfc_PreUpdate event before updating rows.
pfc_UpdatePrep
Description Empty user event to which you can add code that prepares for update.
Return value Long. Return 1 if the update preparation succeeds and -1 to halt the update
process.
Usage The of_UpdatePrep function calls this function.
pfc_UpdatesPending
Description Determines if there are pending updates for the DataWindow.
Return value Integer. Returns 1 if there are pending updates for the DataWindow and 0 if
there are no pending updates.
Usage This event is called by the of_UpdatesPending function and by the
n_cst_dwsrv_linkage of_GetUpdatesPending function.
pfc_Validation
Description Checks for required fields.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the of_Validation function. You can extend this event to
perform additional validation.
pfc_Values
Description Calls the n_cst_dwsrv_querymode pfc_Values event, which displays a
w_selection dialog box containing a list of values.
171
u_dw
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage This event is called by the m_dw popup menu.
pfc_Zoom
Description Displays the w_zoom dialog box, allowing the user to control DataWindow
display while in print preview mode.
Return value Integer. Returns the zoom level chosen by the user if the event succeeds, 0 if
the user cancels out of the w_zoom dialog box, and -1 if an error occurs.
Usage To use this event, you must enable the print preview service by calling the
of_SetPrintPreview function.
This event is called when the DataWindow has focus and the user selects
View>Zoom from the menu bar of a menu descended from the PFC m_master
menu.
RButtonDown
Description Calls the linkage service and row selection service’s pfc_RButtonDown event.
Usage This event executes when the user presses the right mouse button over a
DataWindow. The n_cst_dwsrv_linkage pfc_RButtonDown event can cancel
right-click processing.
RButtonUp
Description Displays the m_dw popup menu.
Usage This event executes when the user releases the right mouse button over the
DataWindow control.
Resize
Description Calls the DataWindow resize service’s pfc_Resize event, if the service is
enabled.
Usage This event executes when the DataWindow control resizes, either because it is
itself resizable or because it is registered as resizable with the window resize
service.
172
Chapter 6 Standard Visual User Objects
RetrieveEnd
Description Calls the linkage service’s pfc_RetrieveEnd event, if the service is enabled.
Usage This event executes when a retrieval process completes.
RetrieveStart
Description Calls the linkage service’s pfc_RetrieveStart event, if the service is enabled.
Usage This event executes when a retrieval process begins.
RowFocusChanged
Description Used by the linkage service, if enabled, to coordinate scrolling among the
linkage chain.
Usage This event executes when the DataWindow first displays and again when the
user changes rows.
This event calls the n_cst_dwsrv_linkage pfc_RowFocusChanged event.
SQLPreview
Description Calls SQL Spy functions, if enabled for the application.
Usage This event executes just before accessing the database.
Functions
U_dw includes precoded object functions to control DataWindow services:
of_AcceptText of_SetMultiTable
of_CheckRequired of_SetPrintPreview
of_GetParentWindow of_SetProperty
of_GetUpdateable of_SetQuerymode
of_IsRoot of_SetReport
of_IsSharedProperty of_SetReqColumn
of_IsUpdateable of_SetResize
of_MessageBox of_SetRowManager
of_PostUpdate of_SetRowSelect
of_Reset of_SetSharedProperty
of_Retrieve of_SetSort
173
u_dw
of_SetBase of_SetTransObject
of_SetDropDownCalculator of_SetUpdateable
of_SetDropDownCalendar of_SetUpdateRequestor
of_SetDropDownSearch of_Update
of_SetFilter of_UpdatePrep
of_SetFind of_UpdatesPending
of_SetLinkage of_Validation
of_AcceptText
Description Performs an AcceptText function for the DataWindow.
Access Public
Syntax instancename.of_AcceptText ( focusonerror )
Argument Description
instancename Instance name of u_dw
focusonerror Boolean indicating whether PFC sets focus to the DataWindow
when an error occurs (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize accept text processing,
extend the pfc_AcceptText event.
Examples This example is from the n_cst_luw of_AcceptText function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_AcceptText &
(ab_focusonerror)
If li_rc < 0 Then Return -1
...
of_CheckRequired
Description Determines if any required columns contain NULL values.
Access Public
Syntax instancename.of_CheckRequired ( buffer, row, column, colname,
updateonly )
174
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_dw
buffer DWBuffer enumerated data type specifying the DataWindow buffer
to check
row Long specifying the first row to check and into which the function
places the number of the row in error (passed by reference)
column Integer specifying the first column to check and into which the
function places the number of the column in error (passed by
reference)
colname String specifying the first column to check and into which the
function places the name of the column in error (passed by
reference)
updateonly Boolean indicating whether to validate only those rows and
columns that have changed (TRUE) or validate all rows and
columns
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
Usage The u_dw pfc_Validation event calls this function.
Examples This example is from the u_dw pfc_Validation event:
...
li_rc = &
of_CheckRequired(Primary!, ll_checkrow, &
li_checkcolumn, ls_checkcolname, &
ib_updateonly)
...
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_dw
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
Usage The u_dw GetFocus event calls this function.
Examples This example is from the u_dw GetFocus event:
175
u_dw
...
of_GetParentWindow(lw_parent)
If IsValid(lw_parent) Then
...
of_GetUpdateable
Description Obsolete. Call of_IsUpdateable instead.
Access Public
Syntax instancename.of_GetUpdateable ( )
Argument Description
instancename Instance name of u_dw
Return value Boolean. Returns TRUE if the DataWindow is updatable and FALSE if it is
not.
of_IsRoot
Description Reports whether the DataWindow is a root DataWindow. A root DataWindow
does not have a master DataWindow.
Access Public
Syntax instancename.of_IsRoot ( )
Argument Description
instancename Instance name of u_dw
Return value Boolean. Returns TRUE if the DataWindow is a root and FALSE if it is not.
Examples This example calls the of_IsRoot function:
IF dw_1.of_IsRoot() THEN
MessageBox("dw_1", "DW is a root")
ELSE
MessageBox("dw_1", "DW is not a root")
END IF
of_IsSharedProperty
Description Reports whether the DataWindow shared property service is enabled.
Access Public
Syntax instancename.of_IsSharedProperty ( )
176
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_dw
Return value Boolean. Returns TRUE if the DataWindow shared property service is enabled
and FALSE if it is not.
Examples This example calls the of_IsSharedProperty function:
IF dw_1.of_IsSharedProperty() THEN
MessageBox("DW", "Shared property enabled")
ELSE
MessageBox("DW", "Shared property disabled")
END IF
of_IsUpdateable
Description Reports whether the DataWindow is updatable.
Access Public
Syntax instancename.of_IsUpdateable ( )
Argument Description
instancename Instance name of u_dw
Return value Boolean. Returns TRUE if the DataWindow is updatable and FALSE if it is
not.
Usage The pfc_UpdatesPending event calls this function.
Examples This example is from the pfc_UpdatesPending event:
...
IF NOT of_IsUpdateable( ) THEN
Return 0
END IF
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_dw
177
u_dw
Argument Description
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in DataWindow
controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’dw_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
of_PostUpdate
Description Calls the pfc_PostUpdate event, which clears update flags and allows you to
code additional post-update processing.
Access Public
178
Chapter 6 Standard Visual User Objects
Syntax instancename.of_PostUpdate ( )
Argument Description
instancename Instance name of u_dw
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize post update processing,
extend the pfc_PostUpdate event.
Examples This example is from the n_cst_luw of_PostUpdate function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_PostUpdate()
...
of_Reset
Description Resets either a single DataWindow or all DataWindows in a linkage chain.
Access Public
Syntax instancename.of_Reset ( )
Argument Description
instancename Instance name of u_dw
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_Reset function:
...
dw_1.of_Reset()
...
of_Retrieve
Description Retrieves rows for either a single DataWindow or all DataWindows in a
linkage chain. This function calls the pfc_Retrieve event.
Access Public
Syntax instancename.of_Retrieve ( )
Argument Description
instancename Instance name of u_dw
179
u_dw
Return value Integer. Returns the number of rows retrieved if the function succeeds and -1 if
an error occurs.
Usage Call this function to retrieve rows in a DataWindow. You code the actual
Retrieve function in the pfc_Retrieve event.
Examples This example calls the of_Retrieve function:
dw_emplist.of_Retrieve()
of_SetBase
Description Enables or disables n_cst_dwsrv, which provides basic DataWindow services.
Access Public
Syntax instancename.of_SetBase ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) basic DataWindow services
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv. This instance
is named inv_base.
Because all DataWindow services are descendants of n_cst_dwsrv (and have
n_cst_dwsrv functions available to them), use this object when you require
basic DataWindow services only.
Examples This example calls the of_SetBase function to enable basic DataWindow
services:
dw_employee.of_SetBase(TRUE)
of_SetDropDownCalculator
Description Enables or disables u_calculator, which provides a dropdown calculator for
registered columns.
Access Public
Syntax instancename.of_SetDropDownCalculator ( boolean )
Argument Description
instancename Instance name of u_dw
180
Chapter 6 Standard Visual User Objects
Argument Description
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the dropdown calculator service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Call this function to enable or disable the dropdown calculator. The u_dw
instance variable for this service is iuo_calculator.
Examples This example calls the of_SetDropDownCalculator function to enable an
instance of the dropdown calculator:
dw_employee.of_SetDropDownCalculator(TRUE)
of_SetDropDownCalendar
Description Enables or disables u_calendar, which provides a dropdown calendar for
registered columns.
Access Public
Syntax instancename.of_SetDropDownCalendar ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the dropdown calendar service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Call this function to enable or disable the dropdown calendar. The u_dw
instance variable for this service is iuo_calendar.
Examples This example calls the of_SetDropDownCalendar function to enable an
instance of the dropdown calendar:
dw_employee.of_SetDropDownCalendar(TRUE)
of_SetDropDownSearch
Description Enables or disables n_cst_dwsrv_dropdownsearch, which provides dropdown
DataWindow search services.
Access Public
Syntax instancename.of_SetDropDownSearch ( boolean )
181
u_dw
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the dropdown DataWindow search service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Call this function to enable or disable DropDownDataWindow search services.
The u_dw instance variable for DropDownDataWindow search services is
inv_dropdownsearch.
Examples This example calls the of_SetDropDownSearch function to enable the
dropdown DataWindow search service:
dw_employee.of_SetDropDownSearch(TRUE)
of_SetFilter
Description Controls or destroys an instance of n_cst_dwsrv_filter, which provides filtering
services.
Access Public
Syntax instancename.of_SetFilter ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the filter service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_filter. This
instance is named inv_filter.
Examples This example calls the of_SetFilter function to enable the filter service:
dw_employee.of_SetFilter(TRUE)
of_SetFind
Description Enables or disables n_cst_dwsrv_find, which provides the DataWindow find
service.
Access Public
182
Chapter 6 Standard Visual User Objects
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Call this function to enable or disable the DataWindow find service. The u_dw
instance variable for the DataWindow find service is inv_find.
Examples This example calls the of_SetFind function to enable the DataWindow find
service:
dw_employee.of_SetFind(TRUE)
of_SetLinkage
Description Enables or disables an instance of n_cst_dwsrv_linkage, which provides
master/detail services.
Access Public
Syntax instancename.of_SetLinkage ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the linkage service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_linkage. This
instance is named inv_linkage.
Examples This example calls the of_SetLinkage function to enable the linkage service:
dw_employee.of_SetLinkage(TRUE)
of_SetMultiTable
Description Enables or disables an instance of n_cst_dwsrv_multitable, which provides
multitable update services.
Access Public
183
u_dw
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_multitable.
This instance is named inv_multitable.
Examples This example calls the of_SetMultiTable function to enable the multitable
update service:
dw_employee.of_SetMultiTable(TRUE)
of_SetPrintPreview
Description Enables or disables an instance of n_cst_dwsrv_printpreview, which provides
the print preview service.
Access Public
Syntax instancename.of_SetPrintPreview ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the print preview service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_printpreview.
This instance is named inv_printpreview.
Examples This example calls the of_SetPrintPreview function to enable the print preview
service:
dw_employee.of_SetPrintPreview(TRUE)
of_SetProperty
Description Enables or disables an instance of n_cst_dwsrv_property, which provides the
DataWindow property service.
184
Chapter 6 Standard Visual User Objects
Access Public
Syntax instancename.of_SetProperty ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the DataWindow property service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_property.
This instance is named inv_property.
Examples This example calls the of_SetProperty function to enable the DataWindow
property service:
dw_employee.of_SetProperty(TRUE)
of_SetQuerymode
Description Enables or disables an instance of n_cst_dwsrv_querymode, which provides
querymode services.
Access Public
Syntax instancename.of_SetQuerymode ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the querymode service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_querymode.
This instance is named inv_querymode.
Examples This example calls the of_SetQuerymode function to enable the querymode
service:
dw_employee.of_SetQuerymode(TRUE)
185
u_dw
of_SetReport
Description Enables or disables an instance of n_cst_dwsrv_report, which provides
reporting services.
Access Public
Syntax instancename.of_SetReport ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the report service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_report. This
instance is named inv_report.
Examples This example calls the of_SetReport function to enable the reporting service:
dw_employee.of_SetReport(TRUE)
of_SetReqColumn
Description Enables or disables an instance of n_cst_dwsrv_reqcolumn, which provides
DataWindow required-field services.
Access Public
Syntax instancename.of_SetReqColumn ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the required column service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_reqcolumn.
This instance is named inv_reqcolumn.
Examples This example calls the of_SetReqColumn function to enable the required
column service:
dw_employee.of_SetReqColumn(TRUE)
186
Chapter 6 Standard Visual User Objects
of_SetResize
Description Enables or disables an instance of n_cst_dwsrv_resize, which provides the
DataWindow resize service.
Access Public
Syntax instancename.of_SetResize ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the DataWindow resize service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_resize. This
instance is named inv_resize.
Examples This example calls the of_SetResize function to enable the DataWindow resize
service:
dw_employee.of_SetResize(TRUE)
of_SetRowManager
Description Enables or disables an instance of n_cst_dwsrv_rowmanager, which provides
row management services.
Access Public
Syntax instancename.of_SetRowManager ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the row management service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_rowmanager.
This instance is named inv_rowmanager.
Examples This example calls the of_SetRowManager function to enable the row
management service:
dw_employee.of_SetRowManager(TRUE)
187
u_dw
of_SetRowSelect
Description Enables or disables an instance of n_cst_dwsrv_rowselection, which provides
row-selection services.
Access Public
Syntax instancename.of_SetRowSelect ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the row selection service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_rowselection.
This instance is named inv_rowselect.
Examples This example calls the of_SetRowSelect function to enable the row selection
service:
dw_employee.of_SetRowSelect(TRUE)
of_SetSharedProperty
Description Enables or disables a shared instance of n_cst_dwsrv_property, which provides
the DataWindow property service.
Access Public
Syntax instancename.of_SetSharedProperty ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the DataWindow property service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy a shared instance of
n_cst_dwsrv_property. This instance is named snv_property.
Examples This example calls the of_SetSharedProperty function to enable the
DataWindow property service:
dw_employee.of_SetSharedProperty(TRUE)
188
Chapter 6 Standard Visual User Objects
of_SetSort
Description Enables or disables an instance of n_cst_dwsrv_sort, which provides sorting
services.
Access Public
Syntax instancename.of_SetSort ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the sort service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_sort. This
instance is named inv_sort.
Examples This example calls the of_SetSort function to enable the sort service:
dw_employee.of_SetSort(TRUE)
of_SetTransObject
Description Sets the transaction object for either a single DataWindow or all DataWindows
in a linkage chain. This function also initializes instance variables for use by
DataWindow services.
Access Public
Syntax instancename.of_SetTransObject ( transaction )
Argument Description
instancename Instance name of u_dw
transaction N_tr variable specifying the Transaction object to use for the
DataWindow
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to establish a Transaction object for a DataWindow that uses
DataWindow services.
Examples This example calls the of_SetTransObject function. It assumes you have
associated n_tr with SQLCA in the Application painter:
dw_employee.of_SetTransObject(SQLCA)
189
u_dw
of_SetUpdateable
Description Specifies whether the DataWindow is updatable.
Access Public
Syntax instancename.of_SetUpdateable ( boolean )
Argument Description
instancename Instance name of u_dw
boolean Boolean indicating whether the DataWindow is updatable. All
updatable DataWindows are included in w_master’s default save
processing
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to disable default save processing for DataWindows that are
not updatable.
Shared DataWindows
If your application uses shared data, be sure that only one of the DataWindows
using the shared data is declared as updatable.
Examples This example disables default save processing for the dw_report DataWindow:
dw_report.of_SetUpdateable(FALSE)
of_SetUpdateRequestor
Description Creates a reference to the object requesting an update within a logical unit of
work.
Access Public
Syntax instancename.of_SetUpdateRequestor ( requestor )
Argument Description
instancename Instance name of u_dw
requestor PowerObject containing the object requesting the update
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_Update function:
...
Else
If this.of_SetUpdateRequestor(apo_requestor) <0 Then
190
Chapter 6 Standard Visual User Objects
Return FAILURE
End If
li_rc = this.of_Update(ab_accepttext, ab_resetflag)
...
of_Update
Updates either a single DataWindow or all DataWindows in a linkage chain.
There are two syntaxes:
To Use
Update data, optionally controlling update type Syntax 1
Update data passing the requestor object Syntax 2
191
u_dw
Argument Description
delete Boolean indicating whether to delete rows:
(optional) TRUE—Delete rows (default)
FALSE—Do not delete rows
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage This function calls the pfc_Update event.
For more information on update flags, see the Update function in the
PowerScript Reference.
Examples This example calls the of_Update function:
Integer li_return
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update processing, extend
the pfc_Update event.
Examples This example is from the n_cst_luw of_Update function:
...
192
Chapter 6 Standard Visual User Objects
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Update &
(ab_accepttext, ab_resetflag, &
lpo_updaterequestor)
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatePrep
Description Perform update preparation for either a single DataWindow or all
DataWindows in a linkage chain. This function calls the pfc_UpdatePrep
event, which allows you to code additional update preparation logic.
Access Public
Syntax instancename.of_UpdatePrep ( )
Argument Description
instancename Instance name of u_dw
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update preparation
processing, extend the pfc_UpdatePrep event.
Examples This example is from the n_cst_luw of_UpdatePrep function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_UpdatePrep()
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatesPending
Description Determines if there are updates pending for either a single DataWindow or all
DataWindows in a linkage chain.
Access Public
Syntax instancename.of_UpdatesPending ( )
193
u_dw
Argument Description
instancename Instance name of u_dw
of_Validation
Description Performs validation for either a single DataWindow or all DataWindows in a
linkage chain.
Access Public
Syntax instancename.of_Validation ( )
Argument Description
instancename Instance name of u_dw
Return value Integer. Returns 1 if the function succeeds and -1 if a validation error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize validation processing,
extend the pfc_Validation event.
Examples This example calls the of_Validation function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_Validation()
...
194
Chapter 6 Standard Visual User Objects
u_em
Description EditMask visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
EditMask. U_em event scripts provide integration with PFC menus.
Additionally, u_em supports:
• Cut, copy, paste, clear, and select all These are triggered
automatically by the message router.
• Popup menu support The ContextMenu event enables you to use the
right mouse button to perform editing actions. To disable right mouse
button support, set ib_rmbmenu to FALSE in the edit mask’s Constructor
event.
• Autoselect This means that text is selected when a user tabs to the edit
mask. To disable autoselect, set ib_autoselect to FALSE in the edit mask’s
Constructor event.
• Dropdown calculator You can enable the display of u_calculator, the
dropdown calculator, to enable enhanced input for numeric fields.
• Dropdown calendar You can enable the display of u_calendar, the
dropdown calendar, to enable enhanced input for date fields.
See also m_edit
u_calculator
u_calendar
195
u_em
Instance variables
U_em has instance variables:
Instance variable Description Data type Ancestry Usage
ib_autoselect Indicates whether PFC Boolean Protected Set to FALSE to disable
selects text when the autoselect
control receives focus
ib_rmbmenu Indicates whether the Boolean Protected Set to FALSE to disable
m_edit menu displays right mouse button support
when the user presses
the right mouse button
iuo_calculator Reference variable for u_calculator Public Use in dot notation to
dropdown calculator access u_calculator events,
functions, and attributes
iuo_calendar Reference variable for u_calendar Public Use in dot notation to
dropdown calendar access u_calendar events,
functions, and attributes
Events
U_em includes precoded events:
ContextMenu pfc_DDCalendar
Destructor pfc_Paste
GetFocus pfc_PreRmbMenu
pfc_Clear pfc_SelectAll
pfc_Copy pfc_Undo
pfc_Cut RButtonUp
pfc_DDCalculator
ContextMenu
Description Displays the m_edit popup menu.
Usage This event executes when the user releases the right mouse button over a
control based on u_em.
Destructor
Description Destroys instances of u_calculator and u_calendar.
196
Chapter 6 Standard Visual User Objects
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_Clear
Description Deletes selected text.
Return value Integer. Returns the number of characters deleted if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when an EditMask based on u_em has
focus and the user selects Edit>Clear.
pfc_Copy
Description Copies selected text to the clipboard.
Return value Integer. Returns the number of characters copied if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when an EditMask based on u_em has
focus and the user selects Edit>Copy.
This event is also called by the m_edit popup menu.
pfc_Cut
Description Deletes selected text and stores it on the clipboard.
Return value Integer. Returns the number of characters removed if the event succeeds and -
1 if an error occurs.
Usage The message router calls this event when an EditMask based on u_em has
focus and the user selects Edit>Cut.
This event is also called by the m_edit popup menu.
pfc_DDCalculator
Description Displays the dropdown calculator.
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
197
u_em
pfc_DDCalendar
Description Displays the dropdown calendar.
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this event to display the dropdown calendar.
Examples This example calls the pfc_DDCalendar event:
Integer li_return
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns the number of characters that were pasted if the event succeeds
and -1 if an error occurs.
Usage The message router calls this event when an EditMask based on u_em has
focus and the user selects Edit>Paste.
This event is also called by the m_edit popup menu.
pfc_PreRmbMenu
Description User event allowing you to modify m_edit contents before display.
Syntax instancename.Event pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_em
editmenu M_edit variable containing the popup menu to be displayed (passed
by reference)
198
Chapter 6 Standard Visual User Objects
Usage Optionally add logic to this event to selectively enable and disable m_edit
menu items.
pfc_SelectAll
Description Selects all text in the EditMask.
Return value Integer. Returns the number of characters selected if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when an EditMask based on u_em has
focus and the user selects Edit>Select All.
This event is also called by the m_edit popup menu.
pfc_Undo
Description Cancels the last change to the EditMask, restoring the text to the content before
the last change.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when an EditMask based on u_em has
focus and the user selects Edit>Undo.
RButtonUp
Description Empty user event. PFC code previously assigned to this event is now in the
ContextMenu event.
Usage This event executes when the user releases the right mouse button over a
control based on u_em.
Functions
U_em includes precoded object functions:
of_GetParentWindow of_SetDropDownCalculator
of_MessageBox of_SetDropDownCalendar
of_GetParentWindow
Description Retrieves a reference to the parent window.
199
u_em
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_em
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_em GetFocus event calls this function.
Examples This example is from the u_em GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_em
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
200
Chapter 6 Standard Visual User Objects
Argument Description
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in EditMasks.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’em_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
of_SetDropDownCalculator
Description Enables or disables u_calculator, which provides a dropdown calculator.
Access Public
Syntax instancename.of_SetDropDownCalculator ( boolean )
Argument Description
instancename Instance name of u_em
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the dropdown calculator service
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to enable or disable the dropdown calculator. The u_em
instance variable for this service is iuo_calculator.
Examples This example calls the of_SetDropDownCalculator function to enable an
instance of the dropdown calculator:
em_1.of_SetDropDownCalculator(TRUE)
201
u_em
of_SetDropDownCalendar
Description Enables or disables u_calendar, which provides a dropdown calendar for
registered columns.
Access Public
Syntax instancename.of_SetDropDownCalendar ( boolean )
Argument Description
instancename Instance name of u_em
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the dropdown calendar service
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to enable or disable the dropdown calendar.
Examples This example calls the of_SetDropDownCalendar function to enable an
instance of the dropdown calendar:
em_1.of_SetDropDownCalendar(TRUE)
202
Chapter 6 Standard Visual User Objects
u_gb
Description GroupBox visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this visual object in windows instead of the standard PowerBuilder
GroupBox.
203
u_gr
u_gr
Description Graph visual user object.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual user object in windows instead of the standard PowerBuilder
Graph control. U_gr scripts provide integration with PFC menus.
See also w_master
Events
U_gr includes a precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_gr includes precoded object functions:
of_GetParentWindow
of_MessageBox
204
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_gr
window Window variable into which the function places a reference to
the parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_gr GetFocus event calls this function.
Examples This example is from the u_gr GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_gr
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
205
u_gr
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Graph controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’gr_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
206
Chapter 6 Standard Visual User Objects
u_hpb
Description HorizontalProgressBar visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
HorizonalProgressBar. U_hpb event scripts provide integration with PFC
menus.
See also u_progressbar
u_vpb
w_master
Events
U_hpb includes one precoded event:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_hpb includes precoded object functions:
of_GetParentWindow
of_MessageBox
207
u_hpb
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_hpb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_hpb GetFocus event calls this function.
Examples This example is from the u_hpb GetFocus event:
Window lw_parent
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_hpb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
208
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in
HorizontalProgressBars.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’hpb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
209
u_hsb
u_hsb
Description HorizontalScrollBar visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
HorizonalScrollBar. U_hsb event scripts provide integration with PFC menus.
See also w_master
u_vsb
Events
U_hsb includes one precoded event:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_hsb includes precoded object functions:
of_GetParentWindow
of_MessageBox
210
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_hsb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_hsb GetFocus event calls this function.
Examples This example is from the u_hsb GetFocus event:
Window lw_parent
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_hsb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
211
u_hsb
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in
HorizontalScrollBars.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’hsb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
212
Chapter 6 Standard Visual User Objects
u_htb
Description HorizontalTrackBar visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
HorizonalTrackBar. U_htb event scripts provide integration with PFC menus.
See also w_master
u_vtb
Events
U_htb includes one precoded event:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_htb includes precoded object functions:
of_GetParentWindow
of_MessageBox
213
u_htb
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_htb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_htb GetFocus event calls this function.
Examples This example is from the u_htb GetFocus event:
Window lw_parent
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_htb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
214
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in
HorizontalTrackBars.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’htb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
215
u_lb
u_lb
Description ListBox visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual user object in windows instead of the standard PowerBuilder
ListBox control. U_lb event scripts provide integration with PFC menus.
See also w_master
u_ddlb
u_ddplb
u_plb
Events
U_lb includes precoded events:
GetFocus pfc_SelectAll
pfc_InvertSelection
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_InvertSelection
Description Inverts the rows selected in the ListBox. Unselected rows become selected;
selected rows are unselected.
216
Chapter 6 Standard Visual User Objects
Return value Integer. Returns the number of selected rows if the event succeeds and 0 if this
is an invalid operation.
Usage To use this event, add a menu item that uses the message router to call
pfc_InvertSelection.
pfc_SelectAll
Description Selects all rows in the ListBox.
Return value Integer. Returns the number of selected rows if the event succeeds and 0 if this
is an invalid operation.
Usage The message router calls this event when the user selects Edit>Select All from
the menu bar.
Functions
U_lb includes precoded object functions:
of_GetParentWindow of_MessageBox
of_GetSelected
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_lb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_lb GetFocus event calls this function.
Examples This example is from the u_lb GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
217
u_lb
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_GetSelected
Description Populates the passed structure object with the selected entries in the ListBox.
Access Public
Syntax instancename.of_GetSelected ( itemattrib )
Argument Description
instancename Instance name of u_lb
itemattrib N_cst_itemattrib array into which the function places text and an
item index (passed by reference)
Return value Integer. Returns the number of elements in the itemattrib array if the function
succeeds and 0 if this is not a valid operation.
Examples This example calls the of_GetSelected function:
n_cst_itemattrib lnv_items[ ]
Integer li_selected
li_selected = lb_list.of_GetSelected(lnv_items)
IF li_selected = 0 THEN
MessageBox("LB", "Invalid LB operation")
Return
END IF
// Logic to read lnv_items follows
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_lb
id String specifying an ID for the message
title String specifying the title of the MessageBox
218
Chapter 6 Standard Visual User Objects
Argument Description
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in ListBoxes.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’lb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
219
u_lvs
u_lvs
Description Service-based ListView visual user object ancestor. This object uses
DataStores to display data in a ListView.
U_lvs is a self-updating object.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master. U_lvs also uses:
m_lvs
n_cst_infoattrib
n_cst_luw
220
Chapter 6 Standard Visual User Objects
n_cst_lvsrv
n_cst_lvsrv_datasource
n_cst_lvsrv_sort
n_ds
Usage Use this visual user object in windows instead of the standard PowerBuilder
ListView control. U_lvs functions make it easy for you to populate a ListView
from rows in a DataWindow. U_lvs event scripts also provide integration with
PFC menus.
U_lvs includes right mouse button support. If the user clicks the right mouse
button over a u_lvs-based ListView control, the m_lvs menu displays. M_lvs
allows you to control ListView icon display.
To use u_lvs:
1 Place a u_lvs user object in your window.
2 In the window pfc_PreOpen event (or some other appropriate place),
enable ListView services as needed by your application:
lv_1.of_SetDataSource(TRUE)
lv_1.of_SetSort(TRUE)
3 Specify sorting information:
String ls_exclude[ ]
lv_1.inv_sort.of_SetColumnHeader(TRUE)
ls_exclude[1] = "emp_phone_number"
lv_1.inv_sort.of_SetExclude(ls_exclude)
4 Specify data source information:
Integer li_count
lv_1.inv_datasource.of_Register("emp_lname", &
"d_emplist", SQLCA)
li_count = &
lv_1.inv_datasource.of_RegisterReportColumn()
lv_1.inv_datasource.of_SetPictureColumn("1")
5 Populate the ListView with information from the registered data source:
lv_1.Event pfc_Populate()
221
u_lvs
Instance variables
U_lvs includes instance variables:
Instance variable Description Data type Access Usage
CONTINUE_ACTION Constant set to 1 Integer Public Internal
ib_alwaysvalidate Controls whether the Boolean Protected Set with
save process includes of_SetAlwaysValidate
all objects in the (default is FALSE)
validation process
ib_isupdateable Indicates whether the Boolean Protected Set with of_SetUpdateable
ListView can be (default is FALSE)
updated
ib_rmbmenu Controls right mouse Boolean Protected Use to enable or disable
button support right mouse button support
(default is TRUE)
Set with of_SetRMBMenu
il_rightclicked Contains the handle of Long Protected PFC uses this instance
the right-clicked variable to track the right-
ListView item clicked item
INSERT_AFTER Constant set to "after" String Public Internal
INSERT_BEFORE Constant set to "before" String Public Internal
INSERT_FIRST Constant set to "first" String Public Internal
INSERT_LAST Constant set to "last" String Public Internal
222
Chapter 6 Standard Visual User Objects
Events
U_lvs includes precoded event scripts:
ColumnClick pfc_PreRefreshItem
ContextMenu pfc_PreRmbMenu
Destructor pfc_Properties
EndLabelEdit pfc_Refresh
GetFocus pfc_RefreshItem
KeyDown pfc_RenameItem
pfc_AcceptText pfc_Retrieve
pfc_AddAll pfc_SelectAll
pfc_AddItem pfc_SetItemAttributes
pfc_DeleteItem pfc_Undo
pfc_InsertItem pfc_Update
pfc_InvertSelection pfc_UpdatePrep
pfc_NewItem pfc_UpdatesPending
pfc_Populate pfc_Validation
223
u_lvs
pfc_PostUpdate RButtonUp
pfc_PreDeleteItem RightClicked
pfc_PreInsertItem Sort
ColumnClick
Description Sorts the ListView contents, using the column whose heading was clicked. If
the column is already sorted, this event reverses the sort order.
Usage To use this event, n_cst_lvsrv_sort must be enabled. This event executes when
the user clicks a ListView control’s column heading.
ContextMenu
Description Displays the m_lvs popup menu.
Usage This event executes when the user releases the right mouse button.
Destructor
Description Destroys all existing ListView service objects.
Usage This event executes when the ListView is destroyed or the window closes.
EndLabelEdit
Description Updates the DataStore with user edits to the item label.
This function updates the DataStore only. You must update the database
explicitly, using the of_Update or the n_cst_luw of_Save function.
Return value Integer. Returns 0 if the label update is allowed and 1 if PowerBuilder should
prevent the label update.
Usage This event executes when the user finishes editing an item label.
PFC allows label update only when the associated label column is updatable.
If the label column is a computed column, you must override this event or the
n_cst_lvsrv_datasource pfc_EndLabelEdit event to update the computed
column and return a 0.
GetFocus
Description Updates the parent window so it can set MicroHelp.
224
Chapter 6 Standard Visual User Objects
KeyDown
Description Checks to see if the DELETE key was pressed.
Usage This event executes when the user presses a key and is not editing a label.
pfc_AcceptText
Description Accepts text for the ListView control data source, optionally setting focus if an
error occurs.
Syntax instancename.EVENT pfc_AcceptText ( controls, focusonerror )
Argument Description
instancename Instance name of u_lvs
controls PowerObject array containing the objects on which to accept text.
This argument is accessed through the apo_control argument
focusonerror Boolean indicating whether focus should be set if an error occurs.
This argument is accessed through the ab_focusonerror argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Extend this event to perform additional accept text processing.
pfc_AddAll
Description Adds all rows in the passed DataStore to the ListView.
Syntax instancename.EVENT pfc_AddAll ( data )
Argument Description
instancename Instance name of u_lvs
data N_ds-based DataStore containing rows to be added. This
argument is accessed through the ads_source argument
Return value Integer. Returns the number of items added if the event succeeds and -1 if an
error occurs.
Examples This example is from the pfc_Refresh event:
...
inv_datasource.of_getdatasource(lds_source)
return this.event pfc_AddAll(lds_source)
...
225
u_lvs
pfc_AddItem
Description Adds the specified row in the data source to the end of the ListView.
Syntax instancename.EVENT pfc_AddItem ( data, row )
Argument Description
instancename Instance name of u_lvs
data N_ds-based DataStore containing rows to be added. This
argument is accessed through the ads_source argument
row Long specifying the row containing the data to be added to the
ListView. This argument is accessed through the al_row
argument
Return value Long. Returns the ListView index of the new row if the event succeeds and -1
if an error occurs.
Examples This example is from the of_AddItem function:
...
li_newindex = this.event pfc_additem &
(lds_datastore, ll_row)
...
pfc_DeleteItem
Description Deletes the selected rows from the ListView and the DataStore.
Return value Integer. Returns the number of rows deleted if the event succeeds and -1 if an
error occurs.
Examples This example calls the pfc_DeleteItem event:
...
li_return = lv_1.Event pfc_DeleteItem()
...
pfc_InsertItem
Description Inserts a new item into the ListView at the specified position.
Syntax instancename.EVENT pfc_InsertItem (datastore, row, position, item )
Argument Description
instancename Instance name of u_lvs
226
Chapter 6 Standard Visual User Objects
Argument Description
datastore N_ds containing the data for the new item. This can be either the
DataStore maintained by n_cst_lvsrv_datasource or another
DataStore. If this is another DataStore, the associated
DataWindow objects must be the same and the function also
adds the row to the DataStore maintained by
n_cst_lvsrv_datasource. This argument is accessed through the
ads_source argument
row Long specifying the row containing the item. This argument is
accessed through the al_row argument
position String specifying the position or location in which to insert the
new item. Valid values are:
• First
• Last
• Before
• After
This argument is accessed through the as_position argument
item Integer containing an index relative to the current position. The
function uses this argument if you specify Before or After for
position. This argument is accessed through the ai_index
argument
Return value Integer. Returns the index of the new item if the function succeeds and -1 if an
error occurs.
Usage This event calls the pfc_SetItemAttributes and pfc_PreInsertItem events before
inserting the item.
Examples This example is from the pfc_AddAll event:
...
For ll_row = 1 to ll_rowcount
If this.event pfc_insertitem(ads_source, &
ll_row, "last", 0) < 1 then
Return -1
End If
...
pfc_InvertSelection
Description Inverts the rows selected in the ListView. Unselected rows become selected;
selected rows are unselected.
Return value Integer. Returns the number of selected rows if the event succeeds and -1 if this
is an invalid operation.
227
u_lvs
Usage To use this event, add a menu item that uses the message router to call
pfc_InvertSelection.
pfc_NewItem
Description Empty user event that you extend to add information to both the data source
and the ListView.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage You typically use this event to open a dialog box prompting the user for
complete information, adding it to the data source and the ListView (via the
pfc_InsertItem event) when it closes.
pfc_Populate
Description Retrieves the data source and uses it to populate the ListView.
Return value Integer. Returns the number of items added to the ListView if the event
succeeds and -1 of an error occurs.
Usage You must add code to the pfc_Retrieve event to retrieve the data.
Examples This example calls the pfc_Populate event:
String ls_exclude[ ]
Integer li_count
pfc_PostUpdate
Description Calls the n_cst_luw of_PostUpdate function to perform post-update processing
on the specified controls.
Syntax instancename.EVENT pfc_PostUpdate ( controls )
228
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_lvs
controls PowerObject array containing the objects on which to perform
postupdate processing. This argument is accessed through the
apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Extend this event to perform additional post-update processing.
pfc_PreDeleteItem
Description Empty user event to which you add logic to perform predelete processing.
Syntax instancename.EVENT pfc_PreDeleteItem ( index )
Argument Description
instancename Instance name of u_lvs
index Integer specifying the index of the ListView item to be deleted.
This argument is accessed through the ai_index argument
pfc_PreInsertItem
Description Empty user event to which you add logic to perform pre-insert processing.
Syntax instancename.Event pfc_PreInsertItem ( data, row, lvitem )
Argument Description
instancename Instance name of u_lvs
data N_ds containing the data for the new item. This argument is
accessed through the ads_obj argument
row Long specifying the row containing the new item. This argument
is accessed through the al_row argument
lvitem ListViewItem to be inserted. This argument is accessed through
the alvi_item argument (passed by reference)
pfc_PreRefreshItem
Description Empty user event to which you add logic that changes ListView item properties
before a ListView item is refreshed.
229
u_lvs
pfc_PreRmbMenu
Description Empty user event allowing you to modify m_lvs contents before display.
Syntax instancename.Event pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_lvs
editmenu M_lvs variable containing the popup menu to be displayed
(passed by reference)
Usage Optionally add logic to this event to selectively enable and disable m_lvs menu
items.
pfc_Properties
Description Empty user event to which you might add logic to display a Properties dialog.
Return value Integer. Return 1 if the event succeeds and -1 if an error occurs.
pfc_Refresh
Description Refresh the ListView items with data from the data source.
Return value Integer. Returns the number of items refreshed if the event succeeds and -1 if
an error occurs.
Examples This example is from the pfc_Populate event:
...
If this.event pfc_refresh() <> 1 Then Return -3
230
Chapter 6 Standard Visual User Objects
...
pfc_RefreshItem
Description Refreshes the specified ListView item, resetting all properties to the defaults
specified in the data source.
Syntax instancename.EVENT pfc_RefreshItem ( index )
Argument Description
instancename Instance name of u_lvs
index Integer specifying the ListView index of the item to refresh
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Examples This example calls the pfc_RefreshItem event:
...
lv_1.Event pfc_RefreshItem(1)
...
pfc_RenameItem
Description Renames the selected item.
Usage To use this event, the Edit Labels property must be enabled for the ListView.
pfc_Retrieve
Description Retrieves rows into the ListView’s data source.
Syntax instancename.EVENT pfc_Retrieve ( datasource )
Argument Description
instancename Instance name of u_lvs
datasource N_ds into which rows are retrieved. This argument is accessed
through the ads_data argument (passed by reference)
Return value Long. Return the number of items retrieved if the event succeeds and -1 if an
error occurs.
Usage Add code to this event that calls the of_Retrieve function to retrieve rows for
the data source.
Examples This example shows code you might add to the pfc_Retrieve event:
Any la_args[20]
231
u_lvs
pfc_SelectAll
Description Selects all rows in the ListView.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when the user selects Edit>Select All from
the menu bar.
pfc_SetItemAttributes
Description Sets default properties for the ListView item before insertion.
Syntax instancename.EVENT pfc_SetItemAttributes ( data, row, lvitem )
Argument Description
instancename Instance name of u_lvs
data N_ds containing the data for the item. This argument is accessed
through the ads_obj argument
row Long specifying the row containing the item. This argument is
accessed through the al_row argument
lvitem ListViewItem to be inserted. This argument is accessed through
the alvi_item argument (passed by reference)
Usage Optionally extend this event to change ListView item properties before
insertion.
pfc_Undo
Description Cancels the last change to the ListView, restoring the text to the content before
the last change.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when a ListView based on u_lvs has focus
and the user selects Edit>Undo.
pfc_Update
Description Calls the n_cst_luw of_Update function to update the specified controls.
Syntax instancename.EVENT pfc_Update ( controls, accepttext, resetflags )
232
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_lvs
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
accepttext Boolean specifying whether n_cst_luw should automatically
perform an AcceptText before performing the Update (TRUE) or
not (FALSE)
resetflags Boolean specifying whether n_cst_luw should automatically reset
DataWindow update flags (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The of_Update function calls this event.
pfc_UpdatePrep
Description Empty user event to which you can add code that prepares for update.
Syntax instancename.EVENT pfc_UpdatePrep ( controls )
Argument Description
instancename Instance name of u_lvs
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
Return value Long. Return 1 if the update preparation succeeds and -1 to halt the update
process.
Usage The of_UpdatePrep function calls this function.
pfc_UpdatesPending
Description Determines if there are pending updates for the ListView.
Syntax instancename.EVENT pfc_UpdatesPending ( controls, pending )
Argument Description
instancename Instance name of u_lvs
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
pending PowerObject array into which the event places objects with
pending updates. This argument is accessed through the
apo_pending argument (passed by reference)
233
u_lvs
Return value Integer. Returns 1 if there are pending updates, 0 if there are no pending
updates, and -1 if an error occurs.
Usage This event is called by the of_GetUpdatesPending function.
pfc_Validation
Description Checks for required fields.
Syntax instancename.EVENT pfc_Validation ( controls )
Argument Description
instancename Instance name of u_lvs
controls PowerObject array containing the objects to validate. This
argument is accessed through the apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the of_Validation function.
RButtonUp
Description Empty user event. PFC code previously assigned to this event is now in the
ContextMenu event.
Usage This event executes when the user releases the right mouse button.
RightClicked
Description Tracks the clicked item and displays the m_lvs popup menu.
Usage This event executes when the user presses the right mouse button.
Sort
Description Performs the sort comparison when the sort type is UserDefined!.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Extend the n_cst_lvsrv_sort pfc_Sort event to create site-specific sort logic.
Functions
U_lvs includes precoded object functions:
234
Chapter 6 Standard Visual User Objects
of_AcceptText of_PostUpdate
of_AddItem of_Reset
of_CanUndo of_Retrieve
of_GetInfo of_SetAlwaysValidate
of_GetColumnInfo of_SetBase
of_GetObjects of_SetDataSource
of_GetParentWindow of_SetLogicalUnitOfWork
of_GetRow of_SetRMBMenu
of_GetUpdateRequestor of_SetSort
of_InsertItem of_SetUpdateable
of_IsAlwaysValidate of_SetUpdateRequestor
of_IsRMBMenu of_Update
of_IsUpdateable of_UpdatePrep
of_MessageBox of_UpdatesPending
of_Populate of_Validation
of_AcceptText
Description Performs an AcceptText function for the data source.
Access Public
Syntax instancename.of_AcceptText ( focusonerror )
Argument Description
instancename Instance name of u_lvs
focusonerror Boolean indicating whether PFC sets focus to the first item in error
when an error occurs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize accept text processing,
extend the pfc_AcceptText event.
Examples This example is from the n_cst_luw of_AcceptText function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_AcceptText &
(ab_focusonerror)
If li_rc < 0 Then Return -1
235
u_lvs
...
of_AddItem
Description Adds a new item to the end of the ListView control.
Access Public
Syntax instancename.of_AddItem ( rowinfo )
Argument Description
instancename Instance name of u_lvs
rowinfo Any array containing data for the row
Return value Long. Returns the index of the added item if the functions succeeds and -1 if
an error occurs.
Usage If the information in rowinfo is not already in the data source, this function adds
the new row to the data source. If you are using the ListView data source
service, the data types of the elements in rowinfo must match those in the
DataWindow object specified in the n_cst_lvsrv_datasource of_Register
function.
Examples This example calls the of_AddItem function:
Any la_row[ ]
la_row[1] = 500
la_row[2] = "Nelsen"
la_row[3] = "Rodney"
lv_1.of_AddItem(la_row)
of_CanUndo
Description Reports whether the ListView can undo the last edit, insertion, or deletion,
returning the operation type.
Access Public
Syntax instancename.of_CanUndo ( undotype )
Argument Description
instancename Instance name of u_lvs
236
Chapter 6 Standard Visual User Objects
Argument Description
undotype String into which the function places the type of the last
operation (passed by reference):
• "Edit" Edit
• "Insert" Insertion
• "Delete" Deletion
Return value Boolean. Returns TRUE if the last operation can be undone and FALSE if it
cannot.
Examples This example calls the of_CanUndo function:
String ls_undotype
IF lv_1.of_CanUndo(ls_undotype) THEN
MessageBox("ListView", "Can undo")
ELSE
MessageBox("ListView", "Cannot undo")
END IF
of_GetColumnInfo
Description Retrieves column information from the ListView.
Access Public
Syntax instancename.of_GetColumnInfo ( column, colattrib )
Argument Description
instancename Instance name of the u_lvs-based ListView control
column Integer specifying the column from the ListView
colattrib N_cst_columnattrib into which the function places column
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Column information is used in detail view only.
Examples This example calls the of_GetColumnInfo:
n_cst_columnattrib lnv_colinfo
lv_1.of_GetColumnInfo(3, lnv_colinfo)
...
237
u_lvs
of_GetInfo
Description Retrieves object information.
Access Public
Syntax instancename.of_GetInfo ( infoobject )
Argument Description
instancename Instance name of u_lvs
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
lv_1.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetObjects
Description Retrieves the objects to be updated.
Access Protected
Syntax instancename.of_GetObjects ( objects )
Argument Description
instancename Instance name of u_lvs
objects PowerObject array into which the function places objects to be
updated (passed by reference)
Return value Integer. Returns the number of elements in the objects array if the function
succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_AcceptText function:
...
Else
this.of_Getobjects(lpo_updatearray)
End If
...
238
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_lvs
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_lvs GetFocus event calls this function.
Examples This example is from the u_lvs GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_GetRow
Description Retrieves the DataStore and DataStore row for the specified ListView index.
Access Public
Syntax instancename.of_GetRow ( index, data, row )
Argument Description
instancename Instance name of u_lvs
index Integer specifying the index for the row to be retrieved
data N_ds into which the function places a reference to the DataStore
(passed by reference)
row Long into which the function places the row number that
corresponds to index (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_GetRow function:
239
u_lvs
n_ds lds_data
Long ll_row
of_GetUpdateRequestor
Description Retrieves a reference to the object requesting an update.
Access Public
Syntax instancename.of_GetUpdateRequestor ( requestor )
Argument Description
instancename Instance name of u_lvs
requestor PowerObject into which the function places a reference to the
object requesting the update (passed by reference)
Return value Integer. Returns 1 if the function succeeds, 0 if there is no update requestor, and
-1 if an error occurs.
Usage Call this function if you are extending the pfc_Save process and need to access
the update requestor.
of_InsertItem
Inserts an item into the ListView. There are two syntaxes:
To Use
Insert from a DataStore Syntax 1
Insert from an array Syntax 2
240
Chapter 6 Standard Visual User Objects
Argument Description
datastore N_ds containing the data for the new item. This can be either the
DataStore maintained by n_cst_lvsrv_datasource or another
DataStore. If this is another DataStore, the associated
DataWindow objects must be the same and the function also
adds the row to the DataStore maintained by
n_cst_lvsrv_datasource (passed by reference)
row Long specifying the row containing data for the new item
position String specifying the position under the current parent in which
(optional) to insert the new item. Valid values are:
• First
• Last (default)
• Before
• After
index Integer containing an index relative to the current position. The
(optional) function uses this argument if you specify Before or After for
position
Return value Integer. Returns the index of the new item if the function succeeds and -1 if an
error occurs.
Examples This example calls the of_InsertItem function:
Long ll_row
ll_row = ids_data.GetRow()
lv_1.of_InsertItem(ids_data, ll_row)
241
u_lvs
Argument Description
position String specifying the position or location in which to insert the
(optional) new item. Valid values are:
• First
• Last (default)
• Before
• After
index Integer containing an index relative to the current position. The
(optional) function uses this argument if you specify Before or After for
position
Return value Integer. Returns the index of the new item if the function succeeds and -1 if an
error occurs.
Examples This example calls the of_InsertItem function:
Any la_row[ ]
la_row[1] = 500
la_row[2] = "Nelsen"
la_row[3] = "Rodney"
lv_1.of_InsertItem(la_row, "First", 0)
of_IsAlwaysValidate
Description Reports whether the default save process always performs validation.
Access Public
Syntax instancename.of_IsAlwaysValidate ( )
Argument Description
instancename Instance name of u_lvs
Return value Boolean. Returns TRUE if the default save process always performs validation
and FALSE if it does not.
Examples This example calls the of_IsAlwaysValidate function:
IF lv_1.of_IsAlwaysValidate() = TRUE THEN
MessageBox("LV", "Always validate")
ELSE
MessageBox("LV", "Sometimes validate")
END IF
242
Chapter 6 Standard Visual User Objects
of_IsRMBMenu
Description Reports whether the popup menu is enabled.
Access Public
Syntax instancename.of_IsRMBMenu ( )
Argument Description
instancename Instance name of u_lvs
Return value Boolean. Returns TRUE if the m_lvs popup menu is enabled and FALSE if it
is not.
Examples This example calls the of_IsRMBMenu function:
IF lv_1.of_IsRMBMenu() = TRUE THEN
MessageBox("LV", "RMB enabled")
ELSE
MessageBox("LV", "RMB disabled")
END IF
of_IsUpdateable
Description Reports whether the ListView’s data source is updatable and should be
included in a window's default save processing.
Access Public
Syntax instancename.of_IsUpdateable ( )
Argument Description
instancename Instance name of u_lvs
Return value Boolean. Returns TRUE if the ListView’s data source is updatable and FALSE
if it is not.
Usage The pfc_UpdatesPending event calls this function.
Examples This example is from the pfc_UpdatesPending event:
...
If Not of_IsUpdateable() Then Return NO_UPDATESPENDING
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
243
u_lvs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in ListViews.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’lv_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
of_Populate
Description Retrieves the data source and populates a ListView.
Access Public
244
Chapter 6 Standard Visual User Objects
Syntax instancename.of_Populate ( )
Argument Description
instancename Instance name of u_lvs
Return value Integer. Returns the number of items added if the function succeeds and -1 if
an error occurs.
Usage Internal.
Examples The example is from the pfc_Populate event:
Return of_populate()
of_PostUpdate
Description Calls the pfc_PostUpdate event, which clears update flags and allows you to
code additional post-update processing.
Access Public
Syntax instancename.of_PostUpdate ( )
Argument Description
instancename Instance name of u_lvs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize post-update processing,
extend the pfc_PostUpdate event.
Examples This example is from the n_cst_luw of_PostUpdate function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_PostUpdate()
...
of_Reset
Description Deletes all items from both the ListView and the data source.
Access Public
Syntax instancename.of_Reset ( )
Argument Description
instancename Instance name of u_lvs
245
u_lvs
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Examples This example calls the of_Reset function:
lv_1.of_Reset()
of_Retrieve
Description Retrieves rows into a DataStore.
Syntax instancename.EVENT of_Retrieve ( args, data )
Argument Description
instancename Instance name of u_lvs
args 20-element Any array specifying retrieval arguments
data N_ds into which the function places the retrieved rows (passed by
reference)
Return value Long. Returns the number of items retrieved if the function succeeds, 0 if no
action was taken, and -1 if an error occurs.
Examples This example (from a pfc_Retrieve event) calls the of_Retrieve function:
Long ll_count
Any la_args[20]
of_SetAlwaysValidate
Description Specifies whether the default save process always performs validation.
Access Public
Syntax instancename.of_SetAlwaysValidate ( boolean )
Argument Description
instancename Instance name of u_lvs
boolean Boolean specifying whether the default save process always
perform validation (TRUE) or only performs validation if a
control has pending updates
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAlwaysValidate function:
lv_1.of_SetAlwaysValidate(TRUE)
246
Chapter 6 Standard Visual User Objects
of_SetBase
Description Enables or disables n_cst_lvsrv, which provides basic ListView services.
Access Public
Syntax instancename.of_SetBase ( boolean )
Argument Description
instancename Instance name of u_lvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) basic ListView services
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_lvsrv. This instance
is named inv_base.
Because all ListView services are descendants of n_cst_lvsrv (and have
n_cst_lvsrv functions available to them), use this object when you require basic
ListView services only.
Examples This example calls the of_SetBase function to enable basic ListView services:
lv_1.of_SetBase(TRUE)
of_SetDataSource
Description Enables or disables n_cst_lvsrv_datasource, which provides data access for
ListViews.
Access Public
Syntax instancename.of_SetDataSource ( boolean )
Argument Description
instancename Instance name of u_lvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) n_cst_lvsrv_datasource
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_lvsrv_datasource.
This instance is named inv_datasource.
Examples This example calls the of_SetDataSource function:
lv_1.of_SetDataSource(TRUE)
247
u_lvs
of_SetLogicalUnitOfWork
Description Enables or disables n_cst_luw, which provides the logical unit of work service.
Access Public
Syntax instancename.of_SetLogicalUnitOfWork ( boolean )
Argument Description
instancename Instance name of u_lvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) n_cst_luw
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_luw. This instance is
named inv_luw. If you do not enable n_cst_luw, u_lvs enables it automatically.
Examples This example calls the of_SetLogicalUnitOfWork function:
lv_1.of_SetLogicalUnitOfWork(TRUE)
of_SetRMBMenu
Description Enables or disables right mouse button support for m_lvs, the ListView popup
menu.
Access Public
Syntax instancename.of_SetRMBMenu ( boolean )
Argument Description
instancename Instance name of u_lvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) right mouse button support
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetRMBMenu function:
lv_1.of_SetRMBMenu(TRUE)
of_SetSort
Description Enables or disables n_cst_lvsrv_sort, which provides the ListView sort service.
Access Public
Syntax instancename.of_SetSort ( boolean )
248
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_lvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the ListView sort service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_lvsrv_sort. This
instance is named inv_sort.
Examples This example calls the of_SetSort function:
lv_1.of_SetSort(TRUE)
of_SetUpdateable
Description Specifies whether the ListView is updatable and should be included in the
default save process.
Access Public
Syntax instancename.of_SetUpdateable ( boolean )
Argument Description
instancename Instance name of u_lvs
boolean Boolean indicating whether the ListView is updatable. All
updatable ListViews are included in the default save processing
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to enable default save processing for ListViews (by default,
they are not updatable).
Examples This example calls the of_SetUpdateable function:
lv_1.of_SetUpdateable(TRUE)
of_SetUpdateRequestor
Description Creates a reference to the object requesting an update within a logical unit of
work.
Access Public
Syntax instancename.of_SetUpdateRequestor ( requestor )
249
u_lvs
Argument Description
instancename Instance name of u_lvs
requestor PowerObject containing the object requesting the update
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example calls the of_SetUpdateRequestor function:
...
lv_1.of_SetUpdateRequestor(lv_1)
...
of_Update
Description Saves all rows in the DataStore associated with the ListView.
Access Public
Syntax instancename.of_Update ( accept, resetflag {, requestor } )
Argument Description
instancename Instance name of u_lvs
accept Boolean indicating whether the Update function performs an
AcceptText before saving rows to the database
resetflag Boolean indicating whether the Update function resets the update
flags
requestor PowerObject containing the requestor object
Return value Integer. Returns 1 if the update succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update processing, extend
the pfc_Update event.
Examples This example is from the n_cst_luw of_Update function:
...
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Update &
(ab_accepttext, ab_resetflag, &
lpo_updaterequestor)
If li_rc < 0 Then Return -1
Continue
End If
...
250
Chapter 6 Standard Visual User Objects
of_UpdatePrep
Description Calls the pfc_UpdatePrep event, which allows you to code additional update
preparation logic.
Access Public
Syntax instancename.of_UpdatePrep ( )
Argument Description
instancename Instance name of u_lvs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the n_cst_luw of_UpdatePrep function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_UpdatePrep ()
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatesPending
Description Determines if there are updates pending in the ListView.
Access Public
Syntax instancename.of_UpdatesPending ( )
Argument Description
instancename Instance name of u_lvs
251
u_lvs
of_Validation
Description Performs validation on the ListView data source.
Access Public
Syntax instancename.of_Validation ( )
Argument Description
instancename Instance name of u_lvs
Return value Integer. Returns 1 if the function succeeds and -1 if a validation error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize validation processing,
extend the pfc_Validation event.
Examples This example calls the of_Validation function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_Validation()
...
252
Chapter 6 Standard Visual User Objects
u_mle
Description MultiLineEdit visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
MultiLineEdit. U_mle event scripts provide integration with PFC menus.
Additionally, u_mle supports:
• Cut, copy, paste, clear, and select all These are triggered
automatically by the message router.
• Popup menu support The ContextMenu event enables you to use the
right mouse button to perform editing actions. To disable right mouse
button support, set ib_rmbmenu to FALSE in the MultiLineEdit’s
Constructor event.
• Autoselect This means that text is selected when a user tabs to the edit
mask. To disable autoselect, set ib_autoselect to FALSE in the
MultiLineEdit’s Constructor event.
See also m_edit
253
u_mle
Instance variables
U_mle includes instance variables:
Instance variable Description Data type Access Usage
ib_autoselect Indicates whether PFC Boolean Protected Set this to TRUE to
selects text enable autoselect (default
automatically when the is FALSE)
control receives focus
ib_rmbmenu Indicates whether the Boolean Protected Set this to FALSE to
m_edit menu displays disable right mouse
when the user presses button support (default is
the right mouse button TRUE)
Events
U_mle includes precoded events:
ContextMenu pfc_Paste
GetFocus pfc_PreRmbMenu
pfc_Clear pfc_SelectAll
pfc_Copy pfc_Undo
pfc_Cut RButtonUp
ContextMenu
Description Displays the m_edit popup menu.
Usage This event executes when the user releases the right mouse button over a
control based on u_mle.
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_Clear
Description Deletes selected text.
Return value Integer. Returns the number of characters deleted if the event succeeds and -1
if an error occurs.
254
Chapter 6 Standard Visual User Objects
Usage The message router calls this event when a MultiLineEdit based on u_mle has
focus and the user selects Edit>Clear from the menu bar.
pfc_Copy
Description Copies selected text to the clipboard.
Return value Integer. Returns the number of characters copied if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a MultiLineEdit based on u_mle has
focus and the user selects Edit>Copy from the menu bar. This event is also
called by the m_edit popup menu.
pfc_Cut
Description Deletes selected text and stored it on the clipboard.
Return value Integer. Returns the number of characters removed if the event succeeds and -
1 if an error occurs.
Usage The message router calls this event when a MultiLineEdit based on u_mle has
focus and the user selects Edit>Cut from the menu bar. This event is also called
by the m_edit popup menu.
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns the number of characters that were pasted if the event succeeds
and -1 if an error occurs.
Usage The message router calls this event when a MultiLineEdit based on u_mle has
focus and the user selects Edit>Paste from the menu bar. This event is also
called by the m_edit popup menu.
pfc_PreRmbMenu
Description User event allowing you to modify m_edit contents before display.
Syntax instancename.EVENT pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_mle
editmenu M_edit variable containing the popup menu to be displayed
(passed by reference)
255
u_mle
Usage Add logic to this event to selectively enable and disable m_edit menu items.
pfc_SelectAll
Description Selects all text in the MultiLineEdit.
Return value Integer. Returns the number of characters selected if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a MultiLineEdit based on u_mle has
focus and the user selects Edit>Select All from the menu bar. This event is also
called by the m_edit popup menu.
pfc_Undo
Description Cancels the last change to the MultiLineEdit, restoring the text to the content
before the last change.
Return value Integer. Returns 1 if the event succeeds 0 and -1 if an error occurs.
Usage The message router calls this event when a MultiLineEdit based on u_mle has
focus and the user selects Edit>Undo.
RButtonUp
Description Empty user event. PFC code previously assigned to this event is now in the
ContextMenu event.
Usage This event executes when the user releases the right mouse button over a
control based on u_mle.
Functions
U_mle includes precoded object functions:
of_GetParentWindow
of_MessageBox
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
256
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_mle
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
Usage The u_mle GetFocus event calls this function.
Examples This example is from the u_mle GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event pfc_ControlGotFocus &
(this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_mle
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to
display on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
257
u_mle
Argument Description
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed
in the enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be
the default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in MultiLineEdits.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’mle_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
258
Chapter 6 Standard Visual User Objects
u_oc
Description OLE visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder OLE
2.0 window control. U_oc event scripts provide integration with PFC menus.
Additionally, u_oc supports:
• Cut, copy, paste, paste special, clear, and select all These are
triggered automatically by the message router.
• Popup menu support The ContextMenu event enables you to use the
right mouse button to perform editing actions. To disable right mouse
button support, set ib_rmbmenu to FALSE in the OLE control’s
Constructor event.
• Object actions U_oc provides events to activate the object (inplace and
offsite), update links, and insert an object into the OLE control.
See also m_oc
259
u_oc
Instance variables
U_oc contains one instance variable:
Instance variable Description Data type Ancestry Usage
ib_rmbmenu Indicates whether the Boolean Protected Set this to FALSE to
m_oc menu displays when disable right mouse
the user presses the right button support
mouse button
Events
U_oc includes precoded events:
ContextMenu pfc_OpenObject
GetFocus pfc_Paste
pfc_Clear pfc_PasteSpecial
pfc_Copy pfc_PreRmbMenu
pfc_Cut pfc_UpdateLinks
pfc_EditObject RButtonUp
pfc_InsertObject
ContextMenu
Description Displays the m_oc popup menu.
Usage This event executes when the user releases the right mouse button over a
control based on u_oc.
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_Clear
Description Deletes the OLE object.
Return value Integer. Returns 0 if the event succeeds and -9 if an error occurs.
260
Chapter 6 Standard Visual User Objects
Usage The message router calls this event when an OLE control based on u_oc has
focus and the user selects Edit>Clear from a menu that descends from the PFC
m_master menu.
pfc_Copy
Description Copies the OLE object to the clipboard.
Return value Integer. Returns one of the following values:
0 Success
-1 Container is empty
-2 Copy failed
-9 Other error
Usage The message router calls this event when an OLE control based on u_oc has
focus and the user selects Edit>Copy from a menu that descends from the PFC
m_master menu. This event is also called by the m_oc popup menu.
pfc_Cut
Description Deletes the selected item or text and stores it on the clipboard.
Return value Integer. Returns values as follows:
-1 Container is empty
-2 Cut failed
-9 Other error
Usage The message router calls this event when an OLE control based on u_oc has
focus and the user selects Edit>Cut. This event is also called by the m_oc
popup menu.
pfc_EditObject
Description Activates the object in place.
Return value Integer. Returns values as follows:
0 Success
-1 Control is empty
-2 Invalid verb for the object
-3 Verb not implemented by the object
-4 No verbs supported by the object
-5 Object can’t execute the verb now
-9 Other error
Usage Call this event to activate an object in-place.
261
u_oc
The message router calls this event when an OLE control based on u_oc has
focus and the user selects Edit>Object>Edit from a menu that descends from
the PFC m_master menu. This event is also called by the m_oc popup menu.
pfc_InsertObject
Description Displays the Insert Object dialog box, which allows you to insert an object into
the OLE control.
Return value Integer. Returns values as follows:
0 Success
1 The user canceled out of the dialog box
-9 Other error
Usage Call this event to insert an object into the OLE control.
The message router triggers this event when an OLE control based on u_oc has
focus and the user selects Edit>Insert Object from a menu that descends from
the PFC m_master menu.
pfc_OpenObject
Description Activates the object offsite.
Return value Integer. Returns values as follows:
0 Success
-1 Control is empty
-2 Invalid verb for the object
-3 Verb not implemented by the object
-4 No verbs supported by the object
-5 Object can’t execute the verb now
-9 Other error
Usage Call this event to activate an object offsite.
The message router calls this event when an OLE control based on u_oc has
focus and the user selects Edit>Object>Open from a menu that descends from
the PFC m_master menu. This event is also called by the m_oc popup menu.
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns values as follows:
0 Success
262
Chapter 6 Standard Visual User Objects
pfc_PasteSpecial
Description Displays a standard OLE 2.0 dialog box allowing the user to choose whether
to embed or link the OLE object on the clipboard when pasting it in the
specified control. Embedding is the equivalent of calling the Paste function and
linking is the same as calling PasteLink.
Return value Integer. Returns values as follows:
0 Success
1 User canceled out of the OLE 2.0 dialog box
-1 No data found
-9 Other error
Usage The message router calls this event when an OLE control based on u_oc has
focus and the user selects Edit>Paste Special from a menu that descends from
the PFC m_master menu.
pfc_PreRmbMenu
Description User event allowing you to modify m_oc contents prior to display.
Syntax instancename.Event pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_oc
editmenu M_oc variable containing the popup menu to be displayed (passed
by reference)
Usage Optionally add logic to this event to selectively enable and disable m_oc menu
items.
pfc_UpdateLinks
Description Attempts to find a file linked to an OLE container. If the linked file is not found,
a dialog tells the user and lets them bring up a second dialog for find the file or
changing the link.
Return value Integer. Returns 0 if the event succeeds and -1 if an error occurs.
263
u_oc
RButtonUp
Description Empty user event. PFC code previously assigned to this event is now in the
ContextMenu event.
Usage This event executes when the user releases the right mouse button over a
control based on u_oc.
Functions
U_oc includes precoded object functions:
of_GetParentWindow
of_MessageBox
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_oc
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
Usage The u_oc GetFocus event calls this function.
Examples This example is from the u_oc GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event pfc_ControlGotFocus &
264
Chapter 6 Standard Visual User Objects
(this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_oc
id String specifying an ID for the message
title String specifying the title of the OLEControl
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in OLE controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
265
u_oc
of_Messagebox(’oc_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
266
Chapter 6 Standard Visual User Objects
u_p
Description Picture visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder Picture
control. U_p event scripts provide integration with PFC menus.
See also u_pb
u_phl
u_plb
Events
U_p includes a precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_p includes precoded object functions:
of_GetParentWindow
of_MessageBox
267
u_p
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_p
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_p GetFocus event calls this function.
Examples This example is from the u_p GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus(this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_p
id String specifying an ID for the message
title String specifying the title of the Picture control
message String specifying the message text
268
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Picture controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’p_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
269
u_pb
u_pb
Description PictureButton visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
PictureButton control. U_pb event scripts provide integration with PFC menus.
See also u_cb
u_p
Events
U_pb includes a precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_pb includes precoded object functions:
of_GetParentWindow
of_MessageBox
270
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_pb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_pb GetFocus event calls this function.
Examples This example is from the u_pb GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_pb
id String specifying an ID for the message
title String specifying the title of the PictureButton
message String specifying the message text
271
u_pb
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in PictureButtons.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’pb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
272
Chapter 6 Standard Visual User Objects
u_phl
Description PictureHyperlink visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
PictureHyperlink control. U_phl event scripts provide integration with PFC
menus.
See also u_p
u_sth
Events
U_phl includes a precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_phl includes precoded object functions:
of_GetParentWindow
of_MessageBox
273
u_phl
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_phl
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_phl GetFocus event calls this function.
Examples This example is from the u_phl GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_phl
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
274
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior for PictureHyperlink
controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’phl_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
275
u_plb
u_plb
Description PictureListBox user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
PictureListBox. U_plb event scripts provide integration with PFC menus.
See also u_lb
Events
U_plb includes precoded events:
GetFocus pfc_SelectAll
pfc_InvertSelection
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_InvertSelection
Description Inverts the rows selected in the PictureListBox. Unselected rows become
selected; selected rows are cleared.
Return value Integer. Returns the number of selected rows if the event succeeds and 0 if this
is an invalid operation.
276
Chapter 6 Standard Visual User Objects
Usage The message router calls this event when the user selects Edit>Invert Selection
from the menu bar.
pfc_SelectAll
Description Selects all rows in the PictureListBox.
Return value Integer. Returns the number of selected rows if the event succeeds and 0 if this
is an invalid operation.
Usage The message router calls this event when the user selects Edit>Select All from
the menu bar.
Functions
U_plb includes precoded object functions:
of_GetParentWindow of_MessageBox
of_GetSelected
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_plb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_plb GetFocus event calls this function.
Examples This example is from the u_plb GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
277
u_plb
pfc_ControlGotFocus(this)
END IF
END IF
of_GetSelected
Description Populates a passed object with all selected entries in the PictureListBox.
Access Public
Syntax instancename.of_GetSelected ( selecteditems )
Argument Description
instancename Instance name of u_plb
selecteditems N_cst_itemattrib array into which the function places selected
items (passed by reference)
Return value Integer. Returns the number of selected items if the function succeeds and 0 if
this is an invalid operation.
Usage Call this function to access selected items.
Examples This example calls the of_GetSelected function:
n_cst_itemattrib lnv_items[ ]
Integer li_selected
li_selected = plb_list.of_GetSelected(lnv_items)
IF li_selected = 0 THEN
MessageBox("PLB", "Invalid PLB operation")
Return
END IF
// Logic to read lnv_items follows
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_plb
id String specifying an ID for the message
title String specifying the title of the PictureListBox
message String specifying the message text
278
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in PictureListBoxes.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’plb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
279
u_rb
u_rb
Description RadioButton visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
RadioButton control. U_rb event scripts provide integration with PFC menus.
See also u_cbx
Events
U_rb includes a precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_rb includes precoded object functions:
of_GetParentWindow
of_MessageBox
280
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_rb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_rb GetFocus event calls this function.
Examples This example is from the u_rb GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus(this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_rb
id String specifying an ID for the message
title String specifying the title of the RadioButton
message String specifying the message text
281
u_rb
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in RadioButtons.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’rb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
282
Chapter 6 Standard Visual User Objects
u_rte
Description RichTextEdit visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master. U_rte also uses:
F_SetFileSrv
M_edit
N_cst_filesrv
N_cst_rtefind
N_cst_textstyleattrib
S_printdlgattrib
Usage Use this visual user object in windows instead of the standard PowerBuilder
RichTextEdit control. U_rte event scripts provide integration with PFC menus.
283
u_rte
U_rte is fully integrated with menus that descend from PFC’s m_master menu,
including events that respond to the appropriate menu items. Additionally,
u_rte includes right mouse button support. If the user clicks the right mouse
button over a u_rte-based RichTextEdit control, the m_edit menu displays.
M_edit allows you to perform basic editing functions.
To use u_rte:
1 Place a u_rte user object in your window.
2 (Optional) Enable the find service:
rte_doc.of_SetFind(TRUE)
3 Associate a document with the RichTextEdit control. This example uses
the of_OpenDocument function to display a dialog box prompting the user
for the file:
String ls_document
rte_doc.of_OpenDocument(ls_document)
4 Call additional u_rte events and functions, as needed.
For more information on the RichTextEdit control, see the PowerBuilder
User’s Guide.
See also n_cst_rtefind
u_dw
Instance variables
U_rte includes instance variables:
Instance variable Description Data type Access Usage
ib_continuouspages Indicates whether Boolean Protected Use of_GetContinuousPages and
continuous page of_SetContinuousPages to access
numbering is enabled
when printing
ib_ignorefileexists Indicates whether u_rte Boolean Protected Use of_GetIgnoreFileExists and
asks the user to confirm of_SetIgnoreFileExists to access
when saving a file that
already exists
ib_ongoingfind Indicates whether a find Boolean Protected Internal
operation is in progress
284
Chapter 6 Standard Visual User Objects
Events
U_rte includes precoded event scripts:
Destructor pfc_PreRmbMenu
FileExists pfc_PreviousPage
GetFocus pfc_Print
pfc_Clear pfc_PrintDlg
pfc_Copy pfc_PrintImmediate
pfc_Cut pfc_PrintPreview
pfc_FindDlg pfc_ReplaceDlg
pfc_FirstPage pfc_Ruler
285
u_rte
pfc_InsertFile pfc_Save
pfc_InsertPicture pfc_SaveAs
pfc_LastPage pfc_SelectAll
pfc_NextPage pfc_Undo
pfc_Open PrintHeader
pfc_Paste RButtonUp
pfc_PrePrintDlg
Destructor
Description Destroys the inv_filesrv instance.
Usage This event executes when the u_rte-based control is destroyed or the window
closes.
FileExists
Description Prompts the user that the file to be saved already exists. If the
ib_ignorefileexists instance variable is TRUE, PFC does not prompt the user.
Usage This event executes when the user saves a file that already exists.
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_Clear
Description Deletes selected text.
Return value Integer. Returns the number of characters deleted if the event succeeds and -1
if an error occurs.
Usage This event is triggered when a RichTextEdit control based on u_rte has focus
and the user selects Edit>Clear from the menu bar of a menu descended from
the PFC m_master menu.
pfc_Copy
Description Copies selected text to the clipboard.
286
Chapter 6 Standard Visual User Objects
Return value Integer. Returns the number of characters copied if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects Edit>Copy from the menu bar of a menu
descended from the PFC m_master menu. This event is also called by the
m_edit popup menu.
pfc_Cut
Description Deletes selected text and stores it on the clipboard.
Return value Integer. Returns the number of characters removed if the event succeeds and -
1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects Edit>Cut from the menu bar of a menu descended
from the PFC m_master menu. This event is also called by the m_edit popup
menu.
pfc_FindDlg
Description Displays a Find dialog box by calling the n_cst_rtefind service’s pfc_FindDlg
event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the user selects Edit>Find from the menu bar of a
menu descended from the PFC m_master menu.
pfc_FirstPage
Description Scrolls to the first page.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects View>First Page from the menu bar of a menu
descended from the PFC m_master menu.
pfc_InsertFile
Description Displays a dialog box prompting the user to choose a file to be copied at the
current insertion point.
287
u_rte
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects Insert>File from the menu bar of a menu
descended from the PFC m_master menu.
pfc_InsertPicture
Description Displays a dialog box prompting the user to choose a bitmap to be copied at the
current insertion point.
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects Insert>Picture from the menu bar of a menu
descended from the PFC m_master menu.
pfc_LastPage
Description Scrolls to the last page.
Return value Integer. Returns the number of the last page if the event succeeds and -1 if an
error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects View>Last Page from the menu bar of a menu
descended from the PFC m_master menu.
pfc_NextPage
Description Scrolls to the next page.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects View>Next Page from the menu bar of a menu
descended from the PFC m_master menu.
pfc_Open
Description Prompts the user for a file to open and places the specified file in the
RichTextEdit control. If there is already a document in the control, the function
prompts the user to save it.
288
Chapter 6 Standard Visual User Objects
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects File>Open from the menu bar of a menu
descended from the PFC m_master menu.
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns the number of characters that were pasted if the event succeeds
and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects Edit>Paste from the menu bar of a menu
descended from the PFC m_master menu.
pfc_PrePrintDlg
Description Empty user event allowing you to modify the properties passed to the
n_cst_platform of_PrintDlg function.
Syntax instancename.EVENT pfc_PrePrintDlg ( attributes )
Argument Description
instancename Instance name of u_rte
attributes S_printdlgattrib variable into which the event places additional
printing information. This argument is accessed through the
astr_printdlg argument (passed by reference)
pfc_PreRmbMenu
Description User event allowing you to modify m_edit contents before display.
Syntax instancename.EVENT pfc_PreRmbMenu ( editmenu )
289
u_rte
Argument Description
instancename Instance name of u_rte
editmenu M_edit variable containing the popup menu to be displayed
(passed by reference)
Usage You can add logic to this event to selectively enable and disable m_edit menu
items.
pfc_PreviousPage
Description Scrolls to the Previous page.
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects View>Previous Page from the menu bar of a
menu descended from the PFC m_master menu.
pfc_Print
Description Calls the pfc_PrintDlg function and prints the RichTextEdit control, as
specified in the Print dialog box.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is triggered when the RichTextEdit control has focus and the user
selects File>Print from the menu bar of a menu descended from the PFC
m_master menu.
pfc_PrintDlg
Description Initializes the s_printdlgattrib structure with the RichTextEdit control’s current
settings, displays the Print dialog box by calling the n_cst_platform
of_PrintDlg function, and resets the settings, as specified by the user.
Syntax instancename.EVENT pfc_PrintDlg ( attributes )
Argument Description
instancename Instance name of u_rte
attributes S_printdlgattrib variable into which the event places printing
information. This argument is accessed through the astr_printdlg
argument (passed by reference)
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
290
Chapter 6 Standard Visual User Objects
pfc_PrintImmediate
Description Prints the current RichTextEdit control without displaying the Print dialog box.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the RichTextEdit control has focus and the user
selects File>Print Immediate from the menu bar of a menu descended from the
PFC m_master menu.
pfc_PrintPreview
Description Toggles between print preview and edit mode.
Return value Boolean. Returns TRUE if the RichTextEdit control has been placed in
preview mode and FALSE if it has been placed in edit mode.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects File>Print Preview from the menu bar of a menu
descended from the PFC m_master menu.
pfc_ReplaceDlg
Description Displays a Replace dialog box by calling the n_cst_rtefind service’s
pfc_ReplaceDlg event.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called when the user selects View>Replace from the menu bar of
a menu descended from the PFC m_master menu.
pfc_Ruler
Description Toggles display of the ruler and tab bar.
Return value Boolean. Returns TRUE if the ruler has been displayed and FALSE if it has
been hidden.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects View>Ruler from the menu bar of a menu
descended from the PFC m_master menu.
291
u_rte
pfc_Save
Description Saves the current contents of the RichTextEdit control. If the current contents
is not associated with a file, the function displays a dialog box prompting the
user to specify a filename.
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects File>Save from the menu bar of a menu
descended from the PFC m_master menu.
pfc_SaveAs
Description Saves the current contents of the RichTextEdit control, prompting the user to
specify a filename.
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects File>Save As from the menu bar of a menu
descended from the PFC m_master menu.
pfc_SelectAll
Description Selects all text in the RichTextEdit control.
Return value Integer. Returns the number of characters selected if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects Edit>Select All from the menu bar of a menu
descended from the PFC m_master menu.
pfc_Undo
Description Cancels the last change to the RichTextEdit control, restoring the text to the
content before the last change.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when a RichTextEdit control based on u_rte
has focus and the user selects Edit>Undo from the menu bar of a menu
descended from the PFC m_master menu.
292
Chapter 6 Standard Visual User Objects
PrintHeader
Description Sets page numbers for printing.
Usage This event executes when you print the RichTextEdit control.
RButtonUp
Description Displays the m_edit popup menu.
Usage This event executes when the user releases the right mouse button over a
control based on u_rte.
Functions
U_rte includes precoded object functions:
of_GetContinuousPages of_SetFileName
of_GetFileName of_SetFind
of_GetIgnoreFileExists of_SetIgnoreFileExists
of_GetPageInputField of_SetPageInputField
of_GetParentWindow of_SetStartPageNumber
of_GetStartPageNumber of_SetTextStyleBold
of_GetTextStyle of_SetTextStyleItalic
of_InsertDocument of_SetTextStyleStrikeout
of_InsertPicture of_SetTextStyleSubscript
of_MessageBox of_SetTextStyleSuperscript
of_OpenDocument of_SetTextStyleUnderline
of_SetContinuousPages
of_GetContinuousPages
Description Reports whether PFC uses continuous page numbering when the RichTextEdit
control is shared to a DataWindow.
Access Public
Syntax instancename.of_GetContinuousPages ( )
Argument Description
instancename Instance name of u_rte
293
u_rte
Return value Boolean. Returns TRUE if continuous page numbering is enabled and FALSE
if it is not.
Examples This example calls the of_GetContinuousPages function:
IF rte_doc.of_GetContinuousPages() THEN
MessageBox("RTE", &
"Continuous page numbering is enabled")
ELSE
MessageBox("RTE", &
"Continuous page numbering is disabled")
END IF
of_GetFileName
Description Retrieves the name of the file associated with the RichTextEdit control.
Access Public
Syntax instancename.of_GetFileName ( )
Argument Description
instancename Instance name of u_rte
Return value String. Returns the current filename or an empty string if one has not been set
with the of_SetFilename function.
Examples This example calls the of_GetFileName function:
String ls_filename
ls_filename = rte_doc.of_GetFileName()
MessageBox("RTE", "Filename is " + ls_filename)
of_GetIgnoreFileExists
Description Reports whether PFC displays a message before overwriting an existing file.
Access Public
Syntax instancename.of_GetIgnoreFileExists ( )
Argument Description
instancename Instance name of u_rte
Return value Boolean. Returns TRUE if PFC displays no message before overwriting an
existing file and FALSE if PFC prompts the user before overwriting an existing
file.
294
Chapter 6 Standard Visual User Objects
of_GetPageInputField
Description Retrieves the name of the field PFC uses to place the page number.
Access Public
Syntax instancename.of_GetPageInputField ( )
Argument Description
instancename Instance name of u_rte
Return value String. Returns the name of the field PFC uses to place the page number.
Examples This example calls the of_GetPageInputField function:
String ls_field
ls_field = rte_doc.of_GetPageInputField( )
MessageBox("RTE", "Page input field is " + ls_field)
of_GetParentWindow
Description Returns the parent of the current window.
Access Public
Syntax instancename.of_GetParentWindow ( parent )
Argument Description
instancename Instance name of u_rte
parent Window variable into which the function places the parent of the
current window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the GetFocus event.
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
295
u_rte
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_GetStartPageNumber
Description Retrieves the number of the page on which page numbers are initially
displayed. For example, if this value is 3, the first two pages do not display
page numbers and the third page displays a 3.
Access Public
Syntax instancename.of_GetStartPageNumber ( )
Argument Description
instancename Instance name of u_rte
Return value Long. Returns the number of the page upon which page numbers are initially
displayed
Examples This example calls the of_GetStartPageNumber function:
Long ll_return
ll_return = rte_doc.of_GetStartPageNumber()
MessageBox("RTE", &
"Start page number is " + String(ll_return))
of_GetTextStyle
Description Calculates all text style settings for the currently selected text.
Access Public
Syntax instancename.of_GetTextStyle ( textstyle )
Argument Description
instancename Instance name of u_rte
textstyle N_cst_textstyleattrib instance into which the function places text
style settings (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to determine text style settings for the currently selected text.
296
Chapter 6 Standard Visual User Objects
of_InsertDocument
Description Displays the Insert File dialog box, prompting the user for the name of the file
to copy into the current document, placing it at the current insertion point.
Access Public
Syntax instancename.of_InsertDocument ( filename )
Argument Description
instancename Instance name of u_rte
filename String into which the function places the fully qualified name of
the file inserted into the document
Return value Integer. Returns 1 if the function succeeds, 0 if the user cancels out of the
dialog box, and -1 if an error occurs.
Examples This example calls the of_InsertDocument function:
Integer li_return
String ls_filename
297
u_rte
li_return = rte_doc.of_InsertDocument(ls_filename)
IF li_return = -1 THEN
MessageBox("RTE", "Insert file error")
ELSE
gnv_app.of_GetFrame().SetMicroHelp &
("Inserted file: " + String(ls_filename))
END IF
of_InsertPicture
Description Displays the Insert Picture dialog box, prompting the user for the name of the
bitmap to copy into the current document, placing it at the current insertion
point.
Access Public
Syntax instancename.of_InsertPicture ( bitmap )
Argument Description
instancename Instance name of u_rte
bitmap String into which the function places the fully qualified name of
the bitmap inserted into the document
Return value Integer. Returns 1 if the function succeeds, 0 if the user cancels out of the
dialog box, and -1 if an error occurs.
Examples This example calls the of_InsertPicture function:
Integer li_return
String ls_filename
li_return = rte_doc.of_InsertPicture(ls_filename)
IF li_return = -1 THEN
MessageBox("RTE", "Insert file error")
ELSE
gnv_app.of_GetFrame().SetMicroHelp &
("Inserted file: " + String(ls_filename))
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
298
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_rte
id String specifying an ID for the message
title String specifying the title of the RichTexEdit control
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in RichTextEdit
controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’rte_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
299
u_rte
of_OpenDocument
Description Displays the Open dialog box, prompting the user for the name of the file to
place into the RichTextEdit control. This function prompts you before
discarding the control’s current contents.
Access Public
Syntax instancename.of_OpenDocument ( filename )
Argument Description
instancename Instance name of u_rte
filename String into which the function places the fully qualified name of
the selected file
Return value Integer. Returns 1 if the function succeeds, 0 if the user cancels out of the
dialog box, and -1 if an error occurs.
Examples This example calls the of_OpenDocument function:
String ls_filename
Integer li_return
li_return = rte_doc.of_OpenDocument(ls_filename)
IF li_return = -1 THEN
MessageBox("RTE", "File open error")
Return
END IF
of_SetContinuousPages
Description Specifies whether PFC uses continuous page numbering when the
RichTextEdit control is shared to a DataWindow.
Access Public
Syntax instancename.of_SetContinuousPages ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean specifying whether continuous page numbering is
used (TRUE) or not (FALSE)
300
Chapter 6 Standard Visual User Objects
of_SetFileName
Description Specifies the name of the file associated with the RichTextEdit control.
Access Public
Syntax instancename.of_SetFileName ( filename )
Argument Description
instancename Instance name of u_rte
filename String specifying the fully qualified name of the file displayed in
the RichTextEdit control
li_return = rte_doc.of_InsertDocument(ls_filename)
IF li_return = -1 THEN
MessageBox("RTE", "Insert file error")
ELSE
rte_doc.of_SetFileName(ls_filename)
END IF
of_SetFind
Description Enables or disables n_cst_rtefind, which provides the find and replace service.
Access Public
Syntax instancename.of_SetFind ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the find and replace service
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_rtefind. This instance
is named inv_find.
301
u_rte
Examples This example calls the of_SetFind function to enable the RichTextEdit find and
replace service:
rte_doc.of_SetFind(TRUE)
of_SetIgnoreFileExists
Description Specifies whether PFC displays a message before overwriting an existing file.
Access Public
Syntax instancename.of_SetIgnoreFileExists ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean specifying whether PFC displays a message before
overwriting an existing file (TRUE) or not (FALSE)
li_return = &
rte_doc.of_OpenDocument(ls_filename)
IF li_return = -1 THEN
MessageBox("RTE", "File open error")
Return
ELSE
rte_doc.of_SetIgnoreFileExists(TRUE)
END IF
of_SetPageInputField
Description Specifies the name of the field PFC uses to place the page number.
Access Public
Syntax instancename.of_SetPageInputField ( )
Argument Description
instancename Instance name of u_rte
302
Chapter 6 Standard Visual User Objects
rte_doc.of_SetContinuousPages(TRUE)
rte_doc.of_SetPageInputField("PAGE NUMBER")
rte_doc.of_SetStartPageNumber(2)
of_SetStartPageNumber
Description Specifies the number of the page upon which page numbers are initially
displayed. For example, if this value is 3, the first two pages do not display
page numbers and the third page displays a 3.
Access Public
Syntax instancename.of_SetStartPageNumber ( firstpage )
Argument Description
instancename Instance name of u_rte
firstpage Long specifying the number of the page upon which page
numbers are initially displayed
of_SetTextStyleBold
Description Sets the currently selected text to bold, leaving all other text attributes as they
were.
Access Public
Syntax instancename.of_SetTextStyleBold ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean indicating whether to add the bold attribute (TRUE) or
remove it (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetTextStyleBold function:
Integer li_return
li_return = rte_doc.of_SetTextStyleBold(TRUE)
303
u_rte
IF li_return = -1 THEN
MessageBox("RTE","Error setting text style")
END IF
of_SetTextStyleItalic
Description Sets the currently selected text to italic, leaving all other text attributes as they
were.
Access Public
Syntax instancename.of_SetTextStyleItalic ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean indicating whether to add the italic attribute (TRUE) or
remove it (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetTextStyleItalic function:
Integer li_return
li_return = rte_doc.of_SetTextStyleItalic(TRUE)
IF li_return = -1 THEN
MessageBox("RTE","Error setting text style")
END IF
of_SetTextStyleStrikeout
Description Sets the currently selected text to strikeout, leaving all other text attributes as
they were.
Access Public
Syntax instancename.of_SetTextStyleStrikeout ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean indicating whether to add the strikeout attribute (TRUE)
or remove it (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
304
Chapter 6 Standard Visual User Objects
li_return = rte_doc.of_SetTextStyleStrikeout(TRUE)
IF li_return = -1 THEN
MessageBox("RTE","Error setting text style")
END IF
of_SetTextStyleSubscript
Description Sets the currently selected text to subscript, leaving all other text attributes as
they were.
Access Public
Syntax instancename.of_SetTextStyleSubscript ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean indicating whether to add the subscript attribute (TRUE)
or remove it (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetTextStyleSubscript function:
Integer li_return
li_return = rte_doc.of_SetTextStyleSubscript(TRUE)
IF li_return = -1 THEN
MessageBox("RTE","Error setting text style")
END IF
of_SetTextStyleSuperscript
Description Sets the currently selected text to superscript, leaving all other text attributes as
they were.
Access Public
Syntax instancename.of_SetTextStyleSuperscript ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean indicating whether to add the superscript attribute
(TRUE) or remove it (FALSE)
305
u_rte
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetTextStyleSuperscript function:
Integer li_return
li_return = rte_doc.of_SetTextStyleSuperscript(TRUE)
IF li_return = -1 THEN
MessageBox("RTE","Error setting text style")
END IF
of_SetTextStyleUnderline
Description Sets the currently selected text to underline, leaving all other text attributes as
they were.
Access Public
Syntax instancename.of_SetTextStyleUnderline ( boolean )
Argument Description
instancename Instance name of u_rte
boolean Boolean indicating whether to add the underline attribute
(TRUE) or remove it (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetTextStyleUnderline function:
Integer li_return
li_return = rte_doc.of_SetTextStyleUnderline(TRUE)
IF li_return = -1 THEN
MessageBox("RTE","Error setting text style")
END IF
306
Chapter 6 Standard Visual User Objects
u_sle
Description SingleLineEdit visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
SingleLineEdit control. U_sle event scripts provide integration with PFC
menus. Additionally, u_sle supports:
• Cut, copy, paste, clear, and select all These events are called by PFC
menus.
• Popup menu support The ContextMenu event enables you to use the
right mouse button to perform editing actions. To disable right mouse
button support, set ib_rmbmenu to FALSE in the SingleLineEdit’s
Constructor event.
• Autoselect This means that text is selected when a user tabs to the edit
mask. To disable autoselect, set ib_autoselect to FALSE in the
SingleLineEdit’s Constructor event.
See also u_mle
307
u_sle
Instance variables
U_sle includes instance variables:
Instance variable Description Data type Access Usage
ib_autoselect Indicates whether PFC Boolean Protected Set this to TRUE to enable
selects text automatically autoselect (default is FALSE)
when the control receives
focus
ib_rmbmenu Indicates whether the Boolean Protected Set this to FALSE to disable
m_edit menu displays right mouse button support
when the user presses the (default is TRUE)
right mouse button
Events
U_sle includes precoded events:
ContextMenu pfc_Paste
GetFocus pfc_PreRmbMenu
pfc_Clear pfc_SelectAll
pfc_Copy pfc_Undo
pfc_Cut RButtonUp
ContextMenu
Description Displays the m_edit popup menu.
Usage This event executes when the user releases the right mouse button over a
control based on u_sle.
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
pfc_Clear
Description Deletes selected text.
Return value Integer. Returns the number of characters deleted if the event succeeds and -1
if an error occurs.
308
Chapter 6 Standard Visual User Objects
Usage This event is triggered when a SingleLineEdit control based on u_sle has focus
and the user selects Edit>Clear from the menu bar of a menu descended from
the PFC m_master menu.
pfc_Copy
Description Copies selected text to the clipboard.
Return value Integer. Returns the number of characters copied if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a SingleLineEdit control based on
u_sle has focus and the user selects Edit>Copy from the menu bar of a menu
descended from the PFC m_master menu. This event is also called by the
m_edit popup menu.
pfc_Cut
Description Deletes selected text and stored it on the clipboard.
Return value Integer. Returns the number of characters removed if the event succeeds and -
1 if an error occurs.
Usage The message router calls this event when a SingleLineEdit control based on
u_sle has focus and the user selects Edit>Cut from the menu bar of a menu
descended from the PFC m_master menu. This event is also called by the
m_edit popup menu.
pfc_Paste
Description Inserts (pastes) the contents of the clipboard at the insertion point.
Return value Integer. Returns the number of characters that were pasted if the event succeeds
and -1 if an error occurs.
Usage The message router calls this event when a SingleLineEdit control based on
u_sle has focus and the user selects Edit>Paste from the menu bar of a menu
descended from the PFC m_master menu. This event is also called by the
m_edit popup menu.
pfc_PreRmbMenu
Description User event allowing you to modify m_edit contents prior to display.
Syntax instancename.EVENT pfc_PreRmbMenu ( editmenu )
309
u_sle
Argument Description
instancename Instance name of u_sle
editmenu M_edit variable containing the popup menu to be displayed
(passed by reference)
Usage You can add logic to this event to selectively enable and disable m_edit menu
items.
pfc_SelectAll
Description Selects all text in the SingleLineEdit.
Return value Integer. Returns the number of characters selected if the event succeeds and -1
if an error occurs.
Usage The message router calls this event when a SingleLineEdit control based on
u_sle has focus and the user selects Edit>Select All from the menu bar of a
menu descended from the PFC m_master menu. This event is also called by the
m_edit popup menu.
pfc_Undo
Description Cancels the last change to the SingleLineEdit control, restoring the text to the
content before the last change.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when a SingleLineEdit control based on
u_sle has focus and the user selects Edit>UndoAll from the menu bar of a menu
descended from the PFC m_master menu.
RButtonUp
Description Empty user event. PFC code previously assigned to this event is now in the
ContextMenu event.
Usage This event executes when the user releases the right mouse button over a
control based on u_sle.
Functions
U_sle includes precoded object functions:
310
Chapter 6 Standard Visual User Objects
of_GetParentWindow
of_MessageBox
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_sle
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_sle GetFocus event calls this function.
Examples This example is from the u_sle GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_sle
id String specifying an ID for the message
title String specifying the title of the SingleLineEdit
message String specifying the message text
311
u_sle
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in SingleLineEdits.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’sle_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
312
Chapter 6 Standard Visual User Objects
u_st
Description StaticText visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
StaticText control. U_st event scripts provide integration with PFC menus.
Descendants u_st_splitbar
See also u_mle
u_sle
u_sth
Events
U_st includes one precoded event:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
313
u_st
Functions
U_st includes precoded object functions:
of_GetParentWindow
of_MessageBox
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_st
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_st GetFocus event calls this function.
Examples This example is from the u_st GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_st
id String specifying an ID for the message
314
Chapter 6 Standard Visual User Objects
Argument Description
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in StaticText controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’st_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
315
u_sth
u_sth
Description StaticTextHyperlink visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
StaticTextHyperlink control. U_sth event scripts provide integration with PFC
menus.
See also u_phl
u_st
Events
U_sth includes one precoded event:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_sth includes precoded object functions:
of_GetParentWindow
of_MessageBox
316
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_sth
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_sth GetFocus event calls this function.
Examples This example is from the u_sth GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_sth
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
317
u_sth
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in StaticTextHyperlink
controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’sth_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
318
Chapter 6 Standard Visual User Objects
u_tab
Description Tab control visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use descendants of this visual user object in the User Object painter instead of
the visual standard tab user object. Using the User Object painter, add u_tabpg-
based tab pages, coding events and functions as needed.
U_tab is a self-updating object.
You typically do not place this object directly into the Window painter.
See also n_cst_resize
u_tabpg
Instance variables
U_tab includes instance variables:
Instance variable Description Data type Access Usage
ib_alwaysvalidate Controls whether the Boolean Protected Set with of_SetAlwaysValidate
save process includes (default is FALSE)
all objects in the
validation process
ib_isupdateable Indicates whether the Boolean Protected Set with of_SetUpdateable
Tab control can be (default is FALSE)
updated
319
u_tab
Events
U_tab includes a precoded event:
pfc_AcceptText pfc_UpdatesPending
pfc_PostUpdate pfc_Validation
pfc_Update Resize
pfc_UpdatePrep
pfc_AcceptText
Description Calls the n_cst_luw of_AcceptText function.
Syntax instancename.Event pfc_AcceptText ( controls, focusonerror )
Argument Description
instancename Instance name of u_tab
controls PowerObject array containing the objects on which to accept text.
This argument is accessed through the apo_control argument
focusonerror Boolean indicating whether focus should be set if an error occurs.
This argument is accessed through the ab_focusonerror argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The of_AcceptText function calls this event.
320
Chapter 6 Standard Visual User Objects
pfc_PostUpdate
Description Calls the n_cst_luw of_PostUpdate function.
Syntax instancename.Event pfc_PostUpdate ( controls )
Argument Description
instancename Instance name of u_tab
controls PowerObject array containing the objects on which to perform
post-update processing. This argument is accessed through the
apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Internal.
pfc_Update
Description Calls the n_cst_luw of_Update function to update the specified controls.
Syntax instancename.Event pfc_Update ( controls, accepttext, resetflags )
Argument Description
instancename Instance name of u_tab
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
accepttext Boolean specifying whether n_cst_luw should automatically
perform an AcceptText prior to performing the Update (TRUE) or
not (FALSE)
resetflags Boolean specifying whether n_cst_luw should automatically reset
DataWindow update flags (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The of_Update function calls this event.
pfc_UpdatePrep
Description Calls the n_cst_luw of_UpdatePrep function.
Syntax instancename.Event pfc_UpdatePrep ( controls )
Argument Description
instancename Instance name of u_tab
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
321
u_tab
Return value Long. Return 1 if the update preparation succeeds and -1 to halt the update
process.
Usage The of_UpdatePrep function calls this function.
pfc_UpdatesPending
Description Calls the n_cst_luw of_GetUpdatesPending function.
Syntax instancename.Event pfc_UpdatesPending ( controls, pending )
Argument Description
instancename Instance name of u_tab
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
pending PowerObject array into which the event places objects with
pending updates. This argument is accessed through the
apo_pending argument (passed by reference)
Return value Integer. Returns 1 if there are pending updates, 0 if there are no pending
updates, and -1 if an error occurs.
Usage This event is called by the of_GetUpdatesPending function.
pfc_Validation
Description Calls the n_cst_luw of_Validation function.
Syntax instancename.Event pfc_Validation ( controls )
Argument Description
instancename Instance name of u_tab
controls PowerObject array containing the objects to validate. This
argument is accessed through the apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the of_Validation function.
Resize
Description Triggers automatic resize processing, if enabled in n_cst_resize.
Usage This event executes when the user resizes the window.
322
Chapter 6 Standard Visual User Objects
Functions
U_tab includes precoded object functions:
of_AcceptText of_SetLogicalUnitOfWork
of_GetInfo of_SetResize
of_GetParentWindow of_SetUpdateable
of_GetUpdateObjects of_SetUpdateObjects
of_IsAlwaysValidate of_SetUpdateRequestor
of_IsUpdateable of_Update
of_MessageBox of_UpdatePrep
of_PostUpdate of_UpdatesPending
of_SetAlwaysValidate of_Validation
of_AcceptText
Description Performs an AcceptText function for controls on the tab’s tab pages.
Access Public
Syntax instancename.of_AcceptText ( focusonerror )
Argument Description
instancename Instance name of u_tab
focusonerror Boolean indicating whether PFC sets focus to the first item in
error when an error occurs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize accept text processing,
extend the pfc_AcceptText event.
Examples This example is from the n_cst_luw of_AcceptText function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_AcceptText &
(ab_focusonerror)
If li_rc < 0 Then Return -1
...
323
u_tab
of_GetInfo
Description Retrieves object information.
Access Public
Syntax instancename.of_GetInfo ( infoobject )
Argument Description
instancename Instance name of u_tab
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
tab_1.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetParentWindow
Description Returns a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_tab
window Window variable into which the function places a reference to the
parent window
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage Call this function from within a tab to determine the parent window.
Examples This example calls the of_GetParentWindow function:
Window lw_parent
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
... // Continue processing
END IF
324
Chapter 6 Standard Visual User Objects
of_GetUpdateObjects
Description Retrieves the current default array of objects affected by the update process.
Access Protected
Syntax instancename.of_GetUpdateObjects ( objects )
Argument Description
instancename Instance name of u_tab
objects PowerObject array into which the function places objects to be
updated (passed by reference)
Return value Integer. Returns the number of elements in the objects array if the function
succeeds and -1 if an error occurs.
Examples This example calls the of_GetUpdateObjects function:
PowerObject lpo_objs[ ]
Integer li_return, li_count
li_return = this.of_GetUpdateObjects(lpo_objs)
FOR li_count = 1 to li_return
IF lpo_objs[li_count] = ids_data THEN
Return 1
END IF
NEXT
li_return++
lpo_objs[li_return] = ids_data
Return this.of_SetUpdateObjects(lpo_objs)
of_IsAlwaysValidate
Description Reports whether the default save process always performs validation,
regardless of whether objects have updates pending.
Access Public
Syntax instancename.of_IsAlwaysValidate ( )
Argument Description
instancename Instance name of u_tab
Return value Boolean. Returns TRUE if the default save process always performs validation
and FALSE if it does not.
Examples This example calls the of_IsAlwaysValidate function:
IF tab_1.of_IsAlwaysValidate() = TRUE THEN
MessageBox("Tab", "Always validate")
325
u_tab
ELSE
MessageBox("Tab", "Sometimes validate")
END IF
of_IsUpdateable
Description Reports whether controls on the Tab control’s tab pages are updatable.
Access Public
Syntax instancename.of_IsUpdateable ( )
Argument Description
instancename Instance name of u_tab
Return value Boolean. Returns TRUE if controls are updatable and FALSE if they is not.
Examples This example is from the pfc_UpdatesPending event:
...
If Not of_IsUpdateable() Then Return NO_UPDATESPENDING
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_tab
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
326
Chapter 6 Standard Visual User Objects
Argument Description
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Tab controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’tab_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
of_PostUpdate
Description Calls the pfc_PostUpdate event, which clears update flags and allows you to
code additional post update processing.
Access Public
Syntax instancename.of_PostUpdate ( )
Argument Description
instancename Instance name of u_tab
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage To customize post update processing, extend the pfc_PostUpdate event.
N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize post-update processing,
extend the pfc_PostUpdate event.
327
u_tab
of_SetAlwaysValidate
Description Specifies whether the default save process always performs validation,
regardless of whether there are pending updates.
Access Public
Syntax instancename.of_SetAlwaysValidate ( boolean )
Argument Description
instancename Instance name of u_tab
boolean Boolean specifying whether the default save process always
perform validation (TRUE) or only performs validation if a
control has pending updates (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAlwaysValidate function:
tab_1.of_SetAlwaysValidate(TRUE)
of_SetLogicalUnitOfWork
Description Enables or disables n_cst_luw, which provides the logical unit of work service.
Access Public
Syntax instancename.of_SetLogicalUnitOfWork ( boolean )
Argument Description
instancename Instance name of u_tab
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) n_cst_luw
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_luw. This instance is
named inv_luw. If you do not enable n_cst_luw, u_tab enables it automatically.
328
Chapter 6 Standard Visual User Objects
of_SetResize
Description Enables or disables n_cst_resize, the resize service.
Access Public
Syntax instancename.of_SetResize ( boolean )
Argument Description
instancename Instance name of u_tab
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) an instance of n_cst_resize
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_resize. This instance
is named inv_resize.
Examples This example calls the of_SetResize function in a window Open event to
enable the resize service for tab_1:
tab_1.of_SetResize(TRUE)
of_SetUpdateable
Description Specifies whether the Tab is updatable.
Access Public
Syntax instancename.of_SetUpdateable ( boolean )
Argument Description
instancename Instance name of u_tab
boolean Boolean indicating whether the Tab is updatable. All updatable
Tabs are included in the default save processing
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetUpdateable function:
tab_1.of_SetUpdateable(FALSE)
of_SetUpdateObjects
Description Sets a new default array containing objects for which updates are attempted.
329
u_tab
Access Protected
Syntax instancename.of_SetUpdateObjects ( requester )
Argument Description
instancename Instance name of u_tab
requester PowerObject array containing the object to be updated
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
of_SetUpdateRequestor
Description Creates a reference to the object requesting an update within a logical unit of
work.
Access Public
Syntax instancename.of_SetUpdateRequestor ( requester )
Argument Description
instancename Instance name of u_tab
requester PowerObject containing the object requesting the update
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_Update function:
...
If IsValid(inv_luw) Then
inv_luw.of_SetUpdateRequestor(apo_requestor)
End If
...
of_Update
Description Calls the pfc_Update event.
Access Public
Syntax instancename.of_Update ( accept, resetflag {, requestor} )
Argument Description
instancename Instance name of u_tab
accept Boolean indicating whether the Update function performs an
AcceptText before saving rows to the database
330
Chapter 6 Standard Visual User Objects
Argument Description
resetflag Boolean indicating whether the Update function resets the update
flags
requestor PowerObject containing the requestor object
Return value Integer. Returns 1 if the update succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update processing, extend
the pfc_Update event.
Examples This example is from the n_cst_luw of_Update function:
...
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Update &
(ab_accepttext, ab_resetflag, &
lpo_updaterequestor)
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatePrep
Description Calls the pfc_UpdatePrep event.
Access Public
Syntax instancename.of_UpdatePrep ( )
Argument Description
instancename Instance name of u_tab
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update preparation
processing, extend the pfc_UpdatePrep event.
Examples This example is from the n_cst_luw of_UpdatePrep function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_UpdatePrep ()
If li_rc < 0 Then Return -1
Continue
331
u_tab
End If
...
of_UpdatesPending
Description Calls the pfc_UpdatesPending event.
Access Public
Syntax instancename.of_UpdatesPending ( )
Argument Description
instancename Instance name of u_tab
of_Validation
Description Calls the pfc_Validation event.
Access Public
Syntax instancename.of_Validation ( )
Argument Description
instancename Instance name of u_tab
Return value Integer. Returns 1 if the function succeeds and -1 if a validation error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize validation processing,
extend the pfc_Validation event.
332
Chapter 6 Standard Visual User Objects
333
u_tvs
u_tvs
Description Service-based TreeView visual user object ancestor. This object uses
DataStores to display data in a TreeView.
U_tvs is a self-updating object.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master. U_tvs also uses:
m_tv
n_cst_infoattrib
n_ds
n_cst_luw
n_cst_tvsrv
n_cst_tvsrv_levelsource
n_cst_print
334
Chapter 6 Standard Visual User Objects
Usage Use this visual user object in windows instead of the standard PowerBuilder
TreeView control. U_tvs event scripts provide integration with PFC menus.
To use u_tvs:
1 Place a u_tvs user object in your window.
2 Enable TreeView services as needed:
this.of_SetPrint(TRUE)
this.of_SetLevelSource(TRUE)
this.of_SetBase(TRUE)
3 Specify the data source for each TreeView level:
String ls_sql
Integer li_return
ls_keys[1] = "dept_id"
this.inv_levelsource.of_Register(1, &
"dept_name", "", "d_deptlist", SQLCA, "")
ls_keys[1] = "emp_id"
this.inv_levelsource.of_Register(2, &
"emp_lname", ":parent.1.dept_id", &
"d_empbydept", SQLCA, "")
4 Specify additional TreeView display information as needed:
this.inv_levelsource.of_SetPictureColumn(1, "1")
this.inv_levelsource.of_SetSelectedPictureColumn &
(1, "2")
this.inv_levelsource.of_SetPictureColumn(2, "4")
this.inv_levelsource.of_SetSelectedPictureColumn &
(2, "5")
5 Retrieve rows for the first level of the TreeView:
this.event pfc_populate(0)
6 Extend the pfc_Retrieve event to implement retrieval arguments:
Any la_args[20]
Integer li_level
IF IsValid(inv_levelsource) THEN
li_level = this.of_GetNextLevel(al_parent)
this.inv_levelsource.of_GetArgs(al_parent, &
li_level, la_args)
END IF
335
u_tvs
Instance variables
U_tvs includes instance variables:
Instance variable Description Data type Access Usage
ib_alwaysvalidate Controls whether the Boolean Protected Set with
save process includes of_SetAlwaysValidate
all objects in the (default is FALSE)
validation process
ib_isupdateable Indicates whether the Boolean Protected Set with
TreeView can be of_SetUpdateable
updated (default is FALSE)
ib_rmbmenu Controls right mouse Boolean Protected Set with of_SetRmbMenu
button support
il_dragsource Handle of the dragged Long Public PFC uses this instance
item variable to track a dragged
TreeView item
il_dragtarget Handle of drag target Long Public PFC uses this instance
variable to track a dragged
TreeView item
il_rightclicked Item clicked with the Long Protected Internal
right mouse button
im_view Popup menu m_tvs Protected Internal
inv_base Reference variable for n_cst_tvsrv Public Use in dot notation to
basic TreeView access n_cst_tvsrv
services functions and attributes
336
Chapter 6 Standard Visual User Objects
Events
U_tvs includes precoded events:
BeginDrag pfc_PreRefreshItem
Destructor pfc_PreRefreshLevel
DragDrop pfc_PreRmbMenu
EndLabelEdit pfc_Properties
GetFocus pfc_RefreshItem
KeyDown pfc_RefreshLevel
ItemExpanding pfc_RenameItem
pfc_AcceptText pfc_Retrieve
pfc_AddAll pfc_SearchCompare
pfc_AddItem pfc_SetItemAttributes
pfc_DeleteItem pfc_Undo
pfc_InsertItem pfc_Update
pfc_NewItem pfc_UpdatePrep
pfc_Populate pfc_UpdatesPending
pfc_PostUpdate pfc_Validation
pfc_PreDeleteItem RightClicked
pfc_PreInsertItem
337
u_tvs
BeginDrag
Description Saves the handle of a dragged item in the il_dragsource public instance
variable.
Usage This event executes when the user drags a label.
Destructor
Description Destroys all enabled service objects.
Usage This event executes when the TreeView is destroyed or the window closes.
DragDrop
Description Saves the handle of the dropped item in the il_dragtarget instance variable.
Usage This event executes when the user releases a dragged object over the TreeView.
You should extend this event to allow dragging and dropping of TreeView
items from one branch to another. Be sure to verify that the drag source is the
current TreeView control.
EndLabelEdit
Description Updates the DataStore with user edits to the item label.
This function updates the DataStore only. You must update the database
explicitly, using the of_Update function or the w_master pfc_Save process.
Usage This event executes when the user finishes editing an item label.
If you are using computed columns to display item labels, override this event
to update DataStore rows as appropriate.
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event executes when the control receives focus. It triggers the
pfc_ControlGotFocus event in the parent.
KeyDown
Description Checks to see if the DELETE key was pressed.
Usage This event executes when the user presses a key and is not editing a label.
338
Chapter 6 Standard Visual User Objects
ItemExpanding
Description Populates an item with its children.
Usage This event executes when the user expands an item.
pfc_AcceptText
Description Accepts text for the data displayed in a TreeView control, optionally setting
focus if an error occurs.
Syntax instancename.EVENT pfc_AcceptText ( controls, focusonerror )
Argument Description
instancename Instance name of u_tvs
controls PowerObject array containing the objects on which to accept text.
This argument is accessed through the apo_control argument
focusonerror Boolean indicating whether focus should be set if an error occurs.
This argument is accessed through the ab_focusonerror argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Extend this event to perform additional accept text processing.
pfc_AddAll
Description Adds all rows in the passed DataStore under the specified TreeView item.
Syntax instancename.EVENT pfc_AddAll ( parent, data )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which
the new items are added. This argument is accessed through the
al_parent argument
data N_ds-based DataStore containing rows to be added. This
argument is accessed through the ads_source argument
Return value Long. Returns the number of items added if the event succeeds and -1 if an
error occurs.
Examples This example is from the of_Populate function:
...
Return this.event pfc_AddAll(al_parent, lds_data)
...
339
u_tvs
pfc_AddItem
Description Adds the specified row as the last item under the specified parent.
Syntax instancename.EVENT pfc_AddItem ( parent, data, row )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which
the new item is added. This argument is accessed through the
al_parent argument
data N_ds-based DataStore containing the row to be added. This
argument is accessed through the ads_source argument
row Long specifying the row containing the data to be added to the
TreeView. This argument is accessed through the al_row
argument
Return value Long. Returns the handle of the new item if the event succeeds and -1 if an
error occurs.
Examples This example is from the of_AddItem function:
...
ll_newindex = this.event pfc_additem &
(al_parent, lds_datastore, ll_row)
...
pfc_DeleteItem
Description Deletes the selected item from the TreeView and the DataStore.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Examples This example calls the pfc_DeleteItem event:
...
li_return = tv_1.Event pfc_DeleteItem()
...
pfc_InsertItem
Description Inserts a new item into the TreeView.
Syntax instancename.EVENT pfc_InsertItem ( parent, datastore, row, position,
item )
Argument Description
instancename Instance name of u_tvs
340
Chapter 6 Standard Visual User Objects
Argument Description
parent Long specifying the handle of the TreeView item under which the
new item is added. This argument is accessed through the al_parent
argument
datastore N_ds containing the data for the new item. This can be either the
DataStore maintained by n_cst_tvsrv_levelsource or another
DataStore. If this is another DataStore, the associated DataWindow
objects must be the same and the function also adds the row to the
DataStore maintained by n_cst_tvsrv_levelsource. This argument is
accessed through the ads_source argument
row Long specifying the row containing the item to be inserted. This
argument is accessed through the al_row argument
position String specifying the position under the current parent in which to
insert the new item Values are:
• First
• Last
• Sort
• After
This argument is accessed through the as_position argument
item Long containing the handle to the item before the item to be
inserted. The function uses this argument if you specify After for
position. This argument is accessed through the al_handle argument
Return value Integer. Returns the handle of the new item if the function succeeds and -1 if
an error occurs.
Usage This event calls the pfc_SetItemAttributes and pfc_PreInsertItem events before
inserting the item.
Examples This example is from the pfc_AddAll event:
...
For ll_row = 1 to ll_rowcount
If this.event pfc_insertitem(al_parent, &
ads_source, ll_row, "last", 0) < 1 then
Return -1
End If
ll_count++
...
pfc_NewItem
Description Empty user event that you extend to add information to both the data source
and the TreeView.
341
u_tvs
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage You typically use this event to open a dialog box prompting the user for
complete information, adding it to the data source and the TreeView (via the
n_cst_tvsrv_levelsource of_InsertItem function) when it closes.
pfc_Populate
Description Retrieves the data source and uses it to populate the TreeView as children of
the specified parent.
Syntax instancename.EVENT pfc_Populate ( parent )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which
the new items are added. This argument is accessed through the
al_parent argument
Return value Long. Returns the number of items added if the event succeeds and -1 if an
error occurs.
Usage You must also add code to the pfc_Retrieve event.
Examples This example is from the ItemExpanding event:
...
If This.FindItem(ChildTreeItem!, handle) = -1 Then
if this.GetItem(handle, ltvi_This) = 1 then
li_rc = this.event pfc_Populate(handle)
If li_rc < 1 Then
...
pfc_PostUpdate
Description Calls the n_cst_luw of_PostUpdate function to perform post-update processing
on the specified controls.
Syntax instancename.EVENT pfc_PostUpdate ( controls )
Argument Description
instancename Instance name of u_tvs
controls PowerObject array containing the objects on which to perform
post-update processing. This argument is accessed through the
apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
342
Chapter 6 Standard Visual User Objects
pfc_PreDeleteItem
Description Empty user event to which you add logic to perform pre-delete processing.
Syntax instancename.EVENT pfc_PreDeleteItem ( handle )
Argument Description
instancename Instance name of u_tvs
handle Long specifying the handle of the TreeView item to be deleted.
This argument is accessed through the al_handle argument
pfc_PreInsertItem
Description Empty user event to which you add logic to perform pre-insert processing.
Syntax instancename.EVENT pfc_PreInsertItem ( parent, data, row, tvitem )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which the
new item is added. This argument is accessed through the
al_parent argument
data N_ds containing the data for the new item. This argument is
accessed through the ads_obj argument
row Long specifying the row containing the new item. This argument
is accessed through the al_row argument
tvitem TreeViewItem to be inserted. This argument is accessed through
the atvi_item argument (passed by reference)
pfc_PreRefreshItem
Description Empty user event to which you add logic that changes properties before a
TreeView item is refreshed.
Syntax instancename.EVENT pfc_PreRefreshItem ( handle, data, row, tvitem )
Argument Description
instancename Instance name of u_tvs
343
u_tvs
Argument Description
handle Long specifying the handle of the TreeView item to be
refreshed. This argument is accessed through the al_handle
argument
data N_ds containing the data for the refreshed item. This argument
is accessed through the ads_obj argument
row Long specifying the row containing the refreshed item. This
argument is accessed through the al_row argument
tvitem TreeViewItem to be refreshed. This argument is accessed
through the atvi_item argument (passed by reference)
Usage The pfc_RefreshItem event calls this event. The code you add here will likely
be the same as code you add to pfc_PreInsertItem.
pfc_PreRefreshLevel
Description Empty user event to which you add logic that executes before a TreeView level
is refreshed.
Syntax instancename.EVENT pfc_PreRefreshLevel ( level )
Argument Description
instancename Instance name of u_tvs
level Integer specifying the TreeView level to refresh. This argument
is accessed through the ai_level argument
pfc_PreRmbMenu
Description Empty user event allowing you to modify m_tvs contents before display.
Syntax instancename.EVENT pfc_PreRmbMenu ( editmenu )
Argument Description
instancename Instance name of u_tvs
editmenu M_tvs variable containing the popup menu to be displayed
(passed by reference)
Usage Optionally add logic to this event to selectively enable and disable m_lvs menu
items.
344
Chapter 6 Standard Visual User Objects
pfc_Properties
Description Empty user event to which you might add logic to display a Properties dialog.
Return value Integer. Return 1 if the event succeeds and -1 if an error occurs.
pfc_RefreshItem
Description Refreshes the specified TreeView item, resetting all properties to the defaults
specified in the data source.
Syntax instancename.EVENT pfc_RefreshItem ( handle )
Argument Description
instancename Instance name of u_tvs
handle Long specifying the handle of the TreeView item to refresh. This
argument is accessed through the ai_level argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Examples This example is from the pfc_RefreshLevel event:
...
For ll_row = 1 to ll_rowcount
ll_handle = inv_levelsource.of_GetHandle &
(lds_source, ll_row, ai_level)
If ll_handle < 1 Then Continue
If this.event pfc_RefreshItem &
(ll_Handle) = -1 Then Return -1
Next
...
pfc_RefreshLevel
Description Refreshes the specified TreeView level., resetting all properties to the defaults
specified in the data source.
Syntax instancename.EVENT pfc_RefreshLevel ( level )
Argument Description
instancename Instance name of u_tvs
level Integer specifying the TreeView level to refresh
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
345
u_tvs
pfc_RenameItem
Description Renames the selected item.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Internal.
pfc_Retrieve
Description Retrieves rows into a data source.
Syntax instancename.EVENT pfc_Retrieve ( parent, data )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which
new items are retrieved. This argument is accessed through the
al_parent argument
data N_ds into which the event places the retrieved rows. This
argument is accessed through the ads_data argument (passed by
reference)
Return value Long. Returns the number of items retrieved if the event succeeds and -1 if an
error occurs.
Usage Extend this event to perform retrieval.
Examples This example shows code you might add to the pfc_Retrieve event:
Any la_args[20]
Integer li_level
IF IsValid(inv_levelsource) THEN
li_level = this.of_GetNextLevel(al_parent)
this.inv_levelsource.of_GetArgs(al_parent, &
li_level, la_args)
END IF
346
Chapter 6 Standard Visual User Objects
pfc_SearchCompare
Description Compares TreeView data or item text with a target string.
Syntax instancename.EVENT pfc_SearchCompare ( handle, attribute, target,
respectcase, fullcompare )
Argument Description
instancename Instance name of u_tvs
handle Long containing the handle of the item being compared
attribute String specifying the TreeView attribute to compare. Valid values
are:
• Data
• Label
target Any data type specifying the search target
respectcase Boolean indicating whether the search is case-sensitive
fullcompare Boolean indicating whether the specified attribute must match
target exactly (TRUE) or the attribute can simply contain target
(FALSE). This argument only applies when target is a string
Return value Boolean. Returns TRUE if a match is found and FALSE if no match is found.
Usage This event is called by the n_cst_tvsrv of_SearchChild function, which is
called by of_FindItem.
If your application requires a more complex comparison, override this event.
pfc_SetItemAttributes
Description Sets default properties for the TreeView item before insertion.
Syntax instancename.EVENT pfc_SetItemAttributes ( parent, data, row, tvitem )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which
the new item is inserted. This argument is accessed through the
al_parent argument
data N_ds containing the data for the item. This argument is accessed
through the ads_obj argument
row Long specifying the row from which to populate the item. This
argument is accessed through the al_row argument
tvitem TreeViewItem to be inserted. This argument is accessed through
the atvi_item argument (passed by reference)
347
u_tvs
Usage Optionally extend this event to change TreeView item properties before
insertion.
pfc_Undo
Description Cancels the last edit, insert, or delete to the TreeView, restoring the text to the
content before the last change.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The message router calls this event when a TreeView based on u_tvs has focus
and the user selects Edit>Undo.
pfc_Update
Description Calls the n_cst_luw of_Update function to update the specified controls.
Syntax instancename.EVENT pfc_Update ( controls, accepttext, resetflags )
Argument Description
instancename Instance name of u_tvs
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
accepttext Boolean specifying whether n_cst_luw should automatically
perform an AcceptText before performing the Update (TRUE) or
not (FALSE)
resetflags Boolean specifying whether n_cst_luw should automatically reset
DataWindow update flags (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The of_Update function calls this event.
pfc_UpdatePrep
Description Empty user event to which you can add code that prepares for update.
Syntax instancename.EVENT pfc_UpdatePrep ( controls )
Argument Description
instancename Instance name of u_tvs
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
Return value Long. Return 1 if the update preparation succeeds and -1 to halt the update
process.
348
Chapter 6 Standard Visual User Objects
pfc_UpdatesPending
Description Determines if there are pending updates for the TreeView data sources.
Syntax instancename.EVENT pfc_UpdatesPending ( controls, pending )
Argument Description
instancename Instance name of u_tvs
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
pending PowerObject array into which the event places objects with
pending updates. This argument is accessed through the
apo_pending argument (passed by reference)
Return value Integer. Returns 1 if there are pending updates, 0 if there are no pending
updates, and -1 if an error occurs.
Usage This event is called by the of_GetUpdatesPending function.
pfc_Validation
Description Checks for required fields.
Syntax instancename.EVENT pfc_Validation ( controls )
Argument Description
instancename Instance name of u_tvs
controls PowerObject array containing the objects to validate. This
argument is accessed through the apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the of_Validation function.
RightClicked
Description Tracks the clicked item and displays the m_tvs popup menu.
Usage This event executes when the user presses the right mouse button.
Functions
349
u_tvs
of_AcceptText
Description Performs an AcceptText function for each level’s data source.
Access Public
Syntax instancename.of_AcceptText ( focusonerror )
Argument Description
instancename Instance name of u_tvs
focusonerror Boolean indicating whether PFC sets focus to the first item in
error when an error occurs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize accept text processing,
extend the pfc_AcceptText event.
350
Chapter 6 Standard Visual User Objects
...
of_AddItem
Description Adds a new item as the last item under the specified parent.
Access Public
Syntax instancename.of_AddItem ( parent, rowinfo )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which the
new item is inserted
rowinfo Any array containing data for the row
Return value Long. Returns the index of the added item if the function succeeds and -1 if an
error occurs.
Usage If the information in rowinfo is not already in the data source, this function adds
the new row to the data source. If you are using the TreeView level source
service, the data types of the elements in rowinfo must match those in the
DataWindow object specified in the n_cst_tvsrv_levelsource of_Register
function.
Examples This example is from the of_Refresh function:
Long ll_return
Long ll_handle
Any la_row[ ]
TreeViewItem ltvi_item
ll_handle = tv_1.FindItem(CurrentTreeItem! , 0)
tv_1.GetItem(ll_handle, ltvi_item)
IF ltvi_item.Level = 1 THEN
la_row[1] = 1100
la_row[2] = "Department of Defense"
ll_return = tv_1.of_AddItem(ll_handle, la_row)
351
u_tvs
tv_1.Event pfc_RefreshLevel(ltvi_item.Level)
END IF
of_CanUndo
Description Reports whether the TreeView can undo the last edit, insertion, or deletion,
returning the operation type.
Access Public
Syntax instancename.of_CanUndo ( undotype )
Argument Description
instancename Instance name of u_tvs
undotype String into which the function places the type of the last
operation (passed by reference):
• UNDO_EDIT or "Edit" Edit
• UNDO_INSERT or "Insert" Insertion
• UNDO_DELETE or "Delete" Deletion
Return value Boolean. Returns TRUE if the last operation can be undone and FALSE if it
cannot.
Examples This example calls the of_CanUndo function:
String ls_undotype
IF tv_1.of_CanUndo(ls_undotype) THEN
MessageBox("TreeView", "Can undo")
ELSE
MessageBox("TreeView", "Cannot undo")
END IF
of_GetInfo
Description Retrieves object information.
Access Public
Syntax instancename.of_GetInfo ( infoobject )
Argument Description
instancename Instance name of u_tvs
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
352
Chapter 6 Standard Visual User Objects
tv_1.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetNextLevel
Description Determines the DataStore level below the passed parent.
Access Public
Syntax instancename.of_GetNextLevel ( parent )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item for which the
next lowest level is returned
Return value Long. Returns the number of the level below parent if the function succeeds
and -1 if an error occurs.
Examples This example is from the pfc_PreRetrieve event:
...
If isvalid(inv_levelsource) then
li_level = of_GetNextLevel(al_parent)
If li_level < 1 then Return
...
of_GetObjects
Description Retrieves the objects to be updated.
Access Protected
Syntax instancename.of_GetObjects ( objects )
Argument Description
instancename Instance name of u_tvs
objects PowerObject array into which the function places objects to be
updated (passed by reference)
Return value Integer. Returns the number of elements in the objects array if the function
succeeds and -1 if an error occurs.
353
u_tvs
Usage Internal.
Examples This example is from the of_AcceptText function:
...
Else
this.of_Getobjects(lpo_updatearray)
End If
...
of_GetParentWindow
Description Returns the parent of the current window.
Access Public
Syntax instancename.of_GetParentWindow ( parent )
Argument Description
instancename Instance name of u_tvs
parent Window variable into which the function places the parent of the
current window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the GetFocus event.
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_GetUpdateRequestor
Description Retrieves a reference to the object requesting an update.
Access Public
Syntax instancename.of_GetUpdateRequestor ( requestor )
Argument Description
instancename Instance name of u_tvs
354
Chapter 6 Standard Visual User Objects
Argument Description
requestor PowerObject into which the function places a reference to the
object requesting the update (passed by reference)
Return value Integer. Returns 1 if the function succeeds, 0 if there is no update requestor and
-1 if an error occurs.
Usage Call this function if you are extending the pfc_Save process and need to access
the update requestor.
of_InsertItem
Inserts an item into the TreeView. There are two syntaxes:
To Use
Insert from a DataStore Syntax 1
Insert from an array Syntax 2
355
u_tvs
Argument Description
handle Long containing the handle of the TreeView item after which the
(optional) item is added. The function uses this argument if you specify
After for position
Return value Long. Returns the handle of the new item if the function succeeds and -1 if an
error occurs.
Examples This example calls the of_InsertItem function:
Long ll_row, ll_handle
TreeViewItem ltvi_item
ll_handle = tv_1.FindItem(CurrentTreeItem! , 0)
tv_1.GetItem(ll_handle, ltvi_item)
ll_row = ids_datastore.GetRow()
IF ltvi_item.Level = 1 THEN
ll_return = tv_1.of_InsertItem &
(ll_handle, ids_data, ll_row, "Sorted", 0)
END IF
356
Chapter 6 Standard Visual User Objects
Return value Integer. Returns the index of the new item if the function succeeds and -1 if an
error occurs.
Usage If you are using the TreeView level source service, the data types of the
elements in colvalues must match those in the DataWindow object specified in
the n_cst_tvsrv_levelsource of_Register function.
Examples This example calls the of_InsertItem function:
Any la_row[ ]
Long ll_handle
TreeViewItem ltvi_item
ll_handle = tv_1.FindItem(CurrentTreeItem! , 0)
la_row[1] = 1200
la_row[2] = "Commerce"
tv_1.of_InsertItem(ll_handle, la_row, "First", 0)
of_IsAlwaysValidate
Description Reports whether the default save process always performs validation.
Access Public
Syntax instancename.of_IsAlwaysValidate ( )
Argument Description
instancename Instance name of u_tvs
Return value Boolean. Returns TRUE if the default save process always performs validation
and FALSE if it does not.
Examples This example calls the of_IsAlwaysValidate function:
IF tv_1.of_IsAlwaysValidate() = TRUE THEN
MessageBox("TV", "Always validate")
ELSE
MessageBox("TV", "Sometimes validate")
END IF
of_IsRMBMenu
Description Reports whether the popup menu is enabled.
Access Public
Syntax instancename.of_IsRMBMenu ( )
357
u_tvs
Argument Description
instancename Instance name of u_tvs
Return value Boolean. Returns TRUE if the m_tvs popup menu is enabled and FALSE if it
is not.
Examples This example calls the of_IsRmbMenu function:
IF tv_1.of_IsRMBMenu() = TRUE THEN
MessageBox("TV", "RMB enabled")
ELSE
MessageBox("TV", "RMB disabled")
END IF
of_IsUpdateable
Description Reports whether the TreeView’s data source is updatable.
Access Public
Syntax instancename.of_IsUpdateable ( )
Argument Description
instancename Instance name of u_tvs
Return value Boolean. Returns TRUE if the TreeView’s data source is updatable and FALSE
if it is not.
Usage The pfc_UpdatesPending event calls this function.
Examples This example is from the pfc_UpdatesPending event:
...
If Not of_IsUpdateable() Then Return NO_UPDATESPENDING
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_tvs
id String specifying an ID for the message
title String specifying the title of the MessageBox
358
Chapter 6 Standard Visual User Objects
Argument Description
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in TreeViews.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’tv_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
of_Populate
Description Populates a TreeView item with its child items.
Access Public
Syntax instancename.of_Populate ( parent )
Argument Description
instancename Instance name of u_tvs
359
u_tvs
Argument Description
parent Long specifying the handle of the handle of the TreeView item to
be populated
Return value Integer. Returns the number of items added if the function succeeds and -1 if
an error occurs.
Usage Internal.
Examples The example is from the pfc_Populate event:
IF (al_parent < 0) or IsNull(al_parent) then Return -1
Return of_populate(al_parent)
of_PostUpdate
Description Calls the pfc_PostUpdate event, which clears update flags and allows you to
code additional post-update processing.
Access Public
Syntax instancename.of_PostUpdate ( )
Argument Description
instancename Instance name of u_tvs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage To customize post update processing, extend the pfc_PostUpdate event.
N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize post-update processing,
extend the pfc_PostUpdate event.
Examples This example is from the n_cst_luw of_PostUpdate function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_PostUpdate()
...
of_Reset
Description Deletes all items from both the TreeView and the data source.
Access Public
Syntax instancename.of_Reset ( )
360
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_tvs
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Examples This example calls the of_Reset function:
tv_1.of_Reset()
of_Retrieve
Description Retrieves rows into a DataStore.
Syntax instancename.EVENT of_Retrieve ( parent, args, data )
Argument Description
instancename Instance name of u_tvs
parent Long specifying the handle of the TreeView item under which
new items are retrieved
args 20-element Any array specifying retrieval arguments
data N_ds into which the function places the retrieved rows (passed by
reference)
Return value Long. Returns the number of items retrieved if the function succeeds, 0 if no
action was taken, and -1 if an error occurs.
Examples This example (from a pfc_Retrieve event) calls the of_Retrieve function:
Any la_args[20]
Integer li_level
IF IsValid(inv_levelsource) THEN
li_level = this.of_GetNextLevel(al_parent)
this.inv_levelsource.of_GetArgs(al_parent, &
li_level, la_args)
END IF
of_SetAlwaysValidate
Description Specifies whether the default save process always performs validation.
Access Public
Syntax instancename.of_SetAlwaysValidate ( boolean )
361
u_tvs
Argument Description
instancename Instance name of u_tvs
boolean Boolean specifying whether the default save process always
perform validation (TRUE) or only performs validation if a
control has pending updates (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAlwaysValidate function:
tv_1.of_SetAlwaysValidate(TRUE)
of_SetBase
Description Enables or disables n_cst_tvsrv, which provides basic TreeView services.
Access Public
Syntax instancename.of_SetBase ( boolean )
Argument Description
instancename Instance name of u_tvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) basic TreeView services
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_tvsrv. This instance
is named inv_base.
Because all TreeView services are descendants of n_cst_tvsrv (and have
n_cst_tvsrv functions available to them), use this object when you require basic
TreeView services only.
Examples This example calls the of_SetBase function to enable basic TreeView services:
tv_1.of_SetBase(TRUE)
of_SetLevelSource
Description Enables or disables n_cst_tvsrv_levelsource, which provides data access for
TreeView levels.
Access Public
Syntax instancename.of_SetLevelSource ( boolean )
362
Chapter 6 Standard Visual User Objects
Argument Description
instancename Instance name of u_tvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) n_cst_tvsrv_levelsource
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_tvsrv_levelsource.
This instance is named inv_levelsource.
Examples This example calls the of_SetLevelSource function:
tv_1.of_SetLevelSource(TRUE)
of_SetLogicalUnitOfWork
Description Enables or disables n_cst_luw, which provides the logical unit of work service.
Access Protected
Syntax instancename.of_SetLogicalUnitOfWork ( boolean )
Argument Description
instancename Instance name of u_tvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) n_cst_luw
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_luw. This instance is
named inv_luw. If you do not enable n_cst_luw, u_tvs enables it automatically.
Examples This example calls the of_SetLogicalUnitOfWork function:
tv_1.of_SetLogicalUnitOfWork(TRUE)
of_SetPrint
Description Enables or disables n_cst_tvsrv_print, which provides the TreeView print
service.
Access Public
Syntax instancename.of_SetPrint ( boolean )
363
u_tvs
Argument Description
instancename Instance name of u_tvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the TreeView print service
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_tvsrv_print. This
instance is named inv_print.
Examples This example calls the of_SetPrint function:
tv_1.of_SetPrint(TRUE)
of_SetRMBMenu
Description Enables or disables right mouse button support for m_tvs, the TreeView popup
menu.
Access Public
Syntax instancename.of_SetRMBMenu ( boolean )
Argument Description
instancename Instance name of u_tvs
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) right mouse button support
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetRMBMenu function:
tv_1.of_SetRMBMenu(TRUE)
of_SetUpdateable
Description Specifies whether the TreeView is updatable and should be included in the
default save process.
Access Public
Syntax instancename.of_SetUpdateable ( boolean )
Argument Description
instancename Instance name of u_tvs
364
Chapter 6 Standard Visual User Objects
Argument Description
boolean Boolean indicating whether the TreeView is updatable. All
updatable TreeViews are included in the default save processing
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to enable default save processing for TreeViews that are
updatable (by default, TreeViews are not updatable).
Examples This example calls the of_SetUpdateable function:
tv_1.of_SetUpdateable(FALSE)
of_SetUpdateRequestor
Description Creates a reference to the object requesting an update within a logical unit of
work.
Access Public
Syntax instancename.of_SetUpdateRequestor ( requestor )
Argument Description
instancename Instance name of u_tvs
requestor PowerObject containing the object requesting the update
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_Update function:
...
If IsValid(inv_luw) Then
inv_luw.of_SetUpdateRequestor(apo_requestor)
End If
...
of_Update
Description Saves all rows in the DataStores associated with the TreeView.
Access Public
Syntax instancename.of_Update ( accept, resetflag {, requestor } )
Argument Description
instancename Instance name of u_tvs
365
u_tvs
Argument Description
accept Boolean indicating whether the Update function performs an
AcceptText before saving rows to the database
resetflag Boolean indicating whether the Update function resets the update
flags
requestor PowerObject containing the requestor object
Return value Integer. Returns 1 if the update succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update processing, extend
the pfc_Update event.
Examples This example is from the n_cst_luw of_Update function:
...
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Update &
(ab_accepttext, ab_resetflag, &
lpo_updaterequestor)
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatePrep
Description Calls the pfc_UpdatePrep event, which allows you to code additional update
preparation logic.
Access Public
Syntax instancename.of_UpdatePrep ( )
Argument Description
instancename Instance name of u_tvs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update preparation
processing, extend the pfc_UpdatePrep event.
Examples This example is from the n_cst_luw of_UpdatePrep function:
...
If lb_defined Then
li_rc = &
366
Chapter 6 Standard Visual User Objects
of_UpdatesPending
Description Determines if there are updates pending in the DataStores associated with the
TreeView.
Access Public
Syntax instancename.of_UpdatesPending ( )
Argument Description
instancename Instance name of u_tvs
of_Validation
Description Performs validation on the TreeView data sources.
Access Public
Syntax instancename.of_Validation ( )
Argument Description
instancename Instance name of u_tvs
Return value Integer. Returns 1 if the function succeeds and -1 if a validation error occurs.
367
u_tvs
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize validation processing,
extend the pfc_Validation event.
Examples This example calls the of_Validation function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_Validation()
...
368
Chapter 6 Standard Visual User Objects
u_vpb
Description VerticalProgressBar visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
VerticalProgressBar control.
U_vpb event scripts provide integration with PFC menus.
See also u_hpb
u_progressbar
Events
U_vpb includes one precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_vpb includes precoded object functions:
of_GetParentWindow
of_MessageBox
369
u_vpb
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_vpb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_vpb GetFocus event calls this function.
Examples This example is from the u_vpb GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_vpb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
370
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in VerticalProgressBar
controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’vpb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
371
u_vsb
u_vsb
Description VerticalScrollBar visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
VerticalScrollBar control.
U_vsb event scripts provide integration with PFC menus.
See also u_hsb
Events
U_vsb includes one precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_vsb includes precoded object functions:
of_GetParentWindow
of_MessageBox
372
Chapter 6 Standard Visual User Objects
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_vsb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_vsb GetFocus event calls this function.
Examples This example is from the u_vsb GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_vsb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
373
u_vsb
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in VerticalScrollBar
controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’vsb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
374
Chapter 6 Standard Visual User Objects
u_vtb
Description VerticalTrackBar visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships PFC visual user objects are designed to be used with windows that are
descendants of w_master.
Usage Use this visual object in windows instead of the standard PowerBuilder
VerticalTrackBar control.
U_vtb event scripts provide integration with PFC menus.
See also u_htb
Events
U_vtb includes one precoded event script:
GetFocus
GetFocus
Description Updates the parent window so it can set MicroHelp.
Usage This event calls the pfc_ControlGotFocus event in the parent.
Functions
U_vtb includes precoded object functions:
of_GetParentWindow
of_MessageBox
375
u_vtb
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_vtb
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
If no parent window is found, window returns NULL.
Usage The u_vtb GetFocus event calls this function.
Examples This example is from the u_vtb GetFocus event:
Window lw_parent
IF gnv_app.of_GetMicrohelp() THEN
of_GetParentWindow(lw_parent)
IF IsValid(lw_parent) THEN
lw_parent.Dynamic Event &
pfc_ControlGotFocus (this)
END IF
END IF
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of u_vtb
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
376
Chapter 6 Standard Visual User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in VerticalTrackBar
controls.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’vtb_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
377
u_vtb
378
CH A PTE R 7 Custom Visual User Objects
About this chapter This chapter describes the custom visual user objects in PFC.
Contents The custom visual user objects are listed in alphabetical order. Each
object’s discussion includes an alphabetical listing of instance variables,
events, and object functions.
379
u_base
u_base
Description Base object for custom visual user objects (such as u_calculator and
u_calendar).
U_base is a self-updating object.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships n_cst_infoattrib
n_cst_luw
n_cst_resize
Usage Use this object as the base object for custom visual user objects. U_base
contains all the events and functions necessary for a PFC self updating object.
For more on self updating objects see n_cst_luw on page 1051.
To use u_base:
1 Use the User Object painter to create a descendant of u_base.
2 Add controls, events, and functions as necessary.
Descendants u_calculator
u_calendar
u_progressbar
u_tabpg
See also n_base
380
Chapter 7 Custom Visual User Objects
Instance variables
U_base includes instance variables:
Instance variable Description Data type Access Usage
CONTINUE_ACTION Constant set to 1 Integer Public Internal
FAILURE Constant set to -1 Integer Public Internal
ib_alwaysvalidate Controls whether the Boolean Protected Set with
save process includes of_SetAlwaysValidate
all objects in the (default is FALSE)
validation process
ib_isupdateable Indicates whether the Boolean Protected Set with of_SetUpdateable
object can be updated (default is FALSE)
inv_luw Reference variable for n_cst_luw Protected Set with
logical unit of work of_SetLogicalUnitOfWork
service
inv_resize Reference variable for n_cst_resize Public Set with of_SetResize
resize service
ipo_pendingupdates[ ] Default list of objects PowerObject Protected Internal
to be updated
ipo_updateobjects[ ] Customized list of PowerObject Protected Internal
objects to be updated
ipo_tempupdateobjects[ ] One-time list of objects PowerObject Protected Internal
to be updated
ipo_updaterequestor Owner of the save PowerObject Protected Internal
process
NO_ACTION Constant set to 0 Integer Public Internal
PREVENT_ACTION Constant set to 0 Integer Public Internal
SUCCESS Constant set to 1 Integer Public Internal
Events
U_base includes precoded events:
Destructor pfc_UpdatePrep
pfc_AcceptText pfc_UpdatesPending
pfc_PostUpdate pfc_Validation
pfc_Update Resize
381
u_base
Destructor
Description Destroys all enabled service objects.
Usage This event executes when the control is destroyed or the window closes.
pfc_AcceptText
Description Calls the n_cst_luw of_AcceptText function, which in turn calls the
of_AcceptText function for all controls that implement it.
Syntax instancename.EVENT pfc_AcceptText ( controlarray, focusonerror )
Argument Description
instancename Instance name of the u_base descendant
controlarray PowerObject array containing the controls for which to accept
text. From within the pfc_AcceptText event, access this value
through the apo_control argument
focusonerror Boolean specifying whether to set focus on a DataWindow
column with errors. From within the pfc_AcceptText event,
access this value through the ab_focusonerror argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The of_AcceptText function calls this event.
pfc_PostUpdate
Description Calls the n_cst_luw of_PostUpdate function, which in turn calls the
of_PostUpdate function for all controls that implement it.
Syntax instancename.EVENT pfc_PostUpdate ( controlarray )
Argument Description
instancename Instance name of the u_base descendant
controlarray PowerObject array containing the controls for which to perform
post update processing. From within the pfc_AcceptText event,
access this value through the apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The of_PostUpdate function calls this event.
You can extend this event to perform additional post-update processing.
382
Chapter 7 Custom Visual User Objects
pfc_Update
Description Calls the n_cst_luw of_Update function, which in turn calls the of_Update
function for all controls that implement it.
Syntax instancename.EVENT pfc_Update ( controlarray )
Argument Description
instancename Instance name of the u_base descendant
controlarray PowerObject array containing the controls to be updated. From
within the pfc_Update event, access this value through the
apo_control argument
Return value Integer. Returns 1 if the event succeeds and -1 if one or more update errors
occur.
Usage The of_Update function calls this event.
pfc_UpdatePrep
Description Empty user event to which you can add code that prepares for update.
Syntax instancename.EVENT pfc_UpdatePrep ( controls )
Argument Description
instancename Instance name of the u_base descendant
controls PowerObject array containing the objects to update. This
argument is accessed through the apo_control argument
Return value Long. Return 1 if the update preparation succeeds and -1 to halt the update
process.
Usage The of_UpdatePrep function calls this event.
pfc_UpdatesPending
Description Calls the n_cst_luw of_UpdatesPending function, which in turn calls the
of_UpdatesPending function for all controls that implement it.
Syntax instancename.EVENT pfc_UpdatesPending ( controlarray )
Argument Description
instancename Instance name of the u_base descendant
controlarray PowerObject array containing controls to be tested for pending
updates
383
u_base
pfc_Validation
Description Calls the n_cst_luw of_Validation function, which in turn calls the
of_Validation function for all controls that implement it.
Syntax instancename.EVENT pfc_Validation ( controlarray )
Argument Description
instancename Instance name of the u_base descendant
controlarray PowerObject control array containing controls to be validate
Return value Integer. Returns 1 if there are no validation errors and -1 if a validation error
occurs.
Usage The of_Validation function calls this event.
Resize
Description Triggers resize processing, if enabled for the object.
Usage This event executes when the user resizes the window and the custom visual
user object instance has been registered with the window or tab on which it is
placed.
To enable resize processing, you must enabled the resize service for the u_base
descendant instance and for the window or tab containing the instance.
Functions
U_base contains precoded object functions:
of_AcceptText of_SetLogicalUnitOfWork
of_GetInfo of_SetResize
of_GetParentWindow of_SetUpdateable
of_GetUpdateObjects of_SetUpdateObjects
of_IsAlwaysValidate of_SetUpdateRequestor
384
Chapter 7 Custom Visual User Objects
of_IsUpdateable of_Update
of_MessageBox of_UpdatePrep
of_PostUpdate of_UpdatesPending
of_SetAlwaysValidate of_Validation
of_AcceptText
Description Calls the pfc_AcceptText event.
Access Public
Syntax instancename.of_AcceptText ( focusonerror )
Argument Description
instancename Instance name of the u_base descendant
focusonerror Boolean indicating whether PFC sets focus to the first item in
error when an error occurs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize accept text processing,
extend the pfc_AcceptText event.
Examples This example is from the n_cst_luw of_AcceptText function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_AcceptText &
(ab_focusonerror)
If li_rc < 0 Then Return -1
...
of_GetInfo
Description Retrieves object information.
Access Public
Syntax instancename.of_GetInfo ( infoobject )
Argument Description
instancename Instance name of the u_base descendant
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
385
u_base
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
w_emplist.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetParentWindow
Description Retrieves a reference to the parent window.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of u_base
window Window variable into which the function places a reference to
the parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds, -1 if there is no parent window, and
NULL if no parent window is found.
Examples This example calls the of_GetParentWindow function:
Integer li_return
Window lw_window
...
li_return = uo_calc.of_GetParentWindow(lw_window)
...
of_GetUpdateObjects
Description Retrieves the current default array of objects affected by the update process.
Access Protected
Syntax instancename.of_GetUpdateObjects ( objects )
Argument Description
instancename Instance name of the u_base descendant
objects PowerObject array into which the function places objects to be
updated (passed by reference)
386
Chapter 7 Custom Visual User Objects
Return value Integer. Returns the number of elements in the objects array if the function
succeeds and -1 if an error occurs.
Examples This example calls the of_GetUpdateObjects function:
PowerObject lpo_objs[ ]
Integer li_return, li_count
li_return = this.of_GetUpdateObjects(lpo_objs)
FOR li_count = 1 to li_return
IF lpo_objs[li_count] = ids_data THEN
Return 1
END IF
NEXT
li_return++
lpo_objs[li_return] = ids_data
Return this.of_SetUpdateObjects(lpo_objs)
of_IsAlwaysValidate
Description Reports whether the default save process always performs validation.
Access Protected
Syntax instancename.of_IsAlwaysValidate ( )
Argument Description
instancename Instance name of the u_base descendant
Return value Boolean. Returns TRUE if the default save process always performs validation
and FALSE if it does not.
Examples This example calls the of_IsAlwaysValidate function:
IF this.of_IsAlwaysValidate() = TRUE THEN
MessageBox("Base", "Always validate")
ELSE
MessageBox("Base", "Sometimes validate")
END IF
of_IsUpdateable
Description Reports whether the object is updatable.
Access Protected
Syntax instancename.of_IsUpdateable ( )
387
u_base
Argument Description
instancename Instance name of the u_base descendant
Return value Boolean. Returns TRUE if the window is updatable and FALSE if it is not.
Usage Internal.
Examples This example is from the pfc_UpdatesPendingRef event:
...
If Not of_IsUpdateable() Then Return NO_UPDATESPENDING
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of the u_base descendant
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
388
Chapter 7 Custom Visual User Objects
Argument Description
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in custom visual user
objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’cvuo_error’,’Save’, &
as_error, StopSign!, Ok!, 1)
of_PostUpdate
Description Calls the pfc_PostUpdate event.
Access Public
Syntax instancename.of_PostUpdate ( )
Argument Description
instancename Instance name of the u_base descendant
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize post-update processing,
extend the pfc_PostUpdate event.
Examples This example is from the n_cst_luw of_PostUpdate function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_PostUpdate()
...
of_SetAlwaysValidate
Description Specifies whether the default save process always performs validation.
Access Protected
Syntax instancename.of_SetAlwaysValidate ( boolean )
389
u_base
Argument Description
instancename Instance name of the u_base descendant
boolean Boolean specifying whether the default save process always
performs validation (TRUE) or only performs validation if a
control has pending updates (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAlwaysValidate function:
this.of_SetAlwaysValidate(TRUE)
of_SetLogicalUnitOfWork
Description Enables or disables n_cst_luw, which provides the logical unit of work service.
Access Public
Syntax instancename.of_SetLogicalUnitOfWork ( boolean )
Argument Description
instancename Instance name of the u_base descendant
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) n_cst_luw
Return value Integer. Returns 1 if the function succeeds, 0 if the service is already enabled,
and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_luw. This instance is
named inv_luw. If you do not enable n_cst_luw, u_base enables it
automatically.
Examples This example calls the of_SetLogicalUnitOfWork function:
this.of_SetLogicalUnitOfWork(TRUE)
of_SetResize
Description Enables or disables n_cst_resize (the resize service).
Access Public
Syntax instancename.of_SetResize ( boolean )
Argument Description
instancename Instance name of u_base
390
Chapter 7 Custom Visual User Objects
Argument Description
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) an instance of n_cst_resize
Return value Integer. Returns 1 if the function succeeds, 0 if the resize service is already
enabled, and -1 if an error occurs.
Usage After calling this function, apply n_cst_resize functions as necessary to the
controls contained in the u_base descendant.
Examples This example calls the of_SetResize function:
this.of_SetResize(TRUE)
of_SetUpdateable
Description Specifies whether the object is updatable.
Access Protected
Syntax instancename.of_SetUpdateable ( boolean )
Argument Description
instancename Instance name of the u_base descendant
boolean Boolean indicating whether the window is updatable
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to enable default save processing. By default, u_base is not
updatable.
Examples This example calls the of_SetUpdateable function:
this.of_SetUpdateable(TRUE)
of_SetUpdateObjects
Description Sets a new default array containing objects for which updates are attempted.
Access Protected
Syntax instancename.of_SetUpdateObjects ( requestor )
Argument Description
instancename Instance name of u_dw
requestor PowerObject array containing the object to be updated
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
391
u_base
Usage Call this function to customize the objects updated by the save process. You
can even add other windows to the save process.
Examples This example calls the of_SetUpdateObjects function:
PowerObject lpo_objs[ ]
Integer li_count
lpo_objs = this.control
li_count = UpperBound(lpo_objs)
li_count++
// Update w_other as well as this object
lpo_objs[li_count] = w_other
Return this.of_SetUpdateObjects(lpo_objs)
of_SetUpdateRequestor
Description Creates a reference to the object requesting an update within a logical unit of
work.
Access Protected
Syntax instancename.of_SetUpdateRequestor ( requestor )
Argument Description
instancename Instance name of the u_base descendant
requestor PowerObject containing the object requesting the update
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
of_Update
Description Calls the pfc_Update event.
Access Public
Syntax instancename.of_Update ( accept, resetflag {, requestor} )
Argument Description
instancename Instance name of the u_base descendant
accept Boolean indicating whether the Update function performs an
AcceptText before saving rows to the database
resetflag Boolean indicating whether the Update function resets the update
flags
392
Chapter 7 Custom Visual User Objects
Argument Description
requestor PowerObject containing the requestor object
(optional)
Return value Integer. Returns 1 if the update succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update processing, extend
the pfc_Update event.
Examples This example is from the n_cst_luw of_Update function:
...
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Update &
(ab_accepttext, ab_resetflag, &
lpo_updaterequestor)
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatePrep
Description Calls the pfc_UpdatePrep event, which allows you to code additional update
preparation logic.
Access Public
Syntax instancename.of_UpdatePrep ( )
Argument Description
instancename Instance name of the u_base descendant
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update preparation
processing, extend the pfc_UpdatePrep event.
Examples This example is from the n_cst_luw of_UpdatePrep function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_UpdatePrep()
If li_rc < 0 Then Return -1
Continue
393
u_base
End If
...
of_UpdatesPending
Description Calls the pfc_UpdatesPending event.
Access Public
Syntax instancename.of_UpdatesPending ( )
Argument Description
instancename Instance name of the u_base descendant
of_Validation
Description Calls the pfc_Validation event.
Access Public
Syntax instancename.of_Validation ( )
Argument Description
instancename Instance name of the u_base descendant
Return value Integer. Returns 1 if the function succeeds and -1 if a validation error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize validation processing,
extend the pfc_Validation event.
394
Chapter 7 Custom Visual User Objects
395
u_calculator
u_calculator
Description Calculator object for use with numeric values in DataWindow and EditMask
controls. Users use the calculator to enter values and calculations, which the
object displays in the associated DataWindow column or EditMask control.
You typically use the calculator object as a dropdown object, displaying when
a DataWindow column gets focus or when the user clicks the dropdown arrow.
However, you can also place the calculator object directly onto a window.
Ancestry
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Object relationships n_cst_dropdown
n_cst_calculatorattrib
n_cst_infoattrib
n_cst_propertyattrib
u_dw
u_em
396
Chapter 7 Custom Visual User Objects
Usage Use this object with EditMask controls that display numeric or decimal values
or with DataWindow columns that display numeric values. For automatic
calculator display, DataWindow columns must use the DropDownListBox edit
style. For manual calculator display, DataWindow columns can use the
DropDownListBox, Edit, or EditMask edit style.
To use this object for DataWindow columns:
1 Determine which columns in your DataWindow object are appropriate for
a dropdown calculator. Use the DataWindow painter to assign the
DropDownListBox, Edit, or EditMask edit style to these columns.
2 In the Window painter, define a DataWindow control based on u_dw.
3 Enable the dropdown calculator for the DataWindow by calling the
of_SetDropDownCalculator function. This example is from the
DataWindow control’s Constructor event:
this.of_SetDropDownCalculator(TRUE)
4 Register one or more columns by calling the of_Register function:
this.iuo_calculator.of_Register("salary", &
this.iuo_calculator.DDLB_WITHARROW))
5 Specify whether the dropdown closes on a single-click by calling the
of_SetCloseOnClick function:
this.iuo_calculator.of_SetCloseOnClick(TRUE)
For information on using u_calculator with EditMask controls, see the PFC
User’s Guide.
See also n_cst_dropdown
u_calendar
u_dw
u_em
Instance variables
U_calculator includes instance variables:
Instance variable Description Data type Access Usage
DDLB Constant set to 2 Integer Public Use with of_ Register
DDLB_WITHARROW Constant set to 3 Integer Public Use with of_ Register
EMPTY Constant set to String Protected Internal
empty string
397
u_calculator
398
Chapter 7 Custom Visual User Objects
Events
U_calculator includes precoded events:
ButtonClicked Key
Constructor LoseFocus
Destructor pfc_DropDown
GetFocus
ButtonClicked
Description Calls the of_ButtonClicked function.
Applies to Dw_calculator
Usage This event executes when the user clicks a command button, types a number,
types an operator, or types a period.
Constructor
Description Initializes object settings.
Applies to Dw_calculator and u_calculator
Usage This event executes when the object is created.
Destructor
Description Destroys the inv_dropdown instance variable.
Applies to U_calculator
Usage This event executes when the u_calculator instance is destroyed.
GetFocus
Description Calls the of_RedirectFocus function.
Applies to Dw_calculator
Usage This event executes when a control receives focus, typically by clicking.
Key
Description Determines which key was pressed and calls the of_ButtonClicked function.
Applies to Dw_calculator
399
u_calculator
LoseFocus
Description Hides the calculator.
Applies to Dw_calculator
Usage This event executes when the calculator loses focus.
pfc_DropDown
Description Calls the of_DropDown function.
Applies to U_calculator
Return value Integer. Returns 1 if the event succeeds, 0 if the DataWindow column has not
been registered, and -1 if an error occurs.
Usage This event is called by the u_dw pfc_DDCalculator event.
Functions
U_calculator contains precoded object functions:
of_ButtonClicked of_PerformMath
of_DropDown of_RedirectFocus
of_GetInfo of_Register
of_GetPropertyInfo of_Reset
of_GetRegisterable of_SetCloseOnClick
of_GetRegistered of_SetDropDown
of_GetRegisteredStyle of_SetFocusOnRequestor
of_IsCloseOnClick of_SetInitialValue
of_IsDropDown of_SetRequestor
of_IsInitialValue of_SetValue
of_IsNumericType of_SetValueOnRequestor
of_IsOperator of_UnRegister
of_IsRegistered
of_ButtonClicked
Description Processes button clicks.
400
Chapter 7 Custom Visual User Objects
Access Protected
Syntax dwcontrol.instancename.of_ButtonClicked ( key )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
key String specifying the text of the clicked button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from a the u_calculator dw_employee ButtonClicked event:
...
If Len(ls_buttontext) > 0 Then
of_ButtonClicked(ls_buttontext)
End If
...
of_DropDown
Description Displays the dropdown calculator in the appropriate location.
Access Public
Syntax dwcontrol.instancename.of_DropDown ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
Return value Integer. Returns 1 if the function succeeds, 0 if the current DataWindow
column has not been registered, and -1 if an error occurs.
Usage The pfc_DropDown event calls this function. If the current DataWindow
column is not registered, this function returns 0 and does not display the
calculator.
Examples This example is from the pfc_DropDown event:
Return of_DropDown()
401
u_calculator
of_GetInfo
Description Retrieves object information.
Access Public
Syntax dwcontrol.instancename.of_GetInfo ( infoobject )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for
this value is iuo_calculator)
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The DataWindow Properties window calls this function to access service
information.
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
dw_1.iuo_calculator.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetPropertyInfo
Description Retrieves information about the service’s properties.
Access Public
Syntax dwcontrol.instancename.of_GetPropertyInfo ( propertyobject )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calculator (the u_dw and u_em default for
this value is iuo_calculator)
propertyobject N_cst_propertyattrib instance into which the function places
property information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The DataWindow Properties window calls this function to access service
information.
402
Chapter 7 Custom Visual User Objects
dw_1.iuo_calculator.of_GetPropertyInfo(lnv_prop)
MessageBox("Info", &
"Description: " + lnv_prop.is_description &
+ ". Name: " + lnv_prop.is_name &
+ ". Property tab text: " + &
lnv_prop.is_propertytabtext)
of_GetRegisterable
Description Retrieves an array of registerable DataWindow columns. Registerable
DataWindow columns are numeric and use the DropDownListBox, Edit, or
EditMask edit style.
Access Public
Syntax dwcontrol.instancename.of_GetRegisterable ( columns )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calculator (the u_dw default for this value is
iuo_calculator)
columns Unbounded string array into which the function places the names of
columns that have been registered with this instance of the
dropdown calculator (passed by reference)
Return value Integer. Returns the number of entries in the columns array if the function
succeeds and -1 if an error occurs.
Examples This example calls the of_GetRegisterable function:
...
li_rc = &
idw_requestor.iuo_calculator.of_GetRegisterable &
(ls_allcols)
...
of_GetRegistered
Description Retrieves an array of registered DataWindow columns.
Access Public
Syntax dwcontrol.instancename.of_GetRegistered ( columns {, colstyle } )
403
u_calculator
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calculator (the u_dw default for this value is
iuo_calculator)
columns Unbounded string array into which the function places the names
of columns that have been registered with this instance of the
dropdown calculator (passed by reference)
colstyle Unbounded Integer array into which the function places the styles
(optional) of columns that have been registered with this instance of the
dropdown calculator (passed by reference)
Return value Integer. Returns the number of entries in the columns array if the function
succeeds and -1 if an error occurs.
Examples This example calls the of_GetRegistered function:
String ls_columns[ ], ls_display
Integer li_return, li_count
li_return = &
dw_1.iuo_calculator. of_GetRegistered &
(ls_columns)
FOR li_count = 1 to li_return
ls_display += ls_columns[li_count] + "~r~n"
NEXT
MessageBox("Columns", ls_display)
of_GetRegisteredStyle
Description Retrieves the display style for a specified column.
Access Public
Syntax dwcontrol.instancename.of_GetRegisteredStyle ( column )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calculator (the u_dw default for this value is
iuo_calculator)
column String containing the DataWindow column for which the function
returns the display style
Return value Integer. Returns the column style if the function succeeds, 0 if the column is
not registered, and -1 if an error occurs.
404
Chapter 7 Custom Visual User Objects
li_return = &
dw_1.iuo_calculator.of_GetRegisteredStyle &
("start_date")
MessageBox("Display Style", &
"Display style is " + String(li_return))
of_IsCloseOnClick
Description Reports whether the u_calculator instance closes when the user clicks the equal
sign.
Access Public
Syntax dwcontrol.instancename.of_IsCloseOnClick ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
Return value Boolean. Returns TRUE if the u_calculator instance closes when the user
clicks the equal sign and FALSE if it does not.
Examples This example calls the of_IsCloseOnClick function:
Boolean lb_close
n_cst_conversion lnv_conversion
lb_close = &
dw_1.iuo_calculator.of_IsCloseOnClick()
MessageBox("Calculator", "Close on click is " &
+ lnv_conversion.of_String(lb_close))
of_IsDropDown
Description Reports whether the u_calculator instance has enabled n_cst_dropdown.
Access Public
Syntax dwcontrol.instancename.of_IsDropDown ( )
405
u_calculator
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
Return value Boolean. Returns TRUE if the u_calculator instance has enabled
n_cst_dropdown and FALSE if it has not.
Usage The dropdown service is referenced by the inv_dropdown instance variable.
Examples This example calls the of_IsDropDown function:
Boolean lb_dropdown
n_cst_conversion lnv_conversion
lb_dropdown = &
dw_1.iuo_calculator.of_IsDropDown()
MessageBox("Calculator", &
"DropDown behavior is " &
+ lnv_conversion.of_String(lb_dropdown))
of_IsInitialValue
Description Reports whether the u_calculator instance initializes blank fields with zero
when the calculator displays.
Access Public
Syntax dwcontrol.instancename.of_IsInitialValue ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
Return value Boolean. Returns TRUE if the calculator initializes blank fields with a zero and
FALSE if it does not.
Examples This example calls the of_IsInitialValue function:
Boolean lb_init
n_cst_conversion lnv_conversion
lb_init = &
dw_1.iuo_calculator.of_IsInitialValue()
406
Chapter 7 Custom Visual User Objects
of_IsNumericType
Description Reports whether a specified DataWindow column data type is numeric
(decimal, long, or number).
Access Protected
Syntax dwcontrol.instancename.of_IsNumericType ( datatype )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
datatype String specifying the data type
Return value Boolean. Returns TRUE if datatype is numeric and FALSE if it is not.
Usage Internal.
Examples This example is from the of_DropDown function:
...
IF IsValid(idw_requestor) THEN
ls_colname = idw_requestor.GetColumnName()
IF NOT of_IsRegistered(ls_colname) THEN
Return 0
END IF
ls_coltype = &
idw_requestor.Describe(ls_colname+".coltype")
IF NOT of_IsNumericType(ls_coltype) THEN
Return -1
END IF
END IF
...
of_IsOperator
Description Reports whether a passed value is an arithmetic operator (/, *, +, or -).
Access Protected
Syntax dwcontrol.instancename.of_IsOperator ( operator )
407
u_calculator
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
operator String containing the value to be tested
of_IsRegistered
Description Reports whether a specified DataWindow column has been registered.
Access Public
Syntax dwcontrol.instancename.of_IsRegistered ( column )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calculator (the u_dw default for this value is
iuo_calculator)
column String specifying the column to search for
Return value Boolean. Returns TRUE if column has been registered and FALSE if it has not.
Examples This example calls the of_IsRegistered function:
...
IF NOT this.iuo_calculator.of_IsRegistered &
("salary") THEN
this.iuo_calculator.of_Register("salary")
END IF
...
408
Chapter 7 Custom Visual User Objects
of_PerformMath
Description Updates the running total, using the specified operand and operator.
Access Protected
Syntax dwcontrol.instancename.of_PerformMath ( value, operator, operand )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
value Double into which the function places the running total (passed by
reference)
operator String specifying the operator
operand Double containing the number to be used in the calculation
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_ButtonClicked function:
...
IF of_PerformMath(ldbl_value, &
is_curroperator, ldbl_currvalue) < 0 THEN
Return -1
END IF
...
of_RedirectFocus
Description Prevents the u_calculator instance from getting focus while it is hidden.
Access Protected
Syntax dwcontrol.instancename.of_RedirectFocus ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
409
u_calculator
of_Register
Registers columns that use the dropdown calculator. There are two syntaxes:
To register Use
One or all eligible columns, optionally specifying a display style Syntax 1
All eligible columns using a specified display style Syntax 2
410
Chapter 7 Custom Visual User Objects
Return value Integer. Returns the number of columns registered if the function succeeds, 0
if the column was already registered, and -1 if an error occurs. The number of
columns registered includes hidden columns.
Usage Register all appropriate DataWindow columns. You typically call this function
in the DataWindow Constructor event.
To register all eligible columns in a DataWindow using a specified display
style, see Syntax 2.
Examples This example from a DataWindow Constructor event calls the of_Register
function:
this.of_SetTransObject(SQLCA)
this.of_SetDropDownCalculator(TRUE)
this.iuo_calculator.of_Register ("salary", &
this.iuo_calculator.NONE)
this.Event pfc_Retrieve()
411
u_calculator
Argument Description
style Integer or u_calculator constant specifying the display style of
registered DataWindow columns:
• 1 or NONE For columns that use the DropDownListBox
edit style, the calculator displays automatically when the
column gets focus. For columns that use the Edit and
EditMask edit styles, the calculator does not display
automatically; instead, you display the calculator by coding a
call to the u_dw pfc_DDCalculator event
• 2 or DDLB The function converts registered columns to the
DropDownListBox edit style. Users display the calculator by
clicking the down arrow, which disappears when the
calculator displays
• 3 or DDLB_WITHARROW The function converts registered
columns to the DropDownListBox edit style. Users display
the calculator by clicking the down arrow, which remains
when the calculator displays
Return value Integer. Returns the number of columns registered if the function succeeds and
-1 if an error occurs. The number of columns registered includes hidden
columns.
Usage Register all appropriate DataWindow columns. You typically call this function
in the DataWindow Constructor event.
To register one or all eligible columns in a DataWindow, optionally specifying
a display style, see Syntax 1.
Examples This example from a DataWindow Constructor event calls the of_Register
function:
this.of_SetTransObject(SQLCA)
this.of_SetDropDownCalculator(TRUE)
this.iuo_calculator. of_Register &
(this.iuo_calculator.NONE)
this.Event pfc_Retrieve()
of_Reset
Description Resets the u_calculator running total to that displayed in the DataWindow
column or EditMask control (or to today’s date if the date displayed is not
valid).
Access Public
Syntax dwcontrol.instancename.of_Reset ( )
412
Chapter 7 Custom Visual User Objects
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for
this value is iuo_calculator)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_DropDown function:
...
of_Reset()
...
of_SetCloseOnClick
Description Specifies whether to hide the u_calculator instance when the user clicks the
equal sign.
Access Public
Syntax dwcontrol.instancename.of_SetCloseOnClick ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for
this value is iuo_calculator)
boolean Boolean specifying whether to hide the dropdown calculator
when the user clicks the equal sign (TRUE) or leave it displayed
(FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetCloseOnClick function:
this.of_SetTransObject(SQLCA)
this.of_SetDropDownCalculator(TRUE)
this.iuo_calculator.of_Register()
this.iuo_calculator.of_SetCloseOnClick(FALSE)
of_SetDropDown
Description Enables or disables the dropdown service (n_cst_dropdown).
413
u_calculator
Access Public
Syntax dwcontrol.instancename.of_SetDropDown ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for
this value is iuo_calculator)
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) the dropdown service
Return value Integer. Returns 1 if the function succeeds, -0 if the dropdown service already
exists, and -1 if an error occurs.
Examples This example is from the u_calculator Constructor event:
...
IF inv_calculatorattrib.ib_dropdown THEN
this.Visible = FALSE
of_SetDropDown(TRUE)
END IF
...
of_SetFocusOnRequestor
Description Retrieves focus to the associated DataWindow column or EditMask control.
Access Protected
Syntax dwcontrol.instancename.of_SetFocusOnRequestor ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for
this value is iuo_calculator)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_RedirectFocus function:
If this.Visible = False Then
Return of_SetFocusOnRequestor()
End If
Return 1
414
Chapter 7 Custom Visual User Objects
of_SetInitialValue
Description Specifies whether the u_calculator instance initializes blank fields with zero
when the calculator displays.
Access Public
Syntax dwcontrol.instancename.of_SetInitialValue ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
boolean Boolean indicating whether the calculator initializes blank fields
with zero (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage For DataWindows that disable this option, if a user displays the dropdown
calculator and moves directly to another column, the original column retains a
status of NotModified!.
Examples This example calls the of_SetInitialValue function:
this.of_SetTransObject(SQLCA)
this.of_SetDropDownCalculator(TRUE)
this.iuo_calculator.of_Register()
this.iuo_calculator.of_SetInitialValue(TRUE)
of_SetRequestor
Description Associates an instance of u_calculator with a DataWindow or EditMask
control.
Access Public
Syntax dwcontrol.instancename.of_SetRequestor ( requestor )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
requestor DragObject referencing the DataWindow or EditMask control to
associate with this instance of u_calculator
415
u_calculator
of_SetValue
Description Updates the running total with the specified value.
Access Protected
Syntax dwcontrol.instancename.of_SetValue ( value, sendtorequestor )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for
this value is iuo_calculator)
value Double containing the new value
sendtorequestor Boolean indicating whether to copy value to the requestor object
(TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
416
Chapter 7 Custom Visual User Objects
Usage Internal.
Examples This example is from the of_ButtonClicked function:
...
CHOOSE CASE as_key
CASE ’c’
// Clear the current variables.
is_curroperator = EMPTY
is_currvalue = EMPTY
// Clear the repeat variables.
is_repeatoperator = EMPTY
idbl_repeatvalue = 0
// Clear the Running value.
of_SetValue(0, True)
...
of_SetValueOnRequestor
Description Copies the running total to the current DataWindow column or associated
EditMask control.
Access Protected
Syntax dwcontrol.instancename.of_SetValueOnRequestor ( value )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calculator (the u_dw and u_em default for this
value is iuo_calculator)
value String containing the value to set on the requestor object
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_Value function:
...
IF ab_setrequestor THEN
of_SetValueOnRequestor(is_value)
END IF
...
of_UnRegister
Description Removes one or all columns from the list of registered columns.
417
u_calculator
Access Public
Syntax dwcontrol.instancename.of_Register ( { column } )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calculator (the u_dw default for this is
iuo_calculator)
column String specifying the column to be unregistered. If you omit this
(optional) argument, the function unregisters all columns
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_UnRegister function:
...
dw_emp.iuo_calculator.of_UnRegister("salary")
...
418
Chapter 7 Custom Visual User Objects
u_calendar
Description Calendar object. Users enter dates by clicking on the dropdown calendar,
automatically entering the selected date in the associated field. They change
months by clicking the >> and << buttons and can also navigate the calendar
with keyboard arrow keys.
U_calendar provides support for highlighting:
• Saturdays
• Sundays
• Holidays
• Marked days (any other special days that might apply to your application)
Ancestry
Library PFCAPSRV.PBL
PFEAPSRV.PBL
419
u_calendar
this.iuo_calendar.of_SetSaturdayBold(TRUE)
this.iuo_calendar.of_SetSaturdayColor &
(lnv_color.GREEN)
this.iuo_calendar.of_SetSundayBold(TRUE)
this.iuo_calendar.of_SetSundayColor &
(lnv_color.GREEN)
5 (Optional) Establish a list of holidays with their font style and color (this
example shows holidays for one year only):
Date ld_holidays[11]
ld_holidays[1] = 1997-01-01
ld_holidays[2] = 1997-02-17
ld_holidays[3] = 1997-04-21
ld_holidays[4] = 1997-05-26
ld_holidays[5] = 1997-07-04
ld_holidays[6] = 1997-09-01
420
Chapter 7 Custom Visual User Objects
ld_holidays[7] = 1997-10-13
ld_holidays[8] = 1997-11-27
ld_holidays[9] = 1997-11-28
ld_holidays[10] = 1997-12-25
ld_holidays[11] = 1997-12-26
...
this.iuo_calendar.of_SetHoliday(ld_holidays)
this.iuo_calendar.of_SetHolidayBold(TRUE)
this.iuo_calendar.of_SetHolidayColor &
(lnv_color.GREEN)
6 (Optional) Establish a list of marked days with their font style and color:
Date ld_marked_days[12]
ld_marked_days[1] = 1996-06-13
ld_marked_days[2] = 1996-03-16
ld_marked_days[3] = 1996-09-23
ld_marked_days[4] = 1996-09-14
ld_marked_days[5] = 1997-06-13
ld_marked_days[6] = 1997-03-16
ld_marked_days[7] = 1997-09-23
ld_marked_days[8] = 1997-09-14
ld_marked_days[9] = 1998-06-13
ld_marked_days[10] = 1998-03-16
ld_marked_days[11] = 1998-09-23
ld_marked_days[12] = 1998-09-14
...
this.iuo_calendar.of_SetMarkedDay(ld_marked_days)
this.iuo_calendar.of_SetMarkedDayBold(TRUE)
this.iuo_calendar.of_SetMarkedDayColor &
(lnv_color.RED)
7 (Optional) Call additional functions as necessary to customize calendar
behavior:
this.iuo_calendar.of_SetCloseOnClick(FALSE)
this.iuo_calendar.of_SetCloseOnDClick(TRUE)
this.iuo_calendar.of_SetInitialValue(TRUE)
For information on using u_calendar with EditMask controls and as a
standalone calendar, see the PFC User’s Guide.
See also u_calculator
u_dw
u_em
421
u_calendar
Instance variables
U_calendar includes instance variables.
Instance variable Description Data type Access Usage
DDLB Constant set to 2 Integer Public Use with of_Register
DDLB_WITHARROW Constant set to 3 Integer Public Use with of_Register
ib_alwaysredraw Controls redraw Boolean Protected Internal
ib_closeonclick Controls close on Boolean Protected Set with
click of_SetCloseOnClick
ib_closeondclick Controls close on Boolean Protected Set with
double-click of_SetCloseOnDClick
ib_holidaybold Controls whether Boolean Protected Set with
holidays are bold of_SetHolidayBold
ib_initialvalue Controls whether Boolean Protected Set with of_SetInitialValue
blank fields are
initialized
ib_markeddaybold Controls whether Boolean Protected Set with
marked days are of_SetMarkedDayBold
bold
ib_saturdaybold Controls whether Boolean Protected Set with
Saturdays are bold of_SetSaturdayBold
ib_sundaybold Controls whether Boolean Protected Set with
Sundays are bold of_SetSundayBold
id_date Current date Date Protected Internal
id_holiday[ ] List of holidays Date Protected Set with of_SetHoliday
id_markedday[ ] List of marked Date Protected Set with
days of_SetMarkedDay
id_prevdate Previous date Date Protected Internal
id_resetdate Date to use if Date Protected Internal
invalid date is
entered
idrg_requestor Generic reference DragObject Protected Internal
idw_requestor Associated DataWindow Protected Internal
DataWindow
control
iem_requestor Associated EditMask Protected Internal
EditMask control
ii_boldfontweight Bold font weight Integer Protected Internal (default is 700)
ii_dwcolumnstyle[ ] Edit styles of Integer Protected Set with of_Register
registered
columns
422
Chapter 7 Custom Visual User Objects
Events
U_calendar includes precoded events:
ButtonClicked pfc_DropDown
Clicked pfc_NextDay
Constructor pfc_NextMonth
Destructor pfc_NextWeek
DoubleClicked pfc_PrevDay
GetFocus pfc_PrevMonth
423
u_calendar
Key pfc_PrevWeek
LoseFocus
ButtonClicked
Description Changes the month.
Applies to Dw_cal
Usage This event executes when the user clicks the next or previous month buttons.
Clicked
Description Changes the month or day.
Applies to Dw_cal
Usage This event executes when the user clicks a date.
Constructor
Description Initializes object settings.
Applies to Dw_cal and u_calendar
Usage This event executes when the object is created.
Destructor
Description Destroys the inv_dropdown instance variable.
Applies to U_calendar
Usage This event executes when the u_calendar instance is destroyed.
DoubleClicked
Description Hides the dropdown calendar if close on double-click has been set with the
of_SetCloseOnDClick function.
Applies to Dw_cal
Usage This event executes when the user double-clicks on the dw_cal DataWindow
control.
424
Chapter 7 Custom Visual User Objects
GetFocus
Description Calls the of_RedirectFocus function.
Applies to Dw_cal
Usage This event executes when a control receives focus, typically by clicking.
Key
Description Provides keyboard support.
Applies to Dw_cal
Usage This event executes when the user presses one of the following keys:
ESC
TAB
ENTER
LEFT, RIGHT, UP, or DOWN ARROW
PAGE UP or PAGE DOWN
LoseFocus
Description Hides the calendar.
Applies to Dw_cal
Usage This event executes when the calendar loses focus.
pfc_DropDown
Description Calls the of_DropDown function.
Applies to U_calendar
Return value Integer. Returns 1 if the event succeeds, 0 if the DataWindow column has not
been registered, and -1 if an error occurs.
Usage This event, which calls the of_DropDown function, is called by the u_dw
pfc_DDCalendar event.
pfc_NextDay
Description Advances the current date by one day.
Applies to Dw_cal
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
425
u_calendar
Usage This event is called by the Key event when the user presses the RIGHT ARROW
key.
pfc_NextMonth
Description Advances the current date by one month.
Applies to Dw_cal
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the Key event when the user presses the PAGE DOWN
key.
pfc_NextWeek
Description Advances the current date by one week.
Applies to Dw_cal
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the Key event when the user presses the DOWN ARROW
key.
pfc_PrevDay
Description Sets the current date back by one day.
Applies to Dw_cal
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the Key event when the user presses the LEFT ARROW
key.
pfc_PrevMonth
Description Sets the current date back by one month.
Applies to Dw_cal
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the Key event when the user presses the PAGE DOWN
key.
426
Chapter 7 Custom Visual User Objects
pfc_PrevWeek
Description Sets the current date back by one week.
Applies to Dw_cal
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the Key event when the user presses the UP ARROW key.
Functions
U_calendar contains precoded object functions:
of_DrawMonth of_RedirectFocus
of_DropDown of_Register
of_GetHoliday of_Reset
of_GetHolidayColor of_SetAlwaysRedraw
of_GetInfo of_SetCloseOnClick
of_GetMarkedDay of_SetCloseOnDClick
of_GetMarkedDayColor of_SetDate
of_GetPropertyInfo of_SetDateFormat
of_GetRegisterable of_SetDropDown
of_GetRegistered of_SetFocusOnRequestor
of_GetRegisteredStyle of_SetHoliday
of_GetSaturdayColor of_SetHolidayBold
of_GetSundayColor of_SetHolidayColor
of_IsAlwaysRedraw of_SetInitialValue
of_IsCloseOnClick of_SetMarkedDay
of_IsCloseOnDClick of_SetMarkedDayBold
of_IsDateType of_SetMarkedDayColor
of_IsHolidayBold of_SetRequestor
of_IsInitialValue of_SetSaturdayBold
of_IsMarkedDayBold of_SetSaturdayColor
of_IsRegistered of_SetSundayBold
of_IsSaturdayBold of_SetSundayColor
of_IsSundayBold of_UnRegister
of_DrawMonth
Description Draws the specified month.
427
u_calendar
Access Protected
Syntax dwcontrol.instancename.of_DrawMonth ( date )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
date Date specifying the month to draw
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example calls the of_DrawMonth function:
...
IF Year(ad_date) <> Year(id_prevdate) OR &
Month(ad_date) <> Month(id_prevdate) THEN
of_DrawMonth(ad_date)
END IF
...
of_DropDown
Description Displays the dropdown calendar in the appropriate location.
Access Public
Syntax dwcontrol.instancename.of_DropDown ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Integer. Returns 1 if the function succeeds, 0 if the current DataWindow
column has not been registered, and -1 if an error occurs.
Usage The u_dw and u_em pfc_DDCalendar event calls this function.
Examples This example is from the u_em pfc_DDCalendar event:
IF IsValid(iuo_calendar) THEN
Return iuo_calendar.of_DropDown()
END IF
428
Chapter 7 Custom Visual User Objects
of_GetHoliday
Description Retrieves an array containing all specified holidays.
Access Public
Syntax dwcontrol.instancename.of_GetHoliday ( holidays )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
holidays Unbounded Date array into which the function places all specified
holidays (passed by reference)
Return value Integer. Returns the number of entries in the holidays array.
Examples This example calls the of_GetHoliday function:
String ls_display
Date ldt_holidays[ ]
Integer li_return, li_count
li_return = &
dw_caltest.iuo_calendar.of_GetHoliday &
(ldt_holidays)
FOR li_count = 1 to li_return
ls_display += String(ldt_holidays[li_count])
ls_display += "~r~n"
NEXT
MessageBox("Holidays", ls_display)
of_GetHolidayColor
Description Retrieves the display color for holidays.
Access Public
Syntax dwcontrol.instancename.of_GetHolidayColor ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
429
u_calendar
of_GetInfo
Description Retrieves object information.
Access Public
Syntax dwcontrol.instancename.of_GetInfo ( infoobject )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The DataWindow Properties window calls this function to access service
information.
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
dw_1.iuo_calendar.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetMarkedDay
Description Retrieves an array containing all marked days.
Access Public
Syntax dwcontrol.instancename.of_GetMarkedDay ( markeddays )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
430
Chapter 7 Custom Visual User Objects
Argument Description
markeddays Unbounded Date array into which the function places all specified
marked days (passed by reference)
Return value Integer. Returns the number of entries in the markeddays array.
Examples This example calls the of_GetMarkedDay function:
String ls_display
Date ldt_marked_days[ ]
Integer li_return, li_count
li_return = &
dw_caltest.iuo_calendar.of_GetMarkedDay &
(ldt_marked_days)
FOR li_count = 1 to li_return
ls_display += String(ldt_marked_days[li_count])
ls_display += "~r~n"
NEXT
MessageBox("Marked Days", ls_display)
of_GetMarkedDayColor
Description Retrieves the display color for marked days.
Access Public
Syntax dwcontrol.instancename.of_GetMarkedDayColor ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
of_GetPropertyInfo
Description Retrieves information about the service’s properties.
Access Public
431
u_calendar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The DataWindow Properties window calls this function to access service
information.
Examples This example calls the of_GetPropertyInfo function:
n_cst_propertyattrib lnv_prop
dw_1.iuo_calendar.of_GetPropertyInfo(lnv_prop)
MessageBox("Info", &
"Description: " + lnv_prop.is_description &
+ ". Name: " + lnv_prop.is_name &
+ ". Property tab text: " + &
lnv_prop.is_propertytabtext)
of_GetRegisterable
Description Retrieves an array of registerable DataWindow columns. Registerable
DataWindow columns have the date data type and use the DropDownListBox,
Edit, or EditMask edit style.
Access Public
Syntax dwcontrol.instancename.of_GetRegisterable ( columns )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calendar (the u_dw default for this value is
iuo_calendar)
columns Unbounded string array into which the function places the names
of columns that have been registered with this instance of the
dropdown calendar (passed by reference)
Return value Integer. Returns the number of entries in the columns array if the function
succeeds and -1 if an error occurs.
432
Chapter 7 Custom Visual User Objects
of_GetRegistered
Description Retrieves an array of registered DataWindow columns.
Access Public
Syntax dwcontrol.instancename.of_GetRegistered ( columns )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calendar (the u_dw default for this value is
iuo_calendar)
columns Unbounded string array into which the function places the names of
columns that have been registered with this instance of the
dropdown calendar (passed by reference)
Return value Integer. Returns the number of entries in the columns array if the function
succeeds and -1 if an error occurs.
Examples This example calls the of_GetRegistered function:
String ls_columns[], ls_display
Integer li_return, li_count
li_return = &
dw_1.iuo_calendar.of_GetRegistered(ls_columns)
FOR li_count = 1 to li_return
ls_display += ls_columns[li_count] + "~r~n"
NEXT
MessageBox("Columns", ls_display)
of_GetRegisteredStyle
Description Retrieves the display style for a registered column.
Access Public
433
u_calendar
Return value Integer. Returns 1 if the function succeeds, 0 if the column is not registered, and
-1 if an error occurs.
Examples This example calls the of_GetRegisteredStyle function:
Integer li_return
li_return = &
dw_1.iuo_calendar.of_GetRegisteredStyle &
("start_date")
MessageBox("Display Style", &
"Display style is " + String(li_return))
of_GetSaturdayColor
Description Retrieves the display color for Saturdays.
Access Public
Syntax dwcontrol.instancename.of_GetSaturdayColor ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not required
when using u_calendar with an EditMask control)
instancena Instance name of u_calendar (the u_dw and u_em default for this value
me is iuo_calendar)
of_GetSundayColor
Description Retrieves the display color for Sundays.
434
Chapter 7 Custom Visual User Objects
Access Public
Syntax dwcontrol.instancename.of_GetSundayColor ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
of_IsAlwaysRedraw
Description Reports whether the u_calendar instance forces calendar redraw when display
properties change.
Access Public
Syntax dwcontrol.instancename.of_IsAlwaysRedraw ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Boolean. Returns TRUE if the u_calendar instance forces redraw and FALSE
if it does not.
Examples This example calls the of_IsAlwaysRedraw function:
Boolean lb_redraw
n_cst_conversion lnv_conversion
lb_redraw = &
dw_1.iuo_calendar.of_IsAlwaysRedraw()
MessageBox("Calendar", "Redraw is " &
+ lnv_conversion.of_String(lb_redraw))
435
u_calendar
of_IsCloseOnClick
Description Reports whether the u_calendar instance closes when the user clicks a date.
Access Public
Syntax dwcontrol.instancename.of_IsCloseOnClick ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Boolean. Returns TRUE if the u_calendar instance closes when the user clicks
a date and FALSE if it does not.
Examples This example calls the of_IsCloseOnClick function:
Boolean lb_close
n_cst_conversion lnv_conversion
lb_close = &
dw_1.iuo_calendar.of_IsCloseOnClick()
MessageBox("Calendar", "Close on click is " &
+ lnv_conversion.of_String(lb_close))
of_IsCloseOnDClick
Description Reports whether the u_calendar instance closes when the user double-clicks a
date.
Access Public
Syntax dwcontrol.instancename.of_IsCloseOnDClick ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Boolean. Returns TRUE if the u_calendar instance closes when the user
double-clicks a date and FALSE if it does not.
Examples This example calls the of_IsCloseOnDClick function:
Boolean lb_close
n_cst_conversion lnv_conversion
436
Chapter 7 Custom Visual User Objects
lb_close = &
dw_1.iuo_calendar.of_IsCloseOnDClick()
MessageBox("Calendar", &
"Close on double-click is " &
+ lnv_conversion.of_String(lb_close))
of_IsDateType
Description Reports whether a specified DataWindow column uses the date data type.
Access Protected
Syntax dwcontrol.instancename.of_IsDateType ( datatype )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
datatype String specifying the data type
Return value Boolean. Returns TRUE if datatype is date and FALSE if it is not.
Usage Internal.
Examples This example is from the of_DropDown function:
...
IF NOT of_IsDateType(idw_requestor.Describe &
(ls_colname+".coltype")) THEN
Return -1
END IF
...
of_IsHolidayBold
Description Reports whether holidays are bold.
Access Public
Syntax dwcontrol.instancename.of_IsHolidayBold ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
437
u_calendar
Return value Boolean. Returns TRUE if holidays are bold and FALSE if they are not.
Examples This example calls the of_IsHolidayBold function:
IF dw_caltest.iuo_calendar.of_IsHolidayBold() THEN
MessageBox("Holidays", "Holidays are bold")
ELSE
MessageBox("Holidays", "Holidays are not bold")
END IF
of_IsInitialValue
Description Reports whether the u_calendar instance initializes blank fields with the
current date when the calendar displays.
Access Public
Syntax dwcontrol.instancename.of_IsInitialValue ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Boolean. Returns TRUE if the calendar initializes blank fields with the current
date and FALSE if it does not.
Examples This example calls the of_IsInitialValue function:
Boolean lb_today
n_cst_conversion lnv_conversion
lb_today = &
dw_caltest.iuo_calendar.of_IsInitialValue()
MessageBox("Calendar", &
"Use today’s date value is " &
+ lnv_conversion.of_String(lb_today))
of_IsMarkedDayBold
Description Reports whether marked days are bold.
Access Public
Syntax dwcontrol.instancename.of_IsMarkedDayBold ( )
438
Chapter 7 Custom Visual User Objects
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Boolean. Returns TRUE if marked days are bold and FALSE if they are not.
Examples This example calls the of_IsMarkedDayBold function:
IF dw_1.iuo_calendar.of_IsMarkedDayBold() THEN
MessageBox("Marked Days", "Marked days are bold")
ELSE
MessageBox("Marked Days", &
"Marked days are not bold")
END IF
of_IsRegistered
Description Reports whether a specified DataWindow column has been registered with this
instance of u_calendar.
Access Public
Syntax dwcontrol.instancename.of_IsRegistered ( column )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
instancename Instance name of u_calendar (the u_dw default for this value is
iuo_calendar)
column String specifying the column to search for
Return value Boolean. Returns TRUE if column has been registered and FALSE if it has not.
Examples This example calls the of_IsRegistered function:
...
IF NOT this.iuo_calendar.of_IsRegistered &
("birth_date") THEN
this.iuo_calendar.of_Register("birth_date")
END IF
...
of_IsSaturdayBold
Description Reports whether Saturdays are bold.
439
u_calendar
Access Public
Syntax dwcontrol.instancename.of_IsSaturdayBold ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Boolean. Returns TRUE if Saturdays are bold and FALSE if they are not.
Examples This example calls the of_IsSaturdayBold function:
IF dw_caltest.iuo_calendar. of_IsSaturdayBold () THEN
MessageBox("Saturdays", "Saturdays are bold")
ELSE
MessageBox("Saturdays", "Saturdays are not bold")
END IF
of_IsSundayBold
Description Reports whether Sundays are bold.
Access Public
Syntax dwcontrol.instancename.of_IsSundayBold ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Boolean. Returns TRUE if Sundays are bold and FALSE if they are not.
Examples This example calls the of_IsSundayBold function:
IF dw_caltest.iuo_calendar. of_IsSundayBold () THEN
MessageBox("Sundays", "Sundays are bold")
ELSE
MessageBox("Sundays", "Sundays are not bold")
END IF
of_RedirectFocus
Description Prevents the u_calendar instance from getting focus while it is hidden.
Access Protected
440
Chapter 7 Custom Visual User Objects
Syntax dwcontrol.instancename.of_RedirectFocus ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the dw_cal GetFocus event:
Post of_RedirectFocus()
of_Register
Registers columns that use the dropdown calendar. There are two syntaxes:
To register Use
One or all eligible columns, optionally specifying a display style Syntax 1
All eligible columns using a specified display style Syntax 2
441
u_calendar
Argument Description
style (Optional) Integer or u_calendar constant specifying the display
style of registered DataWindow columns:
• 1 or NONE (default) For columns that use the
DropDownListBox edit style, the calendar displays
automatically when the column gets focus. For columns that use
the Edit and EditMask edit styles, the calendar does not display
automatically; instead, you display the calendar by coding a call
to the u_dw pfc_DDCalendar event
• 2 or DDLB The function converts registered columns to the
DropDownListBox edit style. Users display the calendar by
clicking the down arrow, which disappears when the calendar
displays
• 3 or DDLB_WITHARROW The function converts registered
columns to the DropDownListBox edit style. Users display the
calendar by clicking the down arrow, which remains when the
calendar displays
Return value Integer. Returns the number of columns registered if the function succeeds, 0
if the column was already registered, and -1 if an error occurs. The number of
columns registered includes hidden columns.
Usage Call this function to register one or all date columns in a DataWindow.
To register all eligible columns in a DataWindow using a specified display
style, use Syntax 2.
Examples This example calls the of_Register function:
this.of_SetTransObject(SQLCA)
this.of_SetDropDownCalendar(TRUE)
this.iuo_calendar.of_Register("start_date", &
this.iuo_calendar.DDLB)
this.iuo_calendar.of_Register("termination_date", &
this.iuo_calendar.NONE)
this.iuo_calendar.of_Register("birth_date", &
this.iuo_calendar.DDLB)
this.of_Retrieve()
442
Chapter 7 Custom Visual User Objects
Return value Integer. Returns the number of columns registered if the function succeeds and
-1 if an error occurs. The number of columns registered includes hidden
columns.
Usage Call this function to register all Date columns in a DataWindow, using a
specified display style.
To register one or all eligible columns in a DataWindow, optionally specifying
a display style, use Syntax 1.
Examples This example calls the of_Register function:
this.of_SetTransObject(SQLCA)
this.of_SetDropDownCalendar(TRUE)
this.iuo_calendar.of_Register &
(this.iuo_calendar.NONE)
this.of_Retrieve()
of_Reset
Description Resets the u_calendar date to that displayed in the DataWindow column or
EditMask control.
Access Protected
443
u_calendar
Syntax dwcontrol.instancename.of_Reset ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_DropDown function:
...
li_rc = inv_dropdown.of_Position &
(idrg_requestor, FALSE)
IF li_rc < 0 THEN Return -1
of_Reset ()
This.Visible = TRUE
Return 1
...
of_SetAlwaysRedraw
Description Specifies whether the u_calendar instance forces calendar redraw when display
properties change.
Access Public
Syntax dwcontrol.instancename.of_SetAlwaysRedraw ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean indicating whether the u_calendar instance forces a
redraw when display properties change (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage You should enable automatic redraw if your application programmatically
changes a calendar’s holidays, special days, or other display properties.
Examples This example calls the of_SetAlwaysRedraw function:
dw_1.iuo_calendar.of_SetAlwaysRedraw(TRUE)
444
Chapter 7 Custom Visual User Objects
of_SetCloseOnClick
Description Specifies whether to hide the u_calendar instance when the user clicks a date.
Access Public
Syntax dwcontrol.instancename.of_SetCloseOnClick ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean specifying whether to hide the dropdown calendar when
the user clicks a date (TRUE) or leave it displayed (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetCloseOnClick function:
this.of_SetTransObject(SQLCA)
this.of_SetDropDownCalendar(TRUE)
this.iuo_calendar.of_Register("start_date", &
this.iuo_calendar.DDLB)
this.iuo_calendar.of_Register("termination_date")
this.iuo_calendar.of_Register("birth_date", &
this.iuo_calendar.DDLB)
this.iuo_calendar.of_SetCloseOnClick(FALSE)
this.iuo_calendar.of_SetInitialValue(TRUE)
of_SetCloseOnDClick
Description Specifies whether to hide the u_calendar instance when the user double-clicks
a date.
Access Public
Syntax dwcontrol.instancename.of_SetCloseOnDClick ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean specifying whether to hide the dropdown calendar when
the user double-clicks a date (TRUE) or leave it displayed (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
445
u_calendar
of_SetDate
Description Sets the current date, optionally updating the date in the associated
DataWindow column or EditMask control.
Access Protected
Syntax dwcontrol.instancename.of_SetDate ( date, sendtorequestor )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
date Date variable containing the new date
sendtorequestor Boolean indicating whether to copy date to the requestor object
(TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_Reset function:
...
id_resetdate = date(ls_date)
IF of_IsValid(id_resetdate) THEN
of_SetDate(id_resetdate, FALSE)
ELSE
of_SetDate(Today(), ib_InitialValue)
END IF
Return 1
of_SetDateFormat
Description Sets the format for dates converted to strings.
Access Public
446
Chapter 7 Custom Visual User Objects
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage When using a calendar with an EditMask control, this format must match the
date mask.
When you use this function for a DataWindow column, it overrides the
DataWindow edit mask, if one was specified. Also, when applied to a
DataWindow column, the format argument must be compatible with the client
system default date format.
Examples This example calls the of_SetDateFormat function:
...
this.iuo_calendar.of_SetInitialValue(TRUE)
this.iuo_calendar.of_SetDateFormat("dd/mm/yy")
of_SetDropDown
Description Enables or disables the dropdown service (n_cst_dropdown).
Access Public
Syntax dwcontrol.instancename.of_SetDropDown ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean specifying whether to enable (TRUE) or disable (TRUE)
the dropdown service
Return value Integer. Returns 1 if the function succeeds, 0 if the dropdown service already
exists, and -1 if an error occurs.
447
u_calendar
of_SetFocusOnRequestor
Description Returns focus to the associated DataWindow column or EditMask control.
Access Protected
Syntax dwcontrol.instancename.of_SetFocusOnRequestor ( )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the dw_cal DoubleClicked event:
...
IF IsValid(inv_dropdown) THEN
IF ib_closeondclick THEN
of_SetFocusOnRequestor()
END IF
END IF
of_SetHoliday
Description Specifies the holidays displayed on the calendar.
Access Public
Syntax dwcontrol.instancename.of_SetHoliday ( holidays )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
holidays Date array containing holidays
448
Chapter 7 Custom Visual User Objects
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetHoliday function:
Date ld_holidays[11]
ld_holidays[1] = 1997-01-01
ld_holidays[2] = 1997-02-17
ld_holidays[3] = 1997-04-21
ld_holidays[4] = 1997-05-26
ld_holidays[5] = 1997-07-04
ld_holidays[6] = 1997-09-01
ld_holidays[7] = 1997-10-13
ld_holidays[8] = 1997-11-27
ld_holidays[9] = 1997-11-28
ld_holidays[10] = 1997-12-25
ld_holidays[11] = 1997-12-26
this.iuo_calendar.of_SetHoliday(ld_holidays)
of_SetHolidayBold
Description Sets the Bold property for holidays.
Access Public
Syntax dwcontrol.instancename.of_SetHolidayBold ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean indicating whether holidays are bold (TRUE) or not
(FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetHolidayBold function:
...
this.iuo_calendar.of_SetHoliday(ld_holidays)
this.iuo_calendar.of_SetHolidayBold (TRUE)
this.iuo_calendar.of_SetHolidayColor(RGB(0,255,0))
of_SetHolidayColor
Description Sets the display color for holidays.
449
u_calendar
Access Public
Syntax dwcontrol.instancename.of_SetHolidayColor ( color )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
color Long specifying the color for holidays
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetHolidayColor function:
...
this.iuo_calendar.of_SetHoliday(ld_holidays)
this.iuo_calendar.of_SetHolidayBold(TRUE)
this.iuo_calendar.of_SetHolidayColor(RGB(0,255,0))
of_SetInitialValue
Description Specifies whether the u_calendar instance initializes blank fields with the
current date when the calendar displays.
Access Public
Syntax dwcontrol.instancename.of_SetInitialValue ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean indicating whether the calendar initializes the blank fields
with the current date when the calendar displays (TRUE) or not
(FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetInitialValue function:
...
this.iuo_calendar.of_SetInitialValue(TRUE)
...
450
Chapter 7 Custom Visual User Objects
of_SetMarkedDay
Description Specifies a set of marked days. Marked days are not holidays but still require
special display on the calendar.
Access Public
Syntax dwcontrol.instancename.of_SetMarkedDay ( markeddays )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
markeddays Date array containing marked days
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetMarkedDay function:
Date ld_marked_days[12]
ld_marked_days[1] = 1996-06-13
ld_marked_days[2] = 1996-03-16
ld_marked_days[3] = 1996-09-23
ld_marked_days[4] = 1996-09-14
ld_marked_days[5] = 1997-06-13
ld_marked_days[6] = 1997-03-16
ld_marked_days[7] = 1997-09-23
ld_marked_days[8] = 1997-09-14
ld_marked_days[9] = 1998-06-13
ld_marked_days[10] = 1998-03-16
ld_marked_days[11] = 1998-09-23
ld_marked_days[12] = 1998-09-14
this.iuo_calendar.of_SetMarkedDay(ld_marked_days)
of_SetMarkedDayBold
Description Sets the Bold property for marked days.
Access Public
Syntax dwcontrol.instancename.of_SetMarkedDayBold ( boolean )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
451
u_calendar
Argument Description
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean indicating whether marked days are bold (TRUE) or not
(FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetMarkedDayBold function:
...
this.iuo_calendar.of_SetMarkedDayBold(TRUE)
this.iuo_calendar.of_SetMarkedDayColor &
(RGB(255, 0, 0))
of_SetMarkedDayColor
Description Sets the display color for marked days.
Access Public
Syntax dwcontrol.instancename.of_SetMarkedDayColor ( color )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
color Long specifying the color for marked days
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetMarkedDayColor function:
...
this.iuo_calendar.of_SetMarkedDayBold(TRUE)
this.iuo_calendar.of_SetMarkedDayColor &
(RGB(255, 0, 0))
of_SetRequestor
Description Associates an instance of u_calendar with a DataWindow or EditMask control.
Access Public
Syntax dwcontrol.instancename.of_SetRequestor ( requestor )
452
Chapter 7 Custom Visual User Objects
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calculator with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
requestor DragObject referencing the DataWindow or EditMask control to
associate with this instance of u_calendar
of_SetSaturdayBold
Description Sets the Bold property for Saturdays.
Access Public
453
u_calendar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetSaturdayBold function:
this.iuo_calendar.of_SetSaturdayBold TRUE)
this.iuo_calendar.of_SetSaturdayColor &
(RGB(0, 255, 0))
of_SetSaturdayColor
Description Sets the display color for Saturdays.
Access Public
Syntax dwcontrol.instancename.of_SetSaturdayColor ( color )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
color Long specifying the color for Saturdays
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetSaturdayColor function:
this.iuo_calendar.of_SetSaturdayBold(TRUE)
this.iuo_calendar.of_SetSaturdayColor &
(RGB(0, 255, 0))
of_SetSundayBold
Description Sets the Bold property for Sundays.
Access Public
Syntax dwcontrol.instancename.of_SetSundayBold ( boolean )
454
Chapter 7 Custom Visual User Objects
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
boolean Boolean indicating whether Sundays are bold (TRUE) or not
(FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetSundayBold function:
this.iuo_calendar.of_SetSundayBold(TRUE)
this.iuo_calendar.of_SetSundayColor(RGB(0, 255, 0))
of_SetSundayColor
Description Sets the display color for Sundays.
Access Public
Syntax dwcontrol.instancename.of_SetSundayColor ( color )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control (not
required when using u_calendar with an EditMask control)
instancename Instance name of u_calendar (the u_dw and u_em default for this
value is iuo_calendar)
color Long specifying the color for Sundays
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetSundayColor function:
this.iuo_calendar.of_SetSundayBold(TRUE)
this.iuo_calendar.of_SetSundayColor(RGB(0, 255, 0))
of_UnRegister
Description Removes one or all columns from the list of registered columns.
Access Public
Syntax dwcontrol.instancename.of_Register ( { column } )
Argument Description
dwcontrol Instance name of the u_dw-based DataWindow control
455
u_calendar
Argument Description
instancename Instance name of u_calendar (the u_dw default for this is
iuo_calendar)
column (Optional) String specifying the column to be unregistered. If you
omit this argument, the function unregisters all columns
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_UnRegister function:
...
dw_emp.iuo_calendar.of_UnRegister("start_date")
...
456
Chapter 7 Custom Visual User Objects
u_progressbar
Description Progress bar control. Use u_progressbar to provide users with a visual
representation of percentage complete for long-running operations.
U_progressbar can be vertical or horizontal and can display either percent
complete or programmatically specified text.
Ancestry
Library PFCAPSRV.PBL
PFEAPSRV.PBL
Usage Use this control to display a progress bar for long-running operations.
To use u_progressbar:
1 Place an instance of the u_progressbar object on a window or user object.
2 Size the object to create an appropriately sized vertical or horizontal
progress bar.
3 Define defaults for the progress bar instance. This example defines
defaults in the Constructor event:
of_SetFillStyle(LEFTRIGHT)
of_SetDisplayStyle(PCTCOMPLETE)
457
u_progressbar
uo_progress.of_SetMaximum(100)
uo_progress.of_SetPosition(0)
FOR li_count = 1 TO &
uo_progress.of_GetMaximum() STEP 1
uo_progress.of_Increment(1)
// Additional code here to perform your process
NEXT
See also n_cst_winsrv_statusbar
u_hpb
u_vpb
Instance variables
U_progressbar includes instance variables:
Instance variable Description Data type Access Usage
BAR Constant set to 0 Integer Public Use with
of_SetDisplayStyle
BOTTOMTOP Constant set to 3 Integer Public Use with
of_SetFillStyle
ib_autoreset Controls autoreset Boolean Protected Set with
of_SetAutoReset.
Default is TRUE
ii_displaystyle Controls test displayed on Integer Protected Set with
progress bar of_DisplayStyle.
Default is BAR
ii_fillstyle Controls the direction in Integer Protected Set with
which the progress bar of_SetFillStyle. Default
fills is LEFTRIGHT
ii_maximum Value at which the Integer Protected Set with
incrementation process of_SetMaximum.
ends Default is 100
458
Chapter 7 Custom Visual User Objects
459
u_progressbar
Events
U_progressbar includes precoded events:
Constructor
RButtonDown
Constructor
Description Initializes progress bar settings.
Applies to U_progressbar
Usage This event executes when the progress bar object is created.
RButtonDown
Description Calls the parent’s RButtonDown event.
Applies to Dw_progress
Usage This event executes when the user right-clicks over the progress bar.
Functions
U_progressbar contains precoded object functions:
of_GetBackColor of_SetFillColor
of_GetCurrentText of_SetFillStyle
of_GetDisplayStyle of_SetFont
of_GetFillColor of_SetFontBold
of_GetFillStyle of_SetFontCharSet
of_GetInfo of_SetFontFace
of_GetMaximum of_SetFontFamily
of_GetMessageText of_SetFontItalic
of_GetMinimum of_SetFontPitch
of_GetPctComplete of_SetFontSize
of_GetPosition of_SetFontUnderline
of_GetStep of_SetMaximum
of_GetTextColor of_SetMessageText
of_Increment of_SetMinimum
of_IsAutoReset of_SetPosition
460
Chapter 7 Custom Visual User Objects
of_Reset of_SetStep
of_SetAutoReset of_SetTextColor
of_SetBackColor of_UpdateVisuals
of_SetDisplayStyle
of_GetBackColor
Description Retrieves the progress bar background color.
Access Public
Syntax instancename.of_GetBackColor ( )
Argument Description
instancename Instance name of u_progressbar
ll_backcolor = uo_progress.of_GetBackColor()
MessageBox("Progress Bar", &
"Background color property is " &
+ String(ll_backcolor))
of_GetCurrentText
Description Retrieves the text currently displayed on the progress bar. This function
retrieves any text displayed on the progress bar, not just the display text
specified by the of_SetMessageText function.
Access Public
Syntax instancename.of_GetCurrentText ( )
Argument Description
instancename Instance name of u_progressbar
ls_text = uo_progress.of_GetCurrentText()
461
u_progressbar
of_GetDisplayStyle
Description Retrieves the progress bar display style. The display style controls the
information that displays within the bar while tracking progress.
Access Public
Syntax instancename.of_GetDisplayStyle ( )
Argument Description
instancename Instance name of u_progressbar
li_displaystyle = uo_progress.of_GetDisplayStyle()
MessageBox("Progress Bar", &
"DisplayStyle property is " &
+ String(li_displaystyle))
of_GetFillColor
Description Retrieves the progress bar fill color.
Access Public
Syntax instancename.of_GetFillColor ( )
Argument Description
instancename Instance name of u_progressbar
462
Chapter 7 Custom Visual User Objects
ll_fillcolor = uo_progress.of_GetFillColor()
MessageBox("Progress Bar", &
"Fill color property is " &
+ String(ll_fillcolor))
of_GetFillStyle
Description Retrieves the progress bar fill style.
Access Public
Syntax instancename.of_GetFillStyle ( )
Argument Description
instancename Instance name of u_progressbar
li_fillstyle = uo_progress.of_GetFillStyle()
MessageBox("Progress Bar", &
"Fill style is " + String(li_fillstyle))
of_GetInfo
Description Retrieves object information.
Access Public
Syntax dwcontrol.instancename.of_GetInfo ( infoobject )
Argument Description
instancename Instance name of u_progressbar
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
463
u_progressbar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The DataWindow Properties window calls this function to access service
information:
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
uo_progress.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetMaximum
Description Retrieves the maximum value used by the progress bar incrementation process.
Access Public
Syntax instancename.of_GetMaximum ( )
Argument Description
instancename Instance name of u_progressbar
Return value Integer. Returns the maximum increment value for the progress bar.
Examples This example calls the of_GetMaximum function:
uo_progress.of_SetPosition(0)
FOR li_count = 1 TO &
uo_progress.of_GetMaximum() STEP 1
uo_progress.of_Increment(1)
// Additional code here to perform your process
NEXT
of_GetMessageText
Description Retrieves the progress messages specified in the of_SetMessageText function.
Access Public
Syntax instancename.of_GetMessageText ( text )
Argument Description
instancename Instance name of u_progressbar
text String array into which the function places the progress
messages (passed by reference)
464
Chapter 7 Custom Visual User Objects
Return value Integer. Returns the number of elements in the text array.
Examples This example calls the of_GetMessageText function:
String ls_text[], ls_all
Integer li_size, li_count
li_size = uo_progress.of_GetMessageText(ls_text)
of_GetMinimum
Description Retrieves the minimum value used by the incrementation process. This value
is the baseline from which the incrementation process begins.
Access Public
Syntax instancename.of_GetMinimum ( )
Argument Description
instancename Instance name of u_progressbar
Return value Integer. Returns the minimum value for the incrementation process.
Examples This example calls the of_GetMinimum function:
Integer li_min
li_min = uo_progress.of_GetMinimum )
MessageBox("Progress Bar", &
"Minimum value is " &
+ String(li_min))
of_GetPctComplete
Description Retrieves the progress bar’s current percent complete.
Access Public
Syntax instancename.of_GetPctComplete ( )
Argument Description
instancename Instance name of u_progressbar
465
u_progressbar
Return value Integer. Returns the current percent complete for the progress bar.
Examples This example calls the of_GetPctComplete function:
Integer li_count
of_GetPosition
Description Retrieves the progress bar’s current increment value.
Access Public
Syntax instancename.of_GetPosition ( )
Argument Description
instancename Instance name of u_progressbar
Return value Integer. Returns the current increment value for the progress bar.
Examples This example calls the of_GetPosition function:
Integer li_count
of_GetStep
Description Retrieves the step value the progress bar uses during a default increment
process.
466
Chapter 7 Custom Visual User Objects
Access Public
Syntax instancename.of_GetStep ( )
Argument Description
instancename Instance name of u_progressbar
li_step = uo_progress.of_GetStep()
MessageBox("Progress Bar", &
"Step value is " + String(li_step))
of_GetTextColor
Description Retrieves the text color for the progress bar.
Access Public
Syntax instancename.of_GetTextColor ( )
Argument Description
instancename Instance name of u_progressbar
ll_color = uo_progress.of_GetTextColor()
MessageBox("Progress Bar", &
"Current text color is " + String(ll_color))
of_Increment
Description Increments progress by either the default increment value or by a specified
value.
Access Public
Syntax instancename.of_Increment ( { incrementvalue } )
Argument Description
instancename Instance name of u_progressbar
467
u_progressbar
Argument Description
incrementvalue Integer specifying the increment value. The default increment
(optional) value is 10, which you can modify by calling the of_SetStep
function
uo_progress.of_SetPosition(0)
FOR li_count = 1 TO &
uo_progress.of_GetMaximum() STEP 1
uo_progress.of_Increment(1)
// Additional code here to perform your process
NEXT
of_IsAutoReset
Description Reports whether the progress bar returns to zero after it reaches 100%.
Access Public
Syntax instancename.of_IsAutoReset ( )
Argument Description
instancename Instance name of u_progressbar
Return value Boolean. Returns TRUE if u_progressbar clears the progress bar when it
reaches 100% and FALSE if it does not.
Examples This example calls the of_IsAutoReset function:
n_cst_conversion lnv_conversion
Boolean lb_autoreset
lb_autoreset = uo_progress.of_IsAutoReset()
MessageBox("Progress Bar", &
"Autoreset property is " &
+ lnv_conversion.of_String(lb_autoreset))
of_Reset
Description Clears the progress bar, setting the position to the minimum and percent
complete to zero.
Access Public
468
Chapter 7 Custom Visual User Objects
Syntax instancename.of_Reset ( )
Argument Description
instancename Instance name of u_progressbar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example is from the of_SetPosition function:
...
IF ldc_completion >= 1 and ib_autoreset THEN
this.Post Function of_Reset()
END IF
...
of_SetAutoReset
Description Specifies whether to clear the progress bar when it reaches 100%. The progress
bar reaches 100% when the incrementation process reaches the maximum
value.
Access Public
Syntax instancename.of_SetAutoReset ( boolean )
Argument Description
instancename Instance name of u_progressbar
boolean Boolean indicating whether to clear the status bar when it
reaches 100% (TRUE) or leave it visible (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAutoReset function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetAutoReset(FALSE)
of_SetBackColor
Description Sets the background color of the progress bar.
Access Public
Syntax instancename.of_SetBackColor ( color )
Argument Description
instancename Instance name of u_progressbar
469
u_progressbar
Argument Description
color Long specifying the progress bar fill color. The default is
78682240 (light gray)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example from the Constructor event of a u_progressbar instance calls the
of_SetBackColor function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetBackColor (RGB(255, 0, 0)) // Red
of_SetAutoReset(FALSE)
of_SetDisplayStyle
Description Sets a display style for the progress bar. The display style controls the
information that displays within the bar while tracking progress.
Access Public
Syntax instancename.of_SetDisplayStyle ( displaystyle )
Argument Description
instancename Instance name of u_progressbar
displaystyle Integer or u_progressbar constant specifying the progress bar
display style:
• 0 or BAR (default) Bar only, no text
• 1 or PCTCOMPLETE Bar displays percent complete,
including the percent sign
• 2 or POSITION Bar displays the current increment value
• 3 or MSGTEXT Bar displays text, as specified by the
of_SetMessageText function
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage If you use MSGTEXT, you must also call the of_SetMessageText function to
specify the text displayed in the status bar.
Examples This example from the Constructor event of a u_progressbar instance calls the
of_SetDisplayStyle function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
470
Chapter 7 Custom Visual User Objects
of_SetFillColor
Description Sets the fill color of the progress bar.
Access Public
Syntax instancename.of_SetFillColor ( color )
Argument Description
instancename Instance name of u_progressbar
color Long specifying the progress bar fill color. The default is
16668075 (blue)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example from the Constructor event of a u_progressbar instance calls the
of_SetFillColor function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor (RGB(128, 128, 128))
of_SetFillStyle
Description Sets a fill style for the progress bar.
Access Public
Syntax instancename.of_SetFillStyle ( style )
Argument Description
instancename Instance name of u_progressbar
style Integer or u_progressbar constant specifying the fill style:
• 0 or TOPDOWN The bar fills from top to bottom
• 1 or BOTTOMUP The bar fills from bottom to top
• 2 or LEFTRIGHT (default) The bar fills from left to right
• 3 or RIGHTLEFT The bar fills from right to left
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetFillStyle function:
of_SetFillStyle (BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor(RGB(128, 128, 128))
471
u_progressbar
of_SetFont
Description Changes the font displayed in the progress bar.
Access Protected
Syntax instancename.of_SetFont ( fontface, fontsize, fontcharset, fontfamily,
fontpitch, bold, italic, underline )
Argument Description
instancename Instance name of u_progressbar
fontface String specifying the new font. If you pass a NULL, the function
does not change the font
fontsize Integer specifying the point size of the new font. If you pass a
NULL, the function does not change the font size
fontcharset Integer specifying the character set:
• 0–ANSI
• 1–The default character set for the specified font
• 2–Symbol
• 3–Shift JIS
• 4–OEM
If you pass a NULL, the function does not change the font
character set
fontfamily FontFamily enumerated data type specifying the font family:
• AnyFont!
• Roman!
• Swiss!
• Modern!
• Script!
• Decorative!
If you pass a NULL, the function does not change the font family
fontpitch FontPitch enumerated data type specifying the pitch of the new
font:
• Default!
• Fixed!
• Variable!
If you pass a NULL, the function does not change the pitch
472
Chapter 7 Custom Visual User Objects
Argument Description
bold Boolean specifying whether text is bold:
• TRUE—Bold
• FALSE—Not bold (default)
If you pass a NULL, the function does not change the Bold
property
italic Boolean specifying whether text is italic:
• TRUE—Italic
• FALSE—Not italic (default)
If you pass a NULL, the function does not change the italic
property
underline Boolean specifying whether text is underlined:
• TRUE—Underlined
• FALSE—Not underlined (default)
If you pass a NULL, the function does not change the underline
property
Return value String. Returns the result of the Modify PowerScript function that changes the
font; an empty string indicates success.
Usage Internal.
Examples This example is from the of_SetFontBold function:
String ls_fontface
Long ll_fontsize
FontFamilylff_fontfamily
FontPitchlfp_fontpitch
Boolean lb_bold, lb_italic, lb_underline
SetNull(ls_fontface)
SetNull(ll_fontsize)
SetNull(lff_fontfamily)
SetNull(lfp_fontpitch)
SetNull(lb_bold)
SetNull(lb_italic)
SetNull(lb_underline)
473
u_progressbar
of_SetFontBold
Description Sets the Bold property for progress bar text.
Access Public
Syntax instancename.of_SetFontBold ( boolean )
Argument Description
instancename Instance name of u_progressbar
boolean Boolean specifying whether progress bar text is bold (TRUE)
or not (FALSE)
Return value String. Returns the result of the Modify PowerScript function that changes the
Bold property; an empty string indicates success.
Examples This example calls the of_SetFontBold function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor(RGB(128, 128, 128))
of_SetFontBold(TRUE)
of_SetFontCharSet
Description Sets the CharSet property for progress bar text.
Access Public
Syntax instancename.of_SetFontCharSet ( fontcharset )
Argument Description
instancename Instance name of u_progressbar
fontcharset Integer specifying the character set:
• 0–ANSI
• 1–The default character set for the specified font
• 2–Symbol
• 3–Shift JIS
• 4–OEM
Return value String. Returns the result of the Modify PowerScript function that changes the
font face; an empty string indicates success.
Examples This example calls the of_SetFontCharSet function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor(RGB(128, 128, 128))
474
Chapter 7 Custom Visual User Objects
of_SetFontCharSet(1)
of_SetFontFamily(Script!)
of_SetFontSize(12)
of_SetFontFace
Description Sets the Face (typeface) property for progress bar text.
Access Public
Syntax instancename.of_SetFontFace ( fontface )
Argument Description
instancename Instance name of u_progressbar
fontface String specifying the font face (such as Arial)
Return value String. Returns the result of the Modify PowerScript function that changes the
font face; an empty string indicates success.
Examples This example from the Constructor event of a u_progressbar instance calls the
of_SetFontFace function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor(RGB(128, 128, 128))
of_SetFontFace("Monotype Corsiva")
of_SetFontFamily(Script!)
of_SetFontFamily
Description Sets the font Family property (such as Roman) for progress bar text.
Access Public
Syntax instancename.of_SetFontFamily ( fontfamily )
Argument Description
instancename Instance name of u_progressbar
fontfamily FontFamily enumerated data type specifying the font family:
• AnyFont!
• Roman!
• Swiss!
• Modern!
• Script!
• Decorative!
475
u_progressbar
Return value String. Returns the result of the Modify PowerScript function that changes the
font family; an empty string indicates success.
Examples This example calls the of_SetFontFamily function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor(RGB(128, 128, 128))
of_SetFontFace("Monotype Corsiva")
of_SetFontFamily(Script!)
of_SetFontItalic
Description Sets the Italic property for progress bar text.
Access Public
Syntax instancename.of_SetFontItalic ( boolean )
Argument Description
instancename Instance name of u_progressbar
boolean Boolean specifying whether progress bar text is italic (TRUE)
or not (FALSE)
Return value String. Returns the result of the Modify PowerScript function that changes the
Italic property; an empty string indicates success.
Examples This example calls the of_SetFontItalic function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor(RGB(128, 128, 128))
of_SetFontItalic (TRUE)
of_SetFontPitch
Description Sets the Pitch property for progress bar text.
Access Public
Syntax instancename.of_SetFontPitch ( fontpitch )
Argument Description
instancename Instance name of u_progressbar
476
Chapter 7 Custom Visual User Objects
Argument Description
fontpitch FontPitch enumerated data type specifying the font pitch:
• Default!
• Fixed!
• Variable!
Return value String. Returns the result of the Modify PowerScript function that changes the
font pitch; an empty string indicates success.
Examples This example calls the of_SetFontPitch function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFillColor(RGB(128, 128, 128))
of_SetFontPitch(Variable!)
of_SetFontSize
Description Sets the Size property for progress bar text.
Access Public
Syntax instancename.of_SetFontSize ( fontsize )
Argument Description
instancename Instance name of u_progressbar
fontsize Long specifying the font size, in points, for the progress bar
text. Do not specify a negative number for this value
Return value String. Returns the result of the Modify PowerScript function that changes the
font size; an empty string indicates success.
Examples This example calls the of_SetFontSize function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFontSize(10)
of_SetFontUnderline
Description Sets the Underline property for progress bar text.
Access Public
Syntax instancename.of_SetFontUnderline ( boolean )
477
u_progressbar
Argument Description
instancename Instance name of u_progressbar
boolean Boolean specifying whether progress bar text is underlined
(TRUE) or not (FALSE)
Return value String. Returns the result of the Modify PowerScript function that changes the
underline property; an empty string indicates success.
Examples This example calls the of_SetFontUnderline function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetFontUnderline (TRUE)
of_SetMaximum
Description Sets the maximum increment value for the progress bar (also used as the basis
for the progress bar’s percent complete calculation).
Access Public
Syntax instancename.of_SetMaximum ( maximum )
Argument Description
instancename Instance name of u_progressbar
maximum Integer specifying the maximum increment value.
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The default for this value is 100. The of_SetPosition function uses this value as
the dividend in its percent complete calculation (percent complete = current
position/maximum * 100).
Examples This example calls the of_SetMaximum function:
SELECT COUNT(emp_id)
INTO :il_max
FROM Employee
USING SQLCA ;
IF il_max > 0 THEN
uo_progress.of_SetMaximum(il_max)
ELSE
MessageBox("SQL error", &
"SELECT COUNT failed~r~n" + SQLCA.SQLERRTEXT)
END IF
478
Chapter 7 Custom Visual User Objects
of_SetMessageText
Description Sets the text strings that display at regular intervals when the progress bar uses
the message text display style.
Access Public
Syntax instancename.of_SetMessageText ( text )
Argument Description
instancename Instance name of u_progressbar
text String array whose elements contain the values to display on
the progress bar
Return value Integer. Returns the number of elements in text if the function succeeds and -1
if an error occurs.
Usage You typically call this function after calling of_SetDisplayStyle(MSGTEXT).
Examples This example calls the of_SetMessageText function:
String ls_msgtext[ ] = {"Ten", "Twenty", &
"Thirty", "Forty", "Fifty", "Sixty", &
"Seventy", "Eighty", "Ninety", "One Hundred"}
of_SetDisplayStyle(MSGTEXT)
of_SetMessageText(ls_msgtext)
of_SetMinimum
Description Sets the initial increment value for the progress bar.
Access Public
Syntax instancename.of_SetMinimum ( minimum )
Argument Description
instancename Instance name of u_progressbar
minimum Integer specifying the initial increment value for the progress bar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The of_SetPosition and of_Reset functions use the minimum to determine the
initial position value.
Examples This example calls the of_SetMinimum function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetMinimum(0)
479
u_progressbar
of_SetPosition
Description Sets the progress bar’s current position and updates percent complete.
Access Public
Syntax instancename.of_SetPosition ( position )
Argument Description
instancename Instance name of u_progressbar
position Integer specifying the progress bar’s position
Return value Integer. Returns the current increment value if the function succeeds and -1 if
an error occurs.
Usage Call this function to establish an initial position for the progress bar before
beginning an incrementation process.
If position is less than the minimum (the default minimum is 0), this function
sets the position to the minimum. If position is greater than the maximum (the
default maximum is 100), this function sets the position to the maximum. You
modify the default minimum and maximum by calling the of_SetMinimum and
of_SetMaximum functions.
The of_Increment function calls this function to update the current position and
percent complete.
Examples This example calls the of_SetPosition function:
Integer li_count
uo_progress.of_SetPosition(0)
For li_count = 1 to 100 STEP 1
uo_progress.of_Increment(1)
NEXT
of_SetStep
Description Sets the step value the progress bar uses during a default increment process.
Access Public
Syntax instancename.of_SetStep ( stepvalue )
Argument Description
instancename Instance name of u_progressbar
stepvalue Integer specifying the default increment value
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
480
Chapter 7 Custom Visual User Objects
Usage The progress bar uses this value as the default when you call of_Increment with
no arguments.
Examples This example calls the of_SetStep function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetStep(5)
of_SetTextColor
Description Sets the color of text in the progress bar.
Access Public
Syntax instancename.of_SetTextColor ( color )
Argument Description
instancename Instance name of u_progressbar
color Long specifying the progress bar text color. The default is 0
(black)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example from the Constructor event of a u_progressbar instance calls the
of_SetTextColor function:
of_SetFillStyle(BOTTOMUP)
of_SetDisplayStyle(PCTCOMPLETE)
of_SetTextColor(RGB(255, 255, 255))
of_UpdateVisuals
Description Resizes the progress bar and updates the display text.
Access Protected
Syntax instancename.of_UpdateVisuals ( completionvalue )
Argument Description
instancename Instance name of u_progressbar
completionvalue Decimal specifying the completion value of the progress bar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
481
u_progressbar
482
Chapter 7 Custom Visual User Objects
u_st_splitbar
Description Splitbar service. Use this control to add splitbar functionality to two or more
controls in a window.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this object to add a splitbar to a window. To use this object:
1 Place the object on a window between two or more controls.
2 (Optional) If you are using the window resize service, register the splitbar:
this.of_SetResize(TRUE)
this.inv_resize.of_Register &
(tv_deptemp, 0, 0, 0, 100)
this.inv_resize.of_Register &
(st_splitbar, 0, 0, 0, 100)
this.inv_resize.of_Register &
(lv_empdetail, 0, 0, 0, 100)
3 Move and resize the splitbar object and the surrounding objects until they
relate appropriately. For example, a vertical splitbar between two objects
should have the same height as the surrounding objects.
4 Add code to the splitbar control’s Constructor event to register the controls
that resize when the user moves the splitbar:
this.of_Register(tv_1, LEFT
this.of_Register(lv_1, RIGHT)
this.of_SetBarColor(RGB(192, 192, 192))
See also n_cst_resize
483
u_st_splitbar
Instance variables
U_st_splitbar has instance variables:
Name Description Data type Access Usage
ABOVE Constant set to 3 Integer Public Use with
of_Register
BELOW Constant set to 4 Integer Public Use with
of_Register
BOTTOMMOST Constant set to 4 Integer Protected Internal
HORIZONTAL Constant set to 2 Integer Public Internal
ib_performredraw Controls redraw Boolean Protected Internal
idrg_lefttop[ ] Upper-left coordinate for all DragObject Protected Internal
registered controls
idwg_rightbottom[ ] Lower-right coordinate for all DragObject Protected Internal
registered controls
ii_barwidth Thickness of splitbar Integer Protected Internal
ii_lefttopbound Upper-left coordinate Integer Protected Internal
ii_minobjectsize Minimum object size Integer Protected Set with
of_SetMinObject
Size
ii_prevpositionx Previous x coordinate Integer Protected Internal
ii_prevpositiony Previous y coordinate Integer Protected Internal
ii_bottomrightbound Bottom right coordinate Integer Protected Internal
ii_rounding Rounding factor Integer Protected Internal
ii_style Splitbar style (horizontal or Integer Protected Set with
vertical) of_SetStyle
il_barcolor Splitbar color Long Protected Set with
of_SetBarColor
il_barmovecolor Splitbar color when it is being Long Protected Set with
moved of_SetBarMove
Color
ir_lefttopheight[ ] Left top height for all registered Real Protected Internal
controls
ir_lefttopwidth[ ] Left top width for all registered Real Protected Internal
controls
ir_lefttopx[ ] Top left x coordinate for all Real Protected Internal
registered controls
ir_lefttopy[ ] Top left y coordinate for all Real Protected Internal
registered controls
484
Chapter 7 Custom Visual User Objects
Events
U_st_splitbar includes precoded events:
Constructor MouseMove
LButtonUp
485
u_st_splitbar
Constructor
Description Automatically calculates the bar orientation (vertical or horizontal) and
initializes other status-bar settings.
Usage Add code to this event to register the controls that resize when the user moves
the splitbar.
Examples This example shows code you might add to the Constructor event:
this.of_Register(tv_1, LEFT)
this.of_Register(lv_1, RIGHT)
this.of_SetBarColor(RGB(192, 192, 192))
LButtonUp
Description Calls the of_LButtonUp function.
Usage PFC uses this event to resize objects when the user moves the splitbar.
MouseMove
Description Calls the of_MouseMove function.
Usage If the user presses the left mouse button, PFC uses this event to move the
splitbar, refresh the location, and redraw if necessary.
Functions
U_st_splitbar contains precoded object functions:
of_GetBarColor of_Redraw
of_GetBarMoveColor of_Register
of_GetExtremePoint of_SetBarColor
of_GetHorizontalPointer of_SetBarMoveColor
of_GetInfo of_SetHorizontalPointer
of_GetMinObjectSize of_SetMinObjectSize
of_GetVerticalPointer of_SetVerticalPointer
of_LButtonUp of_UpdateObjectData
of_MouseMove
486
Chapter 7 Custom Visual User Objects
of_GetBarColor
Description Retrieves the splitbar color.
Access Public
Syntax instancename.of_GetBarColor ( )
Argument Description
instancename Instance name of u_st_splitbar
of_GetBarMoveColor
Description Retrieves the color that displays when the splitbar is being moved.
Access Public
Syntax instancename.of_GetBarMoveColor ( )
Argument Description
instancename Instance name of u_st_splitbar
of_GetExtremePoint
Description Retrieves the specified extreme point coordinate.
Access Public
Syntax instancename.of_GetExtremePoint ( extremetype )
Argument Description
instancename Instance name of u_st_splitbar
487
u_st_splitbar
Argument Description
extremetype Integer or u_st_splitbar constant that specifies the extreme point
to be returned:
• 1 or LEFTMOST The extreme point to the left
• 2 or RIGHTMOST The extreme point to the right
• 3 or TOPMOST The extreme point at the top
• 4 or BOTTOMMOST The extreme point at the bottom
Return value Integer. Returns the coordinate of the specified extreme point.
Usage Internal.
Examples This example is from the of_LButtonUp function:
...
IF ii_style = HORIZONTAL THEN
li_miny = of_GetExtremePoint(TOPMOST)
li_maxy = of_GetExtremePoint(BOTTOMMOST)
...
of_GetHorizontalPointer
Description Retrieves the name of the pointer that displays when the cursor is over a
horizontal splitbar.
Access Public
Syntax instancename.of_GetHorizontalPointer ( )
Argument Description
instancename Instance name of u_st_splitbar
Return value String. Returns the name of the pointer that displays when the cursor is over a
horizontal splitbar.
Examples This example calls the of_GetHorizontalPointer function:
String ls_pointer
ls_pointer = st_1.of_GetHorizontalPointer()
MessageBox("Splitbar", &
"Horizontal pointer is " + ls_pointer)
of_GetInfo
Description Retrieves object information.
488
Chapter 7 Custom Visual User Objects
Access Public
Syntax dwcontrol.instancename.of_GetInfo ( infoobject )
Argument Description
instancename Instance name of u_st_splitbar
infoobject N_cst_infoattrib instance into which the function places
information (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The DataWindow Properties window calls this function to access service
information:
Examples This example calls the of_GetInfo function:
n_cst_infoattrib lnv_info
uo_splitbar.of_GetInfo(lnv_info)
MessageBox("Info", &
"Description: " + lnv_info.is_description &
+ ". Name: " + lnv_info.is_name)
of_GetMinObjectSize
Description Retrieves the minimum size (in PBUs) for registered objects.
Access Public
Syntax instancename.of_GetMinObjectSize ( )
Argument Description
instancename Instance name of u_st_splitbar
Return value Integer. Returns the minimum size for registered objects.
Examples This example calls the of_GetMinObjectSize function:
Integer li_minsize
li_minsize = st_1.of_GetMinObjectSize()
MessageBox("Splitbar", &
"Minimum size is " + String(li_minsize))
of_GetVerticalPointer
Description Retrieves the name of the pointer that displays when the cursor is over a
vertical splitbar.
489
u_st_splitbar
Access Public
Syntax instancename.of_GetVerticalPointer ( )
Argument Description
instancename Instance name of u_st_splitbar
Return value String. Returns the name of the pointer that displays when the cursor is over a
vertical splitbar.
Examples This example calls the of_GetVerticalPointer function:
String ls_pointer
ls_pointer = st_1.of_GetVerticalPointer()
MessageBox("Splitbar", &
"Vertical pointer is " + ls_pointer)
of_LButtonUp
Description Resizes registered objects when the user releases the left mouse button.
Access Protected
Syntax instancename.of_LButtonUp ( flags, x, y )
Argument Description
instancename Instance name of u_st_splitbar
flags UnsignedLong indicating the modifier keys and mouse buttons
that were pressed
x Integer indicating the x position of the mouse click
y Integer indicating the y position of the mouse click
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the LButtonUp event:
of_LButtonUp(flags, xpos, ypos)
of_MouseMove
Description Refreshes the screen as the user moves the splitbar.
Access Protected
Syntax instancename.of_MouseMove ( flags, x, y )
490
Chapter 7 Custom Visual User Objects
Argument Description
instancename Instance name of u_st_splitbar
flags UnsignedLong indicating the modifier keys and mouse buttons
that are currently pressed
x Integer indicating the x position of the mouse
y Integer indicating the y position of the mouse
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the MouseMove event:
IF NOT KeyDown(keyLeftButton!) THEN
Return
END IF
of_MouseMove(flags, xpos, ypos)
of_Redraw
Description Redraws objects adjacent to the splitbar.
Access Protected
Syntax instancename.of_Redraw ( x, width, y, height )
Argument Description
instancename Instance name of u_st_splitbar
x Integer specifying the splitbar’s previous x coordinate
width Integer specifying the splitbar’s previous width
y Integer specifying the splitbar’s previous y coordinate
height Integer specifying the splitbar’s previous height
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_MouseMove function:
...
IF ii_style = HORIZONTAL THEN
this.Y = li_pointery
this.Height = ii_barwidth
IF ib_performredraw THEN
IF (li_prevy <> this.Y) THEN
of_Redraw(li_prevx, li_prevwidth, &
li_prevy, li_prevheight)
491
u_st_splitbar
END IF
END IF
...
of_Register
Description Registers the controls to be moved and resized when the user moves the
splitbar.
Access Public
Syntax instancename.of_Register ( control, relativeposition )
Argument Description
instancename Instance name of u_st_splitbar
control DragObject containing the control to be registered
relativeposition Integer or u_st_splitbar constant specified how the service
positions control relative to the splitbar:
• 1 or LEFT Position control to the left of the splitbar
• 2 or RIGHT Position control to the right of the splitbar
• 3 or ABOVE Position control above the splitbar
• 4 or BELOW Position control below the splitbar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function in the splitbar’s Constructor event to specify the controls
affected by the splitbar.
Examples This example calls the of_Register function:
this.of_Register (tv_1, LEFT)
this.of_Register (lv_1, RIGHT)
this.of_SetBarColor(RGB(192, 192, 192))
of_SetBarColor
Description Specifies the splitbar color.
Access Public
Syntax instancename.of_SetBarColor ( color )
Argument Description
instancename Instance name of u_st_splitbar
color Long specifying the splitbar color. The default bar color is
maintained in the il_barcolor instance variable
492
Chapter 7 Custom Visual User Objects
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function in the splitbar’s Constructor event.
Examples This example calls the of_SetBarColor function:
this.of_SetBarColor(RGB(192, 192, 192))
of_SetBarMoveColor
Description Specifies the color that displays when the splitbar is being moved.
Access Public
Syntax instancename.of_SetBarMoveColor ( color )
Argument Description
instancename Instance name of u_st_splitbar
color Long specifying the splitbar color when the user moves it. The
default bar move color is maintained in the il_barmovecolor
instance variable
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function in the splitbar’s Constructor event.
Examples This example calls the of_SetBarMoveColor function:
this.of_Register(tv_1, LEFT)
this.of_Register(lv_1, RIGHT)
this.of_SetBarColor(RGB(192, 192, 192))
this.of_SetBarMoveColor(RGB(0, 0, 0))
of_SetHorizontalPointer
Description Specifies the name of the pointer that displays when the cursor is over a
horizontal splitbar.
Access Public
Syntax instancename.of_SetHorizontalPointer ( pointername )
Argument Description
instancename Instance name of u_st_splitbar
493
u_st_splitbar
Argument Description
pointername String specifying the pointer that displays when the cursor is
over a horizontal splitbar. This can be one of the following:
• Arrow!
• Beam!
• Cross!
• Hourglass!
• SizeNESW!
• SizeNS! (default)
• SizeNWSE!
• SizeWE!
• Uparrow!
• Name of a customized cursor file (CUR extension). This file
must be accessible at execution time
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function in the splitbar’s Constructor event.
Examples This example calls the of_SetHorizontalPointer function:
this.of_Register(tv_1, LEFT)
this.of_Register(lv_1, RIGHT)
this.of_SetHorizontalPointer ("SizeNS!")
of_SetMinObjectSize
Description Specifies the minimum size (in PBUs) for registered objects.
Access Public
Syntax instancename.of_SetMinObjectSize ( minimumsize )
Argument Description
instancename Instance name of u_st_splitbar
minimumsize Integer specifying the minimum size (in PBUs) for registered
objects
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function in the splitbar’s Constructor event.
Examples This example calls the of_SetMinObjectSize function:
this.of_Register(tv_1, LEFT)
this.of_Register(lv_1, RIGHT)
494
Chapter 7 Custom Visual User Objects
this.of_SetBarColor(RGB(192,192,192))
this.of_SetBarMoveColor(RGB(128, 128, 128))
this.of_SetMinObjectSize(100)
of_SetVerticalPointer
Description Specifies the name of the pointer that displays when the cursor is over a vertical
splitbar.
Access Public
Syntax instancename.of_SetVerticalPointer ( pointername )
Argument Description
instancename Instance name of u_st_splitbar
pointername String specifying the pointer that displays when the cursor is
over a vertical splitbar. This can be one of the following:
• Arrow!
• Beam!
• Cross!
• Hourglass!
• SizeNESW!
• SizeNS! (default)
• SizeNWSE!
• SizeWE!
• Uparrow!
• Filename of a customized cursor file (CUR extension). This
file must be accessible at execution time
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function in the splitbar’s Constructor event.
Examples This example calls the of_SetVerticalPointer function:
this.of_Register(tv_1, LEFT)
this.of_Register(lv_1, RIGHT)
this.of_SetBarColor(RGB(192,192,192))
this.of_SetVerticalPointer("SizeWE!")
of_UpdateObjectData
Description Updates the instance variables that maintain object coordinates.
Access Protected
495
u_st_splitbar
Syntax instancename.of_UpdateObjectData ( )
Argument Description
instancename Instance name of u_st_splitbar
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
Examples This example is from the of_LButtonUp function:
...
li_deltax = li_pointerx - ii_prevpositionx
li_deltay = li_pointery - ii_prevpositiony
of_UpdateObjectData()
...
496
Chapter 7 Custom Visual User Objects
u_tabpg
Description Tab page visual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this visual object in the User Object painter as the ancestor for all tab
pages. After defining the tab page’s appearance and functionality, you then
place these tab pages on tab user objects in the User Object painter. To insert a
tab page object, click the right mouse button on a tab control, select Insert
UserObject, and double-click on a u_tabpg descendant.
See also u_tab
497
u_tabpg
498
CH A PTE R 8 Standard Class User Objects
About this chapter This chapter describes the standard class user objects in PFC.
Contents The standard class user objects are listed in alphabetical order. Each
object’s discussion includes an alphabetical listing of instance variables,
events, and object functions.
499
n_cn
n_cn
Description Connection object for use with all distributed PFC applications. You can either
use this object as is or create descendants that include customized or extended
functionality.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use n_cn whenever you would normally create a Connection object. By calling
the of_Init function, you can easily initialize the Connection object.
To use n_cn:
1 Declare a variable of type n_cn (this example declares an instance
variable):
n_cn icn_connection
2 Create the Connection object:
icn_connection = CREATE n_cn
3 Call the of_Init function to initialize Connection object fields:
icn_connection.of_Init &
(gnv_app.of_GetAppINIFile(),"Connect")
4 Continue the distributed application as appropriate.
See also n_trp
Functions
N_cn includes precoded object functions:
of_Init
of_MessageBox
500
Chapter 8 Standard Class User Objects
of_Init
Description Initializes a Connection object’s properties using values from an INI file
section or registry key.
Access Public
Syntax instancename.of_Init ( fileorkey, section )
Argument Description
instancename Instance name of n_cn
fileorkey String specifying either the INI file or the registry key containing
connection information. If you specify the INI file, you must also
specify section
section String specifying the INI file section containing connection
information. If fileorkey specifies an INI file, you must specify
this value; if fileorkey specifies a registry key, you cannot specify
this value
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage The INI file section or registry key must contain the following keywords:
Application
ConnectString
Driver
Location
Options
Password
Trace
UserID
If the INI file section or registry key doesn’t have a value, the function defaults
the value to an empty string.
For complete information on distributed computing, see Application
Techniques.
Examples This example calls the of_Init function (assuming an icn_connection instance
variable):
Integer li_return
501
n_cn
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_cn
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Connection objects.
502
Chapter 8 Standard Class User Objects
503
n_cxinfo
n_cxinfo
Description ContextInformation nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder
ContextInformation object.
See also n_cxk
n_inet
n_ir
n_srv
504
Chapter 8 Standard Class User Objects
n_cxk
Description ContextKeyword nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder
ContextKeyword object.
See also n_cxinfo
n_inet
n_ir
n_srv
505
n_dda
n_dda
Description DynamicDescriptionArea nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder
DynamicDescriptionArea object.
See also n_dsa
n_err
n_msg
n_tr
506
Chapter 8 Standard Class User Objects
n_ds
Description DataStore object for use with all PFC applications. This user object includes:
• Functions to enable and disable DataStore services
• Events and functions that call DataStore services
• Events and functions that are called by the logical unit of work service
You can either use this object asis or create descendants that include
customized or extended functionality.
N_ds is a self-updating object.
Ancestry
Library PFCMAIN.PBL
PFEAPSRV.PBL
Object relationships n_cst_conversion
n_cst_dssrv
n_cst_dssrv_multitable
n_cst_dssrv_printpreview
n_cst_dssrv_report
n_cst_platform
n_tr
s_pagesetupattrib
507
n_ds
s_printdlgattrib
w_master
Usage Use n_ds whenever you would normally create a DataStore. N_ds has the same
relationship to n_cst_dssrv as u_dw has to n_cst_dwsrv.
To use n_ds:
1 Declare a variable of type n_ds (this example declares an instance
variable):
n_ds ids_datastore
2 Create the DataStore:
ids_datastore = CREATE n_ds
3 Associate a DataWindow object with the DataStore:
ids_datastore.DataObject = "d_emplist"
4 Set the Transaction object by calling the of_SetTransObject function:
ids_datastore.of_SetTransObject(SQLCA)
5 (Optional) Enable DataStore services:
inv_datastore.of_SetPrintPreview(TRUE)
inv_datastore.of_SetReport(TRUE)
6 Add code to the pfc_Retrieve event to retrieve rows:
Return this.Retrieve()
7 Access data and perform other DataStore functions as needed. This
example retrieves data:
inv_datastore.of_Retrieve()
See also n_cst_dwsrv
u_dw
508
Chapter 8 Standard Class User Objects
Instance variables
N_ds contains instance variables.
Instance variable Description Data type Access Usage
ib_append Indicates whether Boolean Protected Set with of_SetAppend
the Retrieve
function appends
ib_isupdateable Indicates whether Boolean Protected Set with
the DataStore is of_SetUpdateable
updatable
inv_base Reference variable n_cst_dssrv Public Use in dot notation to
for basic DataStore access n_cst_dssrv
service functions and events
inv_multitable Reference variable n_cst_dssrv_multitable Public Use in dot notation to
for multitable access
update service n_cst_dssrv_multitable
functions and events
inv_printpreview Reference variable n_cst_dssrv_printpreview Public Use in dot notation to
for print preview access
service n_cst_dssrv_printpreview
functions and events
inv_report Reference variable n_cst_dssrv_report Public Use in dot notation to
for report service access n_cst_dssrv_report
functions and events
ipo_updaterequestor Update requestor PowerObject Protected Set with
of_SetUpdateRequestor
is_updatesallowed Specifies allowable String Protected Internal
updates
itr_object Transaction object n_tr Public Set with
used by the of_SetTransObject
DataStore
Events
N_ds includes precoded event scripts:
DBError pfc_ResetUpdate
Destructor pfc_Retrieve
pfc_PageSetup pfc_Ruler
pfc_PageSetupDlg pfc_Update
pfc_PostUpdate pfc_UpdatePrep
509
n_ds
pfc_PrePageSetupDlg pfc_UpdatesPending
pfc_PrePrintDlg pfc_Validation
pfc_Print pfc_Zoom
pfc_PrintDlg RetrieveStart
pfc_PrintImmediate SQLPreview
pfc_PrintPreview
DBError
Description Displays a message box informing the user that a database error occurred.
Usage This event is called when there is a database error.
Because DBError calls the of_GetParentWindow function, a parent window is
required. To let the DataStore know its parent window, you can call the
of_SetParentWindow function after the DataStore creation.
Destructor
Description Destroys all existing DataStore service objects.
Usage This event executes when the DataStore is destroyed.
pfc_PageSetup
Description Calls the pfc_PageSetupDlg event to display the Page Setup dialog box.
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
pfc_PageSetupDlg
Description Displays the Page Setup dialog box by calling the n_cst_platform
of_PageSetupDlg function, passing the DataWindow’s page display properties.
Syntax instancename.Event pfc_PageSetupDlg ( attributes )
Argument Description
instancename Instance name of n_ds
attributes S_pagesetupattrib variable into which the event places page setup
information. This argument is accessed through the astr_pagesetup
argument (passed by reference)
510
Chapter 8 Standard Class User Objects
Return value Integer. Returns 1 if the event succeeds, 0 if the user cancels out of the dialog
box, and -1 if an error occurs.
Usage This event is called by the pfc_PageSetup event.
pfc_PostUpdate
Description Clears the DataStore update flags.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage You can extend this event to code additional post update processing.
Examples This example is from the of_PostUpdate function:
Return this.Event pfc_PostUpdate()
pfc_PrePageSetupDlg
Description Empty user event allowing you to modify the properties passed to the
n_cst_platform of_PageSetupDlg function.
Syntax instancename.Event pfc_PrePageSetupDlg ( attributes )
Argument Description
instancename Instance name of n_ds
attributes S_pagesetupattrib variable into which the event places additional
page setup information. This argument is accessed through the
astr_pagesetup argument (passed by reference)
Usage This event is called by the pfc_PageSetupDlg event before calling the
n_cst_platform of_PageSetupDlg function.
You can use this event to modify or extend the information passed in the
s_pagesettupattrib structure.
Examples This example contains code you might add to the pfc_PrePageSetupDlg event:
// Sets page setup to portrait
astr_pagesetup.b_portraitorientation = TRUE
pfc_PrePrintDlg
Description Empty user event allowing you to modify the properties passed to the
n_cst_platform of_PrintDlg function.
Syntax instancename.Event pfc_PrePrintDlg ( attributes )
511
n_ds
Argument Description
instancename Instance name of n_ds
attributes S_printdlgattrib variable into which the event places additional
printing information. This argument is accessed through the
astr_printdlg argument (passed by reference)
pfc_Print
Description Calls the pfc_PrintDlg function and prints the DataStore, as specified in the
Print dialog box.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
pfc_PrintDlg
Description Initializes the s_printdlgattrib structure with the DataStore’s current settings,
displays the Print dialog box by calling the n_cst_platform of_PrintDlg
function, and resets the DataWindow’s settings as specified by the user.
Syntax instancename.Event pfc_PrintDlg ( attributes )
Argument Description
instancename Instance name of n_ds
attributes S_printdlgattrib variable into which the event places printing
information. This argument is accessed through the astr_printdlg
argument (passed by reference)
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage This event is called by the pfc_Print event.
pfc_PrintImmediate
Description Prints the current DataStore without displaying the Print dialog box.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
512
Chapter 8 Standard Class User Objects
pfc_PrintPreview
Description Toggles the DataStore between preview and edit modes.
Return value Boolean. Returns TRUE if the DataStore is placed in preview mode and
FALSE if it is placed in edit mode.
Usage To use this event, you must enable the print preview service by calling the
of_SetPrintPreview function.
pfc_ResetUpdate
Description Clears the DataStore’s update flags.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage The pfc_PostUpdate event calls this event.
pfc_Retrieve
Description Empty user event to contain all database retrieval logic.
Return value Long. Returns the result of the Retrieve function.
Usage You typically call the of_Retrieve function, which calls this event.
Examples This example calls the pfc_Retrieve event:
ids_data = CREATE n_ds
ids_data.DataObject = "d_empall"
ids_data.of_SetTransObject(SQLCA)
IF ids_data.Event pfc_Retrieve() = -1 THEN
SQLCA.of_Rollback()
ELSE
SQLCA.of_Commit( )
END IF
This example shows the code you add to the pfc_Retrieve event to retrieve
rows:
Return this.Retrieve( )
pfc_Ruler
Description Toggles the DataStore between displaying and hiding rulers in print preview
mode.
Return value Boolean. Returns TRUE if print preview rulers are displayed and FALSE if
they are hidden.
513
n_ds
Usage To use this event, you must enable the print preview service by calling the
of_SetPrintPreview function.
pfc_Update
Description Updates the DataStore. If the multitable update service is enabled, this event
updates all specified tables.
Syntax instancename.Event pfc_Update ( accepttext, resetflags )
Argument Description
instancename Instance name of n_ds
accepttext Boolean specifying whether the DataStore control should
automatically perform an AcceptText before performing the
Update (TRUE) or not (FALSE)
resetflags Boolean specifying whether the DataStore control should
automatically reset the update flags (TRUE) or not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this event to update a DataStore.
pfc_UpdatePrep
Description Empty user event to which you can add code that prepares for update.
Return value Long. Return 1 if the update preparation succeeds and -1 to halt the update
process.
Usage The of_UpdatePrep function calls this function.
pfc_UpdatesPending
Description Determines if there are pending updates for the DataStore.
Return value Integer. Returns 1 if there are pending updates for the DataStore and 0 if there
are no pending updates.
Usage This event is called by the of_UpdatesPending function.
pfc_Validation
Description Validates the DataStore, including checks for required fields.
Return value Integer. Returns 1 if the event succeeds and -1 if an error occurs.
Usage Extend this event to perform DataStore-specific validation.
514
Chapter 8 Standard Class User Objects
pfc_Zoom
Description Displays the w_zoom dialog box, allowing the user to control DataStore
display while in print preview mode.
Return value Integer. Returns the zoom level chosen by the user if the event succeeds, 0 if
the user cancels out of the w_zoom dialog box, and -1 if an error occurs.
Usage To use this event, you must enable the print preview service by calling the
of_SetPrintPreview function.
RetrieveStart
Description Determines whether PowerBuilder should append data to the end of the
DataStore when retrieving.
Usage This event executes just before the actual database retrieval. You can control
whether PowerBuilder appends to the end of the DataStore when retrieving
using the of_SetAppend function.
SQLPreview
Description Invokes the SQL Spy service, if enabled and controls which SQL statements
are sent to the database.
Usage This event executes just before any database access.
Functions
N_ds includes precoded object functions:
of_AcceptText of_SetParentWindow
of_CheckRequired of_SetPrintPreview
of_GetAppend of_SetReport
of_GetParentWindow of_SetTransObject
of_IsUpdateable of_SetUpdateable
of_MessageBox of_SetUpdateRequestor
of_PostUpdate of_Update
of_Retrieve of_UpdatePrep
of_SetAppend of_UpdatesPending
of_SetBase of_Validation
of_SetMultiTable
515
n_ds
of_AcceptText
Description Performs an AcceptText function for the DataStore.
Access Public
Syntax instancename.of_AcceptText ( focusonerror )
Argument Description
instancename Instance name of n_ds
focusonerror Boolean indicating whether PFC sets focus to the DataStore when
an error occurs
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize accept text processing,
extend the pfc_AcceptText event.
Examples This example is from the n_cst_luw of_AcceptText function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_AcceptText &
(ab_focusonerror)
If li_rc < 0 Then Return -1
...
of_CheckRequired
Description Determines if any of required columns contain NULL values.
Access Public
Syntax instancename.of_CheckRequired ( buffer, row, column, colname,
updateonly )
Argument Description
instancename Instance name of n_ds
buffer DWBuffer enumerated data type specifying the DataStore buffer
to check
row Long specifying the first row to check and into which the function
places the number of the row in error (passed by reference)
column Integer specifying the first column to check and into which the
function places the number of the column in error (passed by
reference)
516
Chapter 8 Standard Class User Objects
Argument Description
colname String specifying the first column to check and into which the
function places the name of the column in error (passed by
reference)
updateonly Boolean indicating whether to validate only those rows and
columns that have changed (TRUE) or validate all rows and
columns
of_GetAppend
Description Reports whether DataStore retrieves append to the end of the DataStore.
Access Public
Syntax instancename.of_GetAppend ( )
Argument Description
instancename Instance name of n_ds
Return value Boolean. Returns TRUE if retrieves append to the end of the DataStore and
FALSE if retrieves reset the DataStore before the retrieve.
Examples This example calls the of_GetAppend function:
Boolean lb_append
lb_append = ids_datasource.of_GetAppend()
...
517
n_ds
of_GetParentWindow
Description Retrieves a reference to the window containing this instance of n_ds.
Access Public
Syntax instancename.of_GetParentWindow ( window )
Argument Description
instancename Instance name of n_ds
window Window variable into which the function places a reference to the
parent window (passed by reference)
Return value Integer. Returns 1 if the function succeeds and -1 if there is no parent window.
Usage Internal.
Examples This example is from the pfc_PrintDlg event:
...
f_setplatform (lnv_platform, true)
this.of_GetParentWindow(lw_parent)
ll_rc = lnv_platform.of_PrintDlg(astr_printdlg, &
lw_parent)
...
of_IsUpdateable
Description Reports whether the DataStore is updatable.
Access Public
Syntax instancename.of_IsUpdateable ( )
Argument Description
instancename Instance name of n_ds
Return value Boolean. Returns TRUE if the DataStore is updatable and FALSE if it is not.
Examples This example is from the pfc_UpdatesPending event:
...
if not of_IsUpdateable() then
return 0
end if
...
of_MessageBox
Description Displays a MessageBox.
518
Chapter 8 Standard Class User Objects
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_ds
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of CommandButtons
you want to display at the bottom of the message box. The buttons
are numbered in the order listed in the enumerated data type. Values
are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in DataStore objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’ds_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
519
n_ds
of_PostUpdate
Description Calls the pfc_PostUpdate event, which clears update flags and allows you to
code additional post-update processing.
Access Public
Syntax instancename.of_PostUpdate ( )
Argument Description
instancename Instance name of n_ds
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize post-update processing,
extend the pfc_PostUpdate event.
Examples This example is from the n_cst_luw of_PostUpdate function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_PostUpdate()
...
of_Retrieve
Description Calls the pfc_Retrieve event.
Access Public
Syntax instancename.of_Retrieve ( )
Argument Description
instancename Instance name of n_ds
Return value Integer. Returns the number of rows retrieved if the function succeeds and -1 if
an error occurs.
Usage Call this function to perform DataStore retrieves. You must also code retrieve
logic in the pfc_Retrieve event.
Examples This example calls the of_Retrieve function:
ids_data.of_Retrieve()
of_SetAppend
Description Specifies whether DataStore retrieves append to the end of the DataStore.
520
Chapter 8 Standard Class User Objects
Access Public
Syntax instancename.of_SetAppend ( boolean )
Argument Description
instancename Instance name of n_ds
boolean Boolean specifying whether DataStore retrieves append to the end
of existing rows (TRUE) or reset the DataStore before the retrieve
(FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAppend function:
Integer li_return
li_return = ids_datasource.of_SetAppend(FALSE)
of_SetBase
Description Enables or disables n_cst_dssrv, which provides basic DataStore services.
Access Public
Syntax instancename.of_SetBase ( boolean )
Argument Description
instancename Instance name of n_ds
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
an instance of the n_cst_dssrv object
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to create or destroy an instance of n_cst_dssrv.
Examples This example calls the of_SetBase function:
Integer li_return
li_return = ids_datastore.of_SetBase(TRUE)
IF li_return = -1 THEN
MessageBox("DataStore", "Error with of_SetBase")
END IF
of_SetMultiTable
Description Enables or disables n_cst_dssrv_multitable, which provides multitable update
services.
521
n_ds
Access Public
Syntax instancename.of_SetMultiTable ( boolean )
Argument Description
instancename Instance name of n_ds
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the multitable update service
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dssrv_multitable.
Examples This example calls the of_SetMultiTable function:
ids_data.of_SetMultiTable(TRUE)
of_SetParentWindow
Description Sets a reference to the parent window.
Access Public
Syntax instancename.of_SetParentWindow ( window )
Argument Description
instancename Instance name of n_ds
window Window variable containing the parent window
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Some n_ds print functionality requires a reference to a parent window.
Examples This example calls the of_SetParentWindow function in a window Open event:
ids_data = CREATE n_ds
ids_data.DataObject = "d_empall"
ids_data.of_SetTransObject(SQLCA)
ids_data.of_SetParentWindow(this)
...
of_SetPrintPreview
Description Enables or disables n_cst_dwsrv_printpreview, which provides the print
preview service.
Access Public
Syntax instancename.of_SetPrintPreview ( boolean )
522
Chapter 8 Standard Class User Objects
Argument Description
instancename Instance name of n_ds
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the print preview service
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_printpreview.
Examples This example calls the of_SetPrintPreview function:
ids_data.of_SetPrintPreview(TRUE)
of_SetReport
Description Enables or disables n_cst_dwsrv_report, which provides the reporting service.
Access Public
Syntax instancename.of_SetReport ( boolean )
Argument Description
instancename Instance name of n_ds
boolean Boolean specifying whether to enable (TRUE) or disable (FALSE)
the reporting service
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Use this function to create or destroy an instance of n_cst_dwsrv_report.
Examples This example calls the of_SetReport function:
ids_data.of_SetReport(TRUE)
of_SetTransObject
Description Sets the Transaction object for the DataStore.
Access Public
Syntax instancename.of_SetTransObject ( transaction )
Argument Description
instancename Instance name of n_ds
transaction N_tr variable specifying the Transaction object to use for the
DataStore
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
523
n_ds
Examples This example calls the of_SetTransObject function (it assumes you have
associated n_tr with SQLCA in the Application painter):
Integer li_return
li_return = ids_datastore.of_SetTransObject(SQLCA)
IF li_return = -1 THEN
MessageBox("DataStore", &
"Error with of_SetTransObject")
END IF
of_SetUpdateable
Description Specifies whether the DataStore is updatable.
Access Public
Syntax instancename.of_SetUpdateable ( boolean )
Argument Description
instancename Instance name of n_ds
boolean Boolean indicating whether the DataStore is updatable (TRUE) or
not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to disable default save processing for DataStores that are not
updatable.
Examples This example calls the of_SetUpdateable function:
ids_data.of_SetUpdateable(FALSE)
of_SetUpdateRequestor
Description Creates a reference to the object requesting an update within a logical unit of
work.
Access Public
Syntax instancename.of_SetUpdateRequestor ( requestor )
Argument Description
instancename Instance name of n_ds
requestor PowerObject containing the object requesting the update
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
524
Chapter 8 Standard Class User Objects
of_Update
Updates the DataStore. There are two syntaxes:
To Use
Update data, optionally controlling update type Syntax 1
Update data passing the requestor object Syntax 2
525
n_ds
Argument Description
update Boolean indicating whether to modify changed rows:
(optional) TRUE—Modify rows (default)
FALSE—Do not modify rows
delete Boolean indicating whether to delete rows:
(optional) TRUE—Delete rows (default)
FALSE—Do not delete rows
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update processing, extend
the pfc_Update event.
For more information on update flags, see the Update function in the
PowerScript Reference.
Examples This example calls the of_Update function:
Integer li_return
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Internal.
526
Chapter 8 Standard Class User Objects
of_UpdatePrep
Description Calls the pfc_UpdatePrep event, which allows you to code additional update
preparation logic.
Access Public
Syntax instancename.of_UpdatePrep ( )
Argument Description
instancename Instance name of n_ds
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize update preparation
processing, extend the pfc_UpdatePrep event.
Examples This example is from the n_cst_luw of_UpdatePrep function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_UpdatePrep ()
If li_rc < 0 Then Return -1
Continue
End If
...
of_UpdatesPending
Description Determines if there are updates pending in the DataStore.
Access Public
Syntax instancename.of_UpdatesPending ( )
527
n_ds
Argument Description
instancename Instance name of n_ds
of_Validation
Description Performs validation on the DataStore.
Access Public
Syntax instancename.of_Validation ( )
Argument Description
instancename Instance name of n_ds
Return value Integer. Returns 1 if the function succeeds and -1 if a validation error occurs.
Usage N_cst_luw calls this function as part of the default save process. This function
is part of the self-updating object API. To customize validation processing,
extend the pfc_Validation event.
Examples This example calls the of_Validation function:
...
If lb_defined Then
li_rc = &
lpo_tocheck.Function Dynamic of_Validation()
...
528
Chapter 8 Standard Class User Objects
n_dsa
Description DynamicStagingArea nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder
DynamicStagingArea object.
See also n_dda
n_err
n_msg
n_tr
529
n_err
n_err
Description Error nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEAPSRV.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder error object.
See also n_dda
n_dsa
n_msg
n_tr
Functions
N_err contains one precoded function:
of_MessageBox
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_err
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
530
Chapter 8 Standard Class User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Error objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’err_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
531
n_inet
n_inet
Description Inet nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder Inet object.
See also n_cxinfo
n_cxk
n_ir
n_srv
532
Chapter 8 Standard Class User Objects
n_ir
Description InternetResult nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder InternetResult
object.
See also n_cxinfo
n_cxk
n_inet
n_srv
533
n_ms
n_ms
Description MailSession nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder MailSession
object.
See also n_ds
n_err
n_msg
n_pl
n_tr
Functions
N_ms contains one precoded function:
of_MessageBox
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_ms
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
534
Chapter 8 Standard Class User Objects
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in MailSession objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’ms_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
535
n_msg
n_msg
Description Message nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder Message
object.
N_msg includes functions that provide enhanced behavior when passing
numeric, string, or PowerObject values through the Message object. Call these
functions to set and get values instead of accessing DoubleParm, StringParm,
and PowerObjectParm directly.
See also n_ds
n_err
n_ms
n_pl
n_tr
Instance variables
N_msg includes instance variables:
Instance
variable Description Data type Access Usage
idbl_parm Contains passed Double Protected Access with of_GetDoubleParm
numeric values and of_SetDoubleParm
ipo_parm Contains passed objects PowerObject Protected Access with
of_GetPowerObjectParm and
of_SetPowerObjectParm
is_parm Contains passed string String Protected Access with of_GetStringParm and
values of_SetStringParm
536
Chapter 8 Standard Class User Objects
Functions
N_msg includes precoded functions:
of_CopyTo of_MessageBox
of_GetDoubleParm of_SetDoubleParm
of_GetPowerObjectParm of_SetPowerObjectParm
of_GetStringParm of_SetStringParm
of_CopyTo
Description Copies the contents of the Message object to the specified Message object.
Access Public
Syntax instancename.of_CopyTo ( targetmsg )
Argument Description
instancename Instance name of n_msg
targetmsg N_msg-based Message object to which the function copies values
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to copy contents from one Message object to another. Call
this function instead of simply assigning one object to another (which copies a
reference, not the values).
Examples This example calls the of_CopyTo function (it assumes an imsg_back instance
variable):
Integer li_return
li_return = Message.of_CopyTo(imsg_back)
...
of_GetDoubleParm
Description Retrieves the numeric value stored in the idbl_parm instance variable.
Access Public
Syntax instancename.of_GetDoubleParm ( )
Argument Description
instancename Instance name of n_msg
537
n_msg
ldbl_emp_id = Message.of_GetDoubleParm()
...
of_GetPowerObjectParm
Description Retrieves the PowerObject value stored in the ipo_parm instance variable.
Access Public
Syntax instancename.of_GetPowerObjectParm ( )
Argument Description
instancename Instance name of n_msg
lpo_obj = Message.of_GetPowerObjectParm()
IF TypeOf.lpo_obj = n_tr THEN
ltr_trans = lpo_obj
dw_1.of_SetTransObject(ltr_trans)
...
of_GetStringParm
Description Retrieves the string value stored in the is_parm instance variable.
Access Public
Syntax instancename.of_GetStringParm ( )
Argument Description
instancename Instance name of n_msg
538
Chapter 8 Standard Class User Objects
ls_empname = Message.of_GetStringParm()
...
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_msg
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
539
n_msg
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Message objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’msg_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
of_SetDoubleParm
Description Sets the numeric value stored in the idbl_parm instance variable.
Access Public
Syntax instancename.of_SetDoubleParm ( parm )
Argument Description
instancename Instance name of n_msg
parm Double specifying the value to be saved
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Use this function in combination with of_GetDoubleParm instead of accessing
Message.DoubleParm directly.
Examples This example calls the of_SetDoubleParm function:
Double ldbl_emp_id
ldbl_emp_id = 599
Message.of_SetDoubleParm(ldbl_emp_id)
...
of_SetPowerObjectParm
Description Sets the PowerObject value stored in the ipo_parm instance variable.
Access Public
Syntax instancename.of_SetPowerObjectParm ( parm )
Argument Description
instancename Instance name of n_msg
parm PowerObject containing the instance to be saved
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
540
Chapter 8 Standard Class User Objects
lpo_obj = n_tr
Message.of_SetPowerObjectParm(lpo_obj)
Open(w_deptinfo)
...
of_SetStringParm
Description Sets the string value stored in the is_parm instance variable.
Access Public
Syntax instancename.of_SetStringParm ( parm )
Argument Description
instancename Instance name of n_msg
parm String specifying the value to be saved
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Use this function in combination with of_GetStringParm instead of accessing
Message.StringParm directly.
Examples This example calls the of_SetStringParm function:
Message.of_SetStringParm("w_products")
of_SendMessage("pfc_Open")
541
n_oo
n_oo
Description OLEObject nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder OLEObject
object.
See also n_ostg
n_ostm
542
Chapter 8 Standard Class User Objects
n_ostg
Description OLEStorage nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder OLEStorage
object.
See also n_oo
n_ostm
543
n_ostm
n_ostm
Description OLEStream nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder OLEStream
object.
See also n_oo
n_ostg
544
Chapter 8 Standard Class User Objects
n_pl
Description Pipeline nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder pipeline object.
See also n_ds
n_err
n_ms
n_msg
n_tr
Functions
N_pl contains one precoded function:
of_MessageBox
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_pl
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
545
n_pl
Argument Description
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Pipeline objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’pl_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
546
Chapter 8 Standard Class User Objects
n_srv
Description Service nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder Service object.
The Service object is used in implementing extensions to the PowerBuilder
context feature.
See also n_cxinfo
n_cxk
n_inet
n_ir
547
n_tmg
n_tmg
Description Timing nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships n_cst_tmgmultiple
n_cst_tmgsingle
Usage Use this nonvisual object instead of the standard PowerBuilder Timing object.
See also n_tr
Instance variables
N_tmg includes instance variables:
Instance variable Description Data type Access Usage
inv_multiple Reference variable for N_cst_tmgmultiple Public Call of_SetMultiple to
multiple notify service enable
inv_single Reference variable for N_cst_tmgsingle Public Call of_SetSingle to
single notify service enable
Functions
N_tmg includes precoded object functions:
of_SetMultiple
of_SetSingle
of_SetMultiple
Description Enables or disables n_cst_tmgmultiple, which provides the multiple notify
service.
Access Public
Syntax instancename.of_SetMultiple ( boolean )
548
Chapter 8 Standard Class User Objects
Argument Description
instancename Instance name of n_tmg
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) an instance of the n_cst_tmgmultiple object
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage You cannot use both n_cst_tmgsingle and n_cst_tmgmultiple at the same time.
Examples This example calls the of_SetMultiple function:
Integer li_return
li_return = itmg_timer.of_SetMultiple(TRUE)
IF li_return = -1 THEN
MessageBox("Timer", "Error with of_SetMultiple")
END IF
of_SetSingle
Description Enables or disables n_cst_tmgsingle, which provides the single notify service.
Access Public
Syntax instancename.of_SetSingle ( boolean )
Argument Description
instancename Instance name of n_tmg
boolean Boolean specifying whether to enable (TRUE) or disable
(FALSE) an instance of the n_cst_tmgsingle object
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage You cannot use both n_cst_tmgsingle and n_cst_tmgmultiple at the same time.
Examples This example calls the of_SetSingle function:
Integer li_return
li_return = itmg_timer.of_SetSingle(TRUE)
IF li_return = -1 THEN
MessageBox("Timer", "Error with of_SetSingle")
END IF
549
n_tr
n_tr
Description Transaction object for use with all PFC applications. You can use this object as
is, or create DBMS- or application-specific descendants that include
customized or extended functionality.
N_tr includes integration with the SQL Spy debugging service.
For more information on using SQL Spy, see the PFC User’s Guide.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Object relationships n_cst_trregistration
Usage Use n_tr functions instead of native SQL transaction management statements.
For example, to connect to the database, use of_Connect instead of the
CONNECT statement.
To register an n_tr-based Transaction object with the transaction registration
service, call the n_cst_trregistration of_Register function.
To use n_tr:
1 If the Transaction object is not SQLCA, create it:
// Assumes an itr_security instance variable
itr_security = CREATE n_tr
2 (Optional) If you are using the transaction registration service:
• Register all Transaction objects:
gnv_app.inv_trregistration.of_Register(SQLCA)
// Assumes an itr_security instance variable
550
Chapter 8 Standard Class User Objects
gnv_app.inv_trregistration.of_Register &
(itr_security)
• Establish a transaction name for use with the transaction registration
service:
// Assumes an itr_security instance variable
SQLCA.of_SetName("SQLCA")
itr_security.of_SetName("Security")
3 Initialize the ib_autorollback instance variable, which specifies what to do
if the application closes (or the object is otherwise destroyed) while the
transaction is still connected:
SQLCA.of_SetAutoRollback(TRUE)
itr_security.of_SetAutoRollback(FALSE)
4 Call n_tr functions as needed.
See also n_cst_trregistration
Instance variables
N_tr includes instance variables:
Instance
variable Description Data type Access Usage
ib_autorollback Specifies whether the Boolean Protected The Destructor event uses this event
Destructor event issues to determine whether to call
a COMMIT or a of_Commit or of_Rollback:
ROLLBACK if the • TRUE — Call of_Rollback
transaction is still
• FALSE (default) — Call
connected
of_Commit
Set with of_SetAutoRollback. This
controls how n_tr handles
transactions if the application closes
(or the object is otherwise
destroyed) while the transaction is
still connected
ib_trace Specifies whether trace Boolean Protected Call of_GetTrace to access this
is enabled value (default is FALSE)
551
n_tr
Instance
variable Description Data type Access Usage
is_name A name used to identify String Protected You can reuse transactions between
the transaction windows by passing this value
(using OpenWithParm) when
opening a new window. The new
window can use the passed value
with the n_cst_trregistration
of_GetByName function to access
the Transaction object
Call of_GetName and of_SetName
to access this value
Events
N_tr includes a precoded event:
Destructor
Destructor
Description If the instance is still connected to a database, this event commits or rolls back
the transaction, depending on the ib_autorollback instance variable. It then
disconnects the transaction.
Usage This event’s functionality is meant to ensure efficient use of system resources.
However, it’s best to commit, rollback, and disconnect explicitly using this
object’s of_Commit, of_Rollback, and of_Disconnect functions.
Functions
N_tr includes precoded object functions:
of_Begin of_GetTrace
of_Commit of_Init
of_Connect of_IsConnected
of_CopyTo of_MessageBox
of_Disconnect of_Rollback
of_DistinctValues of_SetAutoRollback
of_End of_SetLogidAndPassword
552
Chapter 8 Standard Class User Objects
of_Execute of_SetName
of_GetAutoRollback of_SetTrace
of_GetName of_SetUser
of_GetSqlState of_SetUserIdAndPassword
of_Begin
Description Empty function into which you can code DBMS-specific BEGIN
TRANSACTION statements in n_tr descendants.
Access Public
Syntax instancename.of_Begin ( )
Argument Description
instancename Instance name of n_tr
Return value Long. Always returns -1. Add DBMS-specific returns values in your n_tr
descendant.
Usage Call this function to begin a database transaction.
You should connect to the database before issuing this function. Use
of_Connect to connect to the database.
of_Commit
Description Issues a COMMIT statement.
Access Public
Syntax instancename.of_Commit ( )
Argument Description
instancename Instance name of n_tr
Return value Long. Returns the SQLCODE value from the COMMIT statement.
Usage Call this function instead of the COMMIT statement to make any changes to
the database permanent and end a logical unit of work.
Examples This example calls the of_Commit function:
IF dw_sheet.Update( ) = -1 THEN
itr_trans.of_Rollback( )
MessageBox("Update", "Update failed")
ELSE
itr_trans.of_Commit( )
553
n_tr
of_Connect
Description Connects to the database.
Access Public
Syntax instancename.of_Connect ( )
Argument Description
instancename Instance name of n_tr
Return value Long. Returns the SQLCODE value from the CONNECT statement.
Usage Call this function instead of the CONNECT statement to connect the
transaction to the database.
You must initialize the Transaction object before calling this function. The
fields initialized vary, depending on your DBMS. You can call the of_Init
function to initialize the Transaction object.
Examples This example initializes itr_security fields and connects to the database:
String ls_dbms, ls_database, ls_logid, ls_logpass
String ls_servername
Long ll_return
itr_security.DBMS = "Syb"
itr_security.Database = "agora"
itr_security.LogID = "williamk"
itr_security.LogPass = "billpass"
itr_security.ServerName = "MUSTANG"
ll_return = itr_security.of_Connect()
IF ll_return <> 0 THEN
MessageBox("Connect", "Connect error")
END IF
of_CopyTo
Description Copies the contents of the Transaction object to the specified Transaction
object.
Access Public
554
Chapter 8 Standard Class User Objects
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to copy contents from one Transaction object to another. Call
this function instead of simply assigning one object to another (which copies a
reference, not the values).
Examples This example calls the of_CopyTo function (it assumes an itr_back instance
variable):
Integer li_return
li_return = SQLCA.of_CopyTo(itr_back)
...
of_Disconnect
Description Disconnects from the database.
Access Public
Syntax instancename.of_Disconnect ( )
Argument Description
instancename Instance name of n_tr
Return value Long. Returns the SQLCODE value from the DISCONNECT statement.
Usage Call this function instead of the DISCONNECT statement to disconnect the
transaction from the database.
Be sure to check the return value to ensure that the function succeeded.
Examples This example disconnects from the database:
Long ll_return
ll_return = itr_security.of_Disconnect()
IF ll_return <> 0 THEN
MessageBox("Disconnect", "Disconnect error")
END IF
555
n_tr
of_DistinctValues
Description Retrieves distinct values for the specified database column.
Access Public
Syntax instancename.of_DistinctValues ( table, column, values )
Argument Description
instancename Instance name of n_tr
table String specifying the database table
column String specifying the column for which the function returns
distinct values
values Unbounded string array into which the function places distinct
values for column
Return value Long. Returns the number of elements in the values array.
Examples This calls the of_DistinctValues function:
Long ll_return
String ls_values[ ]
of_End
Description Empty function into which you can code DBMS-specific END
TRANSACTION statements in n_tr descendants.
Access Public
Syntax instancename.of_End ( )
Argument Description
instancename Instance name of n_tr
Return value Long. Always returns -1. Add DBMS-specific returns values in your n_tr
descendant.
Usage Call this function to end a database transaction.
of_Execute
Description Executes a specified SQL statement.
Access Public
556
Chapter 8 Standard Class User Objects
Return value Long. Returns the SQLCODE returned by the EXECUTE IMMEDIATE
statement. A value of -10 indicates that there is no database connection.
Examples This example calls the of_Execute function:
Long ll_return
String ls_sql
of_GetAutoRollback
Description Reports whether autorollback is enabled.
Access Public
Syntax instancename.of_GetAutoRollback ( )
Argument Description
instancename Instance name of n_tr
Return value Boolean. Returns TRUE if autorollback is enabled and FALSE if it is not.
Examples This example calls the of_GetAutoRollback function:
IF SQLCA.of_GetAutoRollback() THEN
MessageBox("Transaction", &
"Autorollback is enabled")
ELSE
MessageBox("Transaction", &
"Autorollback is disabled")
END IF
of_GetName
Description Retrieves the transaction name, as specified by the of_SetName function.
Access Public
Syntax instancename.of_GetName ( )
557
n_tr
Argument Description
instancename Instance name of n_tr
of_GetSqlState
Description Retrieves the SQL state string returned by the DBMS.
Access Public
Syntax instancename.of_GetSqlState ( )
Argument Description
instancename Instance name of n_tr
Return value String. Returns the SQL state string returned by the DBMS.
Examples This example calls the of_GetSqlState function:
String ls_sqlstate
ls_sqlstate = SQLCA.of_GetSqlState()
MessageBox("SQL State", &
"SQL state is: " + ls_sqlstate)
558
Chapter 8 Standard Class User Objects
of_GetTrace
Description Reports whether the PowerBuilder DBMS trace is enabled.
Access Public
Syntax instancename.of_GetTrace ( )
Argument Description
instancename Instance name of n_tr
Return value Boolean. Returns TRUE if trace is enabled and FALSE if it is not.
Examples This example calls the of_GetTrace function:
IF SQLCA.of_GetTrace() THEN
MessageBox("Transaction", "Trace is enabled")
ELSE
MessageBox("Transaction", "Trace is disabled")
END IF
of_Init
Description Initializes the n_tr-based Transaction object with the passed values.
Access Public
Syntax instancename.of_Init ( fileorkey, section )
Argument Description
instancename Instance name of n_tr
fileorkey String specifying the name of the ini file or registry key containing
connection information. If you specify an INI file, you must also
specify section
section String specifying the INI file section containing connection
information. If fileorkey specifies a registry key, you cannot
specify this value
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to initialize n_tr before connecting to the database. The INI-
file section or registry key must include the following keywords (with DBMS-
specific values as appropriate):
DBMS
Database
LogID
LogPass
ServerName
559
n_tr
UserID
DatabasePassword
Lock
DbParm
Examples This example calls the of_Init function:
String ls_file, ls_section
Long ll_return
ls_file = "c:\pbapp\pbapp.ini"
ls_section = "securityDB"
itr_security.of_Init &
(ls_file, ls_section)
ll_return = itr_security.of_Connect()
IF ll_return <> 0 THEN
MessageBox("Connect", "Connect error")
END IF
of_IsConnected
Description Determines whether the n_tr instance is connected to a database.
Access Public
Syntax instancename.of_IsConnected ( )
Argument Description
instancename Instance name of n_tr
Return value Boolean. Returns TRUE if the n_tr instance is connected to a database and
FALSE if it is not.
Examples This example calls the of_IsConnected function:
Long ll_return
of_MessageBox
Description Displays a MessageBox.
560
Chapter 8 Standard Class User Objects
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_tr
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Transaction objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’tr_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
of_Rollback
Description Rolls back the database transaction.
561
n_tr
Access Public
Syntax instancename.of_Rollback ( )
Argument Description
instancename Instance name of n_tr
Return value Long. Returns 0 if the function succeeds, -10 if the transaction is not connected
and any other nonzero value if an error occurs.
Usage Call this function instead of the ROLLBACK statement to reverse all
uncommitted changes.
Examples This example calls the of_Rollback function:
IF dw_sheet.Update() = -1 THEN
itr_trans.of_Rollback()
MessageBox("Update", "Update failed")
ELSE
itr_trans.of_Commit()
gnv_app.of_GetFrame().SetMicroHelp &
("Update succeeded")
END IF
of_SetAutoRollback
Description Controls whether autorollback is enabled.
If autorollback is enabled, the n_tr Destructor event issues a ROLLBACK for
a connected transaction. If autorollback is disabled, the n_tr Destructor event
issues a COMMIT.
Access Public
Syntax instancename.of_SetAutoRollback ( boolean )
Argument Description
instancename Instance name of n_tr
boolean Boolean indicating whether autorollback is enabled (TRUE) or
not (FALSE)
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Examples This example calls the of_SetAutoRollback function:
SQLCA.of_SetAutoRollback(TRUE)
562
Chapter 8 Standard Class User Objects
of_SetLogidAndPassword
Description Sets the property values of the Transaction object for LogID and LogPass.
Access Public
Syntax instancename.of_SetLogidAndPassword ( loginid , logpassword )
Argument Description
instancename Instance name of n_tr
loginid String specifying the name of the login ID
logpassword String specifying the name of the login password
of_SetName
Description Specifies the transaction name, which is used by the transaction registration
service.
Access Public
Syntax instancename.of_SetName ( name )
Argument Description
instancename Instance name of n_tr
name String specifying a name for the transaction
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Call this function to specify a transaction name when you are using the
transaction registration service.
Examples This example calls the of_SetName function:
SQLCA.of_SetName("SQLCA")
itr_security.of_SetName("Security")
of_SetTrace
Description Specifies whether the PowerBuilder DBMS trace is enabled.
Access Public
Syntax instancename.of_SetTrace ( boolean )
563
n_tr
Argument Description
instancename Instance name of n_tr
boolean Boolean specifying whether trace is enabled (TRUE) or not
(FALSE)
Return value Integer. Returns 1 if the function succeeds, 0 if trace is already in the specified
state, and -1 if an error occurs.
Examples This example calls the of_SetTrace function to enable trace:
SQLCA.of_SetTrace(TRUE)
of_SetUser
Description Specifies the DBMS user ID and password (DBPass).
Access Public
Syntax instancename.of_SetUser ( userid, password )
Argument Description
instancename Instance name of n_tr
userid String specifying the user ID (Transaction object UserID
property)
password String specifying the password (Transaction object DBPass
property)
564
Chapter 8 Standard Class User Objects
of_SetUserIdAndPassword
Description Sets the property values of the Transaction object for UserID and DBPass.
Access Public
Syntax instancename.of_SetUserIDAndPassword ( userid , password )
Argument Description
instancename Instance name of n_tr
userid String specifying the name of the user’s login ID
password String specifying the name of the user’s login password
565
n_trp
n_trp
Description Transport nonvisual user object ancestor.
Ancestry
Library PFCMAIN.PBL
PFEMAIN.PBL
Usage Use this nonvisual object instead of the standard PowerBuilder Transport
object.
See also n_cn
Functions
N_trp contains one precoded function:
of_MessageBox
of_MessageBox
Description Displays a MessageBox.
Access Protected
Syntax instancename.of_MessageBox ( id, title, message, icon, button, default )
Argument Description
instancename Instance name of n_trp
id String specifying an ID for the message
title String specifying the title of the MessageBox
message String specifying the message text
icon Icon enumerated data type indicating the icon you want to display
on the left side of the message box. Values are:
• Information!
• StopSign!
• Exclamation!
• Question!
• None!
566
Chapter 8 Standard Class User Objects
Argument Description
button Button enumerated data type indicating the set of
CommandButtons you want to display at the bottom of the
message box. The buttons are numbered in the order listed in the
enumerated data type. Values are:
• OK!
• OKCancel!
• YesNo!
• YesNoCancel!
• RetryCancel!
• AbortRetryIgnore!
default Integer specifying the number of the button you want to be the
default button
Return value Integer. Returns 1 if the function succeeds and -1 if an error occurs.
Usage Override this function to control MessageBox behavior in Transport objects.
The id argument is not used in the default implementation.
Examples This example calls the of_MessageBox function:
of_Messagebox(’trp_dberror’,’Save’, &
as_error, StopSign!, Ok!, 1)
...
567
n_trp
568
Index
A w_master 21
CloseQuery event 21
Activate event
code examples 8
w_frame 12
color service 619
w_master 21
ColumnClick event 224
w_sheet 57
CommandButton 128
application INI file
Commit 553
of_GetAppIniFile 584
Connect 554
of_SetAppIniFile 591
Constructor
application manager 572
n_cst_mru 1137
application services
Constructor event
n_cst_apppreference 601
n_cst_appmanager 576
n_cst_dwcache 668
n_cst_debug 653
n_cst_error 950
n_cst_dwsrv_report 843
n_cst_security 1206
n_cst_filesrvwin32 1006
n_cst_trregistration 1285
n_cst_inifile 1026
n_cst_luw 1053
n_cst_lvsrv_datasource 1075
B n_cst_platformwin32 1179
n_cst_tmgmultiple 1249
BeginDrag event 338 n_cst_tvsrv_levelsource 1306
binary number service 1164 n_cst_winsrv_sheetmanager 1383
ButtonClicked event n_cst_winsrv_statusbar 1393
u_calculator 399 u_calculator 399
u_calendar 424 u_calendar 424
u_progressbar 460
u_st_splitbar 486
ContextInformation object 504
C ContextKeyword object 505
calculator 396 ContextMenu event
calendar 419 u_ddlb 136
CbnEditChange event u_ddplb 143
u_cbx 135 u_em 196
u_ddplb 142 u_lvs 224
CheckBox 131 u_mle 254
Clicked event u_oc 260
u_calendar 424 u_sle 308
u_dw 153 conversion service 621
Close event
w_frame 12
Index-1
Index
D n_cst_linkedlistbase 1031
n_cst_luw 1075
data type conversion service 621
n_cst_tmgmultiple 1249
DataStore 507
n_cst_trregistration 1286
DataStore services
n_cst_tvsrv_levelsource 1306
n_cst_dssrv 664
n_ds 510
n_cst_dssrv_multitable 665
n_tr 552
n_cst_dssrv_printpreview 666
u_base 382
n_cst_dssrv_report 667
u_calculator 399
DataWindow caching service
u_calendar 424
main discussion 668
u_dw 154
of_SetDwCache 593
u_em 196
DataWindow control 148
u_lvs 224
DataWindow properties
u_rte 286
n_cst_dwsrv_property 826
u_tvs 338
of_SetDWProperty 656
Disconnect 555
DataWindow services
distributed computing
base object 682
pfc_ConnectionBegin 578
dropdown DataWindow search service 706
pfc_ConnectionEnd 579
filter service 717
DoubleClicked event 424
find service 728
DragDrop event 338
linkage service 744
dropdown calculator 396
multitable update service 806
dropdown calendar 419
n_cst_dwsrv_printpreview 817
dropdown DataWindows
query mode service 830
of_PopulateDDDW 701
reporting 841
of_RefreshDDDWs 701
required column 884
search service 706
resize service 891
Dropdown event 154
row manager 908
dropdown service 658
row selection 918
DropDownListBox 134
sort 934
DropDownPictureListBox 141
u_dw 148
DynamicDescriptionArea object 506
date/time service 633
DynamicStagingArea object 529
DBError event
n_ds 510
u_dw 154
debug service E
main discussion 651
e 1191
of_SetDebug 593
EditMask 195
Destructor
EndLabelEdit event
n_cst_mru 1137
u_lvs 224
Destructor event
u_tvs 338
n_cst_appmanager 577
Error object 530
n_cst_debug 653
error service
n_cst_dwcache 670
main discussion 950
n_cst_dwsrv_report 843
of_SetError 594
n_cst_error 954
Index-2
Index
G
GetFocus event
u_calculator 399 I
u_calendar 425 Inet object 532
u_cb 128 INI file
u_cbx 131 of_GetAppIniFile 584
u_ddlb 136 of_SetAppIniFile 591
u_ddplb 143 of_SetUserIniFile 598, 617, 1150
u_dw 154 INI file service 1025
u_em 197 InternetResult object 533, 548
u_gr 204 ItemChanged event 154
u_hpb 207 ItemError event 154
u_hsb 210 ItemExpanding event 339
u_htb 213 ItemFocusChanged event 155
u_lb 216
u_lvs 224
u_mle 254
u_oc 260 K
u_p 267 Key event
u_pb 270 u_calculator 399
u_phl 273 u_calendar 425
u_plb 276 KeyDown event
u_rb 280 u_lvs 225
u_rte 286 u_tvs 338
u_sle 308
u_st 313
u_sth 316
u_tv 338 L
u_vpb 369 LButtonDown event 155
Index-3
Index
Index-4
Index
Index-5
Index
Index-6
Index
Index-7
Index
Index-8
Index
Index-9
Index
Index-10
Index
Index-11
Index
Index-12
Index
Index-13
Index
Index-14
Index
Index-15
Index
Index-16
Index
Index-17
Index
Index-18
Index
Index-19
Index
Index-20
Index
Index-21
Index
Index-22
Index
Index-23
Index
Index-24
Index
Index-25
Index
Index-26
Index
Index-27
Index
R
RadioButton 280
RButtonDown event S
u_dw 172 s_pagesetupattrib 123
u_progressbar 460 s_paperattrib 124
RButtonUp event s_printdlgattrib 125
u_ddlb 138 s_svalue 126
u_ddplb 145 sample application 8
u_dw 172 security service
u_em 199 n_cst_security 1206
u_lvs 234 of_SetAppPreference 592
u_mle 256 of_SetMRU 596
u_oc 264 of_SetSecurity 597
u_rte 293 selection service 1210
u_sle 310 Service object 547
Index-28
Index
Index-29
Index
V
VerticalProgressBar 369
VerticalScrollBar 372
VerticalTrackBar 375
W
w_child 10
w_debuglog 656
w_frame 11
w_main 17
w_master
main discussion 18
n_cst_resize 1190
w_popup 52
w_response 53
w_sheet 56
w_sqlspy 1220
window services
n_cst_winsrv 1362
n_cst_winsrv_preference 1365
n_cst_winsrv_sheetmanager 1382
n_cst_winsrv_statusbar 1389
Z
zoom
of_GetZoom 821
of_SetRelativeZoom 880
pfc_Zoom (n_ds) 515
pfc_Zoom (u_dw) 172
Index-30