TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: jari laaksonen
from: Jonathan de Boyne Pollard
date: 1995-12-27 16:53:04
subject: idea for program

jl>
  > I decided to take the bait and this is what I have after two evenings
  > coding:
jl>

  I decided *not* to take the bait, since I have little enough time as
  it is.  (-:  Here, however, are some suggestions.  I'd like to see the
  finished product.

jl>
  > - when a DOS session object has it's settings altered (e.g. DOS_HIGH=1)
  > and the object type is changed to OS/2 session, the environment
  > info is set to null. By default an OS/2 session object has
  > a null environment settings.
jl>

  I don't understand.  What is specifically the problem here ?

jl>
  > - how the info written in the "Environment" page should be
  > saved? When another notebook page is selected, I don't know
  > which method is called (I tried to catch the
  > BKN_PAGESELECTED notification message in my dialog proc but
  > none was sent).
jl>

  You, of course, inherit methods from WPProgram (actually you inherit
  them from WPObject and they are implemented by WPAbstract) to save and
  restore persistent data for your object (wpSaveData, wpRestoreData,
  wpSaveLong, wpRestoreLong, and so forth).  Use them to transfer the
  setting information for your new page from the internal storage within
  your object to persistent storage (and back again).

  You'll have to override the wpSaveState and wpRestoreState methods, of
  course (don't forget that you must call the parent methods).  But once
  you have done, the rest of WPS will call them when it is time to
  transfer your object to and from persistent storage.

  As to when the information must be updated from the settings notebook
  to the internal storage in the object itself, the answer is that it
  must be done immediately.  Crank open the [General] page of any object
  and type in a new title.  You will notice that the title takes effect
  as soon as the edit field loses focus.  For settings controlled by
  checkboxes, radio buttons, and suchlike (try the [Session] page of a
  program object for an example), the effect should be immediate.

jl>
  > I think the "Environment" page must have a "Save" button
  > which saves the environment info in an INI file and when
  > wpOpen method is called it reads the info from there
  > (wpOpen is called when either Settings is opened or the
  > program is launched).
jl>

  Use the persistency methods supplied by WPObject.  That is what they
  are there for.

  Not only do you then not have to worry about where the data are saved
  (WPAbstract deals with this), but you also futureproof yourself
  against the day that someone decides that WPProgram objects must use
  their own private persistency mechanism (you just use the inherited
  one -- you don't care whether it is WPAbstract or WPProgram that is
  providing the implementation).

  > JdeBP <
___
 X MegaMail 2.10 #0:
--- Maximus/2 3.00
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 808 809 934 955 712/407 515
SEEN-BY: 712/517 628 713/888 800/1 7877/2809
@PATH: 440/4 141/209 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.