Category : Files from Magazines
Archive   : DDJ9406C.ZIP
Filename : FOXPRO.ASC
by J. Randolph Brown
Listing One
PRIVATE objfont,objfsize,objfstyle
PRIVATE scrnfont,scrnfsize,scrnfstyle
PRIVATE nosize,nostyle,SysControl
PRIVATE mystamp,splatform,splatform2
PRIVATE tmparr,tmpcurs,tmpalias,scrnfile
* Select fonts you want to use in transporting
DO CASE
CASE _MAC
* default screen font
scrnfont='Geneva'
scrnfsize=13
scrnfstyle=0
* object font
objfont='Geneva'
objfsize=9
objfstyle=0
CASE _WINDOWS
* default screen font
scrnfont='MS Sans Serif'
scrnfsize=10
scrnfstyle=1
* object font
objfont='MS Sans Serif'
objfsize=8
objfstyle=0
ENDCASE
splatform = IIF(_MAC,'MAC','WINDOWS')
splatform2 = IIF(_MAC,'WINDOWS','MAC')
m.nosize = .F. &&retain original font style
m.nostyle = .T. &&retain original font size
m.SysControl = .F. &&use system font for controls
* Select screen file to transport
m.scrnfile=GETFILE('SCX','Select Screen File:')
IF !'.SCX'$UPPER(m.scrnfile)
RETURN
ENDIF
* If the file already has platform objects it is kicked out.
* You can manually delete these objects and retransport.
m.tmpalias='_'+LEFT(SYS(3),7)
SELECT 0
USE (m.scrnfile) ALIAS (m.tmpalias) EXCLUSIVE
LOCATE FOR platform=m.splatform
IF FOUND()
WAIT WINDOW 'File has already been transported.'
USE IN (m.tmpalias)
RETURN
ENDIF
WAIT WINDOW 'Transporting Screen...' NOWAIT
* Create cursor of new platform objects to be appended to original file later.
=AFIELDS(tmparr)
m.tmpcurs='_'+LEFT(SYS(3),7)
CREATE CURSOR (m.tmpcurs) FROM ARRAY tmparr
APPEND FROM DBF(tmpalias) FOR platform = m.splatform2
* Add new platform
REPLACE ALL platform WITH m.splatform
* Handle porting of objects
DO CASE
CASE m.nostyle AND m.nosize &&change only fontface
REPLACE ALL fontface WITH m.objfont;
FOR INLIST(objtype,5,11,12,13,14,15,16,22,23)
CASE m.nostyle &&dont' change
fontstyle
REPLACE ALL fontface WITH m.objfont,;
fontsize WITH m.objfsize;
FOR INLIST(objtype,5,11,12,13,14,15,16,22,23)
CASE m.nosize &&dont' change fontsize
REPLACE ALL fontface WITH m.objfont,;
fontstyle WITH m.objfstyle;
FOR INLIST(objtype,5,11,12,13,14,15,16,22,23)
OTHERWISE
REPLACE ALL fontface WITH m.objfont,;
fontsize WITH m.objfsize,fontstyle WITH m.objfstyle;
FOR INLIST(objtype,5,11,12,13,14,15,16,22,23)
ENDCASE
* Add system fonts for controls if option set
IF m.SysControl
DO CASE
CASE _MAC
* use Geneva,10,N for controls
REPLACE ALL fontface WITH 'Geneva',;
fontsize WITH 10,fontstyle WITH 0;
FOR INLIST(objtype,11,13,14,16,22)
* use Geneva,10,B for text buttons
REPLACE ALL fontface WITH 'Geneva',;
fontsize WITH 10,fontstyle WITH 1;
FOR objtype=12
CASE _WINDOWS
* use MS Sans Serif,8,B for controls
REPLACE ALL fontface WITH 'MS Sans Serif',;
fontsize WITH 8,fontstyle WITH 1;
FOR INLIST(objtype,12,13,14,16,22)
* use MS Sans Serif,8,N for lists
REPLACE ALL fontface WITH 'MS Sans Serif',;
fontsize WITH 8,fontstyle WITH 0 FOR objtype=11
ENDCASE
ENDIF
* Handle screen default font objects
* - picture buttons, invisible buttons
* - picture check boxes, picture radios
REPLACE ALL fontface WITH m.scrnfont,;
fontsize WITH m.scrnfsize,fontstyle WITH m.scrnfstyle ;
FOR INLIST(objtype,1,20) OR '@*B'$picture OR ;
'@*RB'$picture OR '@*CB'$picture
* Note: can add code here to replace objtype 23 info
* Cleanup a little
SELECT (m.tmpalias)
APPEND FROM DBF(m.tmpcurs)
USE IN (m.tmpalias)
USE IN (m.tmpcurs)
WAIT CLEAR
MODIFY SCREEN (m.scrnfile) NOWAIT
RETURN
Example 1: FoxPro command which displays an input field on a
screen at specified coordinates
@ 9.063,40.125 GET m.state ;
SIZE 1.000,3.200 ;
DEFAULT " " ;
FONT "Geneva", 9 ;
PICTURE "@K XX" ;
COLOR ,RGB(,,,255,255,255)
Example 2: Windows definition
IF NOT WEXIST("_qls1cbchi")
DEFINE WINDOW _qls1cbchi ;
AT 0.000, 0.000 ;
SIZE 18.188,62.500 ;
TITLE "Customer" ;
FONT "Geneva", 13 ;
FLOAT ;
COLOR RGB(,,,192,192,192)
MOVE WINDOW _qls1cbchi CENTER
ENDIF
Example 3:
(a)
1 Foxel Row = FontMetric(1) + FontMetric(5)
1 Foxel Column = FontMetric(6)
(b)
1 Foxel Row = Font(1,'Geneva',13) + Font(5,'Geneva',13)
= 16 pixels
1 Foxel Column = Font(6,'Geneva',13)
= 8 pixels
(c)
= number of rows * pixels per foxel row
= 9.063 * 16 = 145
= number of columns * pixels per foxel col
= 40.125 * 8 = 321
Example 4:
1 Foxel Row = Font(1,'Geneva',9) + Font(5,'Geneva',9)
= 12 pixels
1 Foxel Column = Font(6,'Geneva',9)
= 5 pixels
Example 5:
SET LIBRARY TO foxtools
mydir=GETDIR('Select directory:')
retval=fxNewFolder(SYS(2027,m.mydir+'TEMP FOLDER'))
Example 6
(a)
DO CASE
CASE _DOS
CASE _WINDOWS
CASE _MAC
CASE _UNIX
ENDCASE
(b)
IF _MAC
SET XCMDFILE TO 'xalert'
ENDIF
(c)
IF _MAC
XMac_Cmd='SET XCMDFILE TO "xalert"'
&XMac_Cmd
ENDIF
Example 7
(a)
SET LIBRARY TO foxtools
(b)
SET LIBRARY TO ('foxtools')
(c)
*dummy.prg
FUNCTION justpath
FUNCTION juststem
FUNCTION msgbox
(d)
IF _DOS
SET PROCEDURE TO dos_proc
ENDIF
Figure 1: FoxPro for Macintosh configuration file
VOLUME c=\
MACDESKTOP=off
KEYCOMP=windows
Figure 2:
? CURDIR()
\FOXPRO\
? SYS(2027,CURDIR())
COSMIC II:FOXPRO:
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/