Jump to content

WpAddSettingsPages: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:wpAddSettingsPages}}
{{DISPLAYTITLE:wpAddSettingsPages}}
This instance method is called to allow the object to add all of its ''Settings'' pages to its Settings notebook.
This instance method is called to allow the object to add all of its ''Settings'' pages to its Settings notebook.


This method is called only by the system.  
This method is called only by the system.


==Syntax==
==Syntax==
Line 9: Line 8:


==Parameters==
==Parameters==
;somSelf (WPObject *) - input
;somSelf (WPObject *) - input:Pointer to the object on which the method is being invoked.
 
:Points to an object of class WPObject.
:Pointer to the object on which the method is being invoked.
;hwndNotebook ([[HWND]]) - input:Settings notebook handle.
 
:Points to an object of class WPObject.  
 
;hwndNotebook ([[HWND]]) - input
 
:Settings notebook handle.  


==Returns==
==Returns==
:rc (BOOL) - returns
;rc (BOOL) - returns:Success indicator.
:Success indicator.
::TRUE - Successful completion
:;TRUE
::FALSE - Error occurred
::Successful completion.
:;FALSE
:Error occurred.


==How to Override==
==How to Override==
This method is always overridden in order to add pages to or remove pages from the Settings notebook. To add a page to the Settings notebook, a call to wpInsertSettingsPage is required. To remove a page from the Settings notebook, the method that adds the page to the Settings notebook must be overridden and SETTINGS_PAGE_REMOVED is returned without calling its parent method.
This method is always overridden in order to add pages to or remove pages from the Settings notebook. To add a page to the Settings notebook, a call to wpInsertSettingsPage is required. To remove a page from the Settings notebook, the method that adds the page to the Settings notebook must be overridden and SETTINGS_PAGE_REMOVED is returned without calling its parent method.


When adding a page, the parent method should usually be called first. Calling the parent method first will put pages added by the overriding method at the top of the Settings notebook, above the pages added by ancestor classes. Calling the parent last will put pages added by the overriding at the bottom of the Settings notebook, below the pages added by ancestor classes.  
When adding a page, the parent method should usually be called first. Calling the parent method first will put pages added by the overriding method at the top of the Settings notebook, above the pages added by ancestor classes. Calling the parent last will put pages added by the overriding at the bottom of the Settings notebook, below the pages added by ancestor classes.


==Example Code==
==Example Code==
Definition:
Definition:
<pre>
<pre>
#define INCL_WINWORKPLACE
#define INCL_WINWORKPLACE
Line 46: Line 34:
rc = _wpAddSettingsPages(somSelf, hwndNotebook);
rc = _wpAddSettingsPages(somSelf, hwndNotebook);
</pre>
</pre>
This example adds a Settings notebook page to let the user modify the Last Worker's name.
This example adds a Settings notebook page to let the user modify the Last Worker's name.
<pre>
<pre>
Line 77: Line 64:


== Related Methods==
== Related Methods==
* [[wpInsertSettingsPage]]  
* [[wpInsertSettingsPage]]


[[Category:Workplace Instance Methods]]
[[Category:Workplace Instance Methods]]

Latest revision as of 20:06, 1 September 2025

This instance method is called to allow the object to add all of its Settings pages to its Settings notebook.

This method is called only by the system.

Syntax

_wpAddSettingsPages(somSelf, hwndNotebook);

Parameters

somSelf (WPObject *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPObject.
hwndNotebook (HWND) - input
Settings notebook handle.

Returns

rc (BOOL) - returns
Success indicator.
TRUE - Successful completion
FALSE - Error occurred

How to Override

This method is always overridden in order to add pages to or remove pages from the Settings notebook. To add a page to the Settings notebook, a call to wpInsertSettingsPage is required. To remove a page from the Settings notebook, the method that adds the page to the Settings notebook must be overridden and SETTINGS_PAGE_REMOVED is returned without calling its parent method.

When adding a page, the parent method should usually be called first. Calling the parent method first will put pages added by the overriding method at the top of the Settings notebook, above the pages added by ancestor classes. Calling the parent last will put pages added by the overriding at the bottom of the Settings notebook, below the pages added by ancestor classes.

Example Code

Definition:

#define INCL_WINWORKPLACE
#include <os2.h>

WPObject  *somSelf;       /* Pointer to the object on which the method is being invoked. */
HWND       hwndNotebook;  /* Settings notebook handle. */
BOOL       rc;            /* Success indicator. */

rc = _wpAddSettingsPages(somSelf, hwndNotebook);

This example adds a Settings notebook page to let the user modify the Last Worker's name.

SOM_Scope BOOL SOMLINK myf_wpAddSettingsPages(MYFILE *somSelf, HWND hwndNotebook)

{
    PAGEINFO pageinfo;

    MYFILEData *somThis = MYFILEGetData(somSelf);
    MYFILEMethodDebug("MYFILE","myf_wpAddSettingsPages");

    parent_wpAddSettingsPages(somSelf, hwndNotebook);

    memset((PCH)&pageinfo,0,sizeof(PAGEINFO));
    pageinfo.cb                 = sizeof(PAGEINFO);
    pageinfo.hwndPage           = NULLHANDLE;
    pageinfo.usPageStyleFlags   = BKA_MAJOR;
    pageinfo.usPageInsertFlags  = BKA_FIRST;
    pageinfo.pfnwp              = LastWorkerDlgProc;
    pageinfo.resid              = hmod;
    pageinfo.dlgid              = IDD_LASTWORKER;
    pageinfo.pszName            = "LastWorker";
    pageinfo.pCreateParams      = somSelf;
    pageinfo.idDefaultHelpPanel = ID_HELP_LASTWORKER;
    pageinfo.pszHelpLibraryName = szHelpLibrary;

    return _wpInsertSettingsPage( somSelf, hwndNotebook,&pageinfo );
}

Related Methods