[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

STANDARD XPL "PREAMBLE(S)





GO-> Myron:

GO-> With a view to stepping up in XPL programming, I would find it
 -> *extremely* helpful if we (i.e. you sophisticates) could agree on a
 -> kind of "preamble" to XPL programs that would save all the likely
 -> defaults and conditions which might be changed so they could be
 -> returned to "normal" with a "prologue". It is feasible to have
 -> something that we could all use???

It's more a question of laziness than anything else, Myron, to
have reusable code. But if everyone chips in, there should be
quite a list of standard variables to check.

One of the reasons I prefer having labels beginning on their own
line is that I can cut and paste code from one XPL to another, so
following is my own standard list which I use in 3+ and which
seems to work well in 4 and Xywin:

{LB-basic}{SX212,{VANW}}BC default nw=0XC BC ES 1XC BC red offXC
SI {SU999,BC default nw={PV212}XC BC ES 0XC
DO }{SX220,{VA$WS}}{IF{PV220}==1}{GL-window}{EI}{GL-target}

The first line assumes that there is going to be some type of
file handling, so it's important to note window control. (Note
that the same procedure is true for whatever custom settings are
employed.) The idea is that the original setting is saved to
sx212; (I then put the setting to manual windows because I
personally find it easier to program that way); the next
important point is in the exit subroutine 999, which restores the
user's system the way it was found. GT999 would then be run at
all the exit points in the program.

More typical in any program would be to turn off the error beep;
turn off red lining; and set insert on; the exit routine, if
really polite, would have marked the insert mode (via a VA) to a
proper return too.

The VA list could easily be extended (with matching ones in the
exit subroutine); this would especially be true if help frames
were in the program.

{LB-window}{SX222,{VA$WS}}SW n{SX224,{VA$WS}}{IF{PV222}==
{PV224}}{GL-abort}{EI}{GL-target}

The above line is my homey procedure for making sure that there's
at least one open window to work with. If not, the program
aborts; if so, it continues. Again, it's unnecessary unless the
XPL is to work with files.


All we need is some to correlate the replies on this subject!

--Chet

---
 ? SLMR 2.1a ? Art + write + dtp = chet.gottfried@xxxxxxxx