Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing graphic characters in foxpro 2.6 for windows, fixed font scr

Status
Not open for further replies.

martinr

Programmer
Feb 11, 2000
11
US
Q1) In DOS I was able to create graphic reports by using the CHR() function, but I am wondering if anybody knows of a way to print graphic chars in Windows (I do use the report writer, but sometimes I need to generate graphics in a .PRG). Q2) Does anybody know if one can use a fixed font when showing a popup...... Thank You.
 
Question #1 - Never Tried it in Windows.<br>
<br>
Question #2 - Here is a routine for you. <br>
*/***************************************************************************<br>
*/Program : function MSGWWAIT<br>
*/System : Fox Library <br>
*/Purpose : Displays Message window and waits for a key press<br>
*/Returns : Integer - Number of lines needed to display the message<br>
*/Syntax : = MsgWwait(Msg,Row,clr,name)<br>
*/Parameter : String - Msg - Text to be displayed in the window<br>
*/ : Integer - Row - Top screen row of message box<br>
*/ : Integer - Clr - color scheme to use<br>
*/ : String - Name- For personalized messages to the user<br>
*/Default : Row = mid screen<br>
*/Requires : Nothing<br>
*/Changes : Nothing<br>
*/Calls : Fillaray()<br>
*/Version : 1.0<br>
*/Dated : 28/05/1989<br>
*/Written By: David W. Grewe<br>
*/***************************************************************************<br>
*& Message<br>
*/***************************************************************************<br>
*/ Record Of Change<br>
*/<br>
*/***************************************************************************<br>
parameter P_MSG,P_PERSON,P_ROW,P_CLR,P_ICON<br>
private P_MSG, P_ROW, P_CLR, L_PARA, L_PLACE, L_LEN, L_CLM, L_COUNT<br>
*<br>
* Parameter check<br>
*<br>
L_PARA = parameters()<br>
if L_PARA &lt; 1 .or. type(&quot;P_Msg&quot;) # &quot;C&quot;<br>
wait window &quot;First Parameter Passed to Function MsgWWait Is Not A String.&quot;<br>
return 0<br>
endif<br>
if L_PARA &lt; 3<br>
P_ROW = -1<br>
endif<br>
if L_PARA &lt; 4<br>
P_CLR = 7<br>
endif<br>
if empty(P_PERSON)<br>
P_PERSON=&quot;&quot;<br>
endif<br>
if empty(P_ICON)<br>
P_ICON=&quot;&quot;<br>
endif<br>
*<br>
* Main Part Of Function<br>
*<br>
private array LC_ARRAY(10)<br>
dimension LC_ARRAY(10)<br>
L_LEN = len(P_MSG)<br>
lnCheck=at(chr(13),P_MSG) <br>
if lnCheck &gt; 0<br>
L_TEMP=substr(P_MSG,1,lnCheck-1)<br>
P_MSG=substr(P_MSG,lnCheck+1)<br>
else<br>
L_TEMP=&quot;Please Notice&quot;<br>
endif<br>
L_LEN = iif(L_LEN&gt;60, 65, iif(L_LEN&lt;45 , 50, L_LEN+5))<br>
L_COUNT = FILLARAY(P_MSG,&quot;LC_ARRAY&quot;,L_LEN)<br>
L_CLM=(scols()-L_LEN)/2<br>
P_ROW=iif(P_ROW+L_COUNT+2 &gt; srows(), srows()-2-L_COUNT, iif(P_ROW &lt; 0, int((srows()-L_COUNT)/2), P_ROW))<br>
*<br>
if empty(P_ICON)<br>
define window message at P_ROW,L_CLM size L_COUNT+4,L_LEN ;<br>
in desktop system nozoom nogrow noclose float nomdi nominimize ;<br>
title P_PERSON ;<br>
font &quot;FixedSys&quot;,9 ;<br>
color scheme (P_CLR) <br>
else<br>
define window message at P_ROW,L_CLM size L_COUNT+4,L_LEN ;<br>
in desktop system nozoom nogrow noclose float nomdi nominimize ;<br>
title P_PERSON ;<br>
font &quot;FixedSys&quot;,9 ;<br>
icon file (P_ICON) ;<br>
color scheme (P_CLR)<br>
endif<br>
*<br>
if P_ROW&lt;0<br>
move window MESSAGE center<br>
endif<br>
activate window message top<br>
@ 0,0 say padc(L_TEMP,L_LEN)<br>
@ 1,0 to 1,L_LEN<br>
*<br>
for L_LINE = 2 to L_COUNT+1<br>
@ L_LINE,0 say padc(proper(LC_ARRAY[L_LINE-1]),L_LEN)<br>
endfor<br>
*<br>
@ L_LINE,0 to L_LINE,L_LEN<br>
@ L_LINE+1,0 say padc(&quot;Press A Key Or Mouse Button To Continue &quot;,L_LEN)<br>
set cursor off<br>
on escape release window message<br>
wait &quot;&quot; to NOTHING<br>
*<br>
* Clean Up The Enviroment<br>
*<br>
set cursor on<br>
release window message<br>
release LC_ARRAY<br>
release P_MSG, P_ROW, P_CLR, P_PERSON, L_PARA, L_PLACE, L_LEN, L_CLM, NOTHING<br>
return L_COUNT<br>
<br>
*/***************************************************************************<br>
*/Program : function FILLARAY<br>
*/System :<br>
*/Purpose : breaks up a string into an array<br>
*/Syntax : = fillaray(string,array,size)<br>
*/Returns : Integer - lines - number of lines required to fill the array<br>
*/Parameter : String - string - the char string or database filed to break up<br>
*/ : String - array - the name of the array to use<br>
*/ : Integer - size - the length of the array strings to be returned<br>
*/Changes : The array containing the string pieces<br>
*/Requires : THE ARRAY MUST BE DECLARED IN THE CALLING PROGRAM<br>
*/Calls :<br>
*/Version : 1.0<br>
*/Dated : 22 Nov 1993<br>
*/Written By: David W. Grewe<br>
*/***************************************************************************<br>
*& Array Function<br>
*/***************************************************************************<br>
*/ Record Of Change<br>
*/<br>
*/***************************************************************************<br>
parameters P_STR,P_ARRAY,P_SIZE<br>
external array (P_ARRAY)<br>
private P_STR, P_SIZE, P_ARRAY<br>
P_STR = alltrim(P_STR)+&quot; &quot;<br>
*<br>
private L_COUNT, L_LEN, L_STR, L_PLACE<br>
L_COUNT = 0 && number of array elements used<br>
L_LEN = len(P_STR) && length of string to be worked on<br>
L_STR = &quot; &quot; && swap var to hold a piece of P_STR<br>
L_PLACE = 0 && where a blank space is<br>
*<br>
if len(P_STR) &gt; P_SIZE<br>
do while len(alltrim(P_STR)) &gt; 1<br>
L_COUNT = L_COUNT + 1<br>
L_STR = substr(P_STR,1,P_SIZE)<br>
L_PLACE = rat(&quot; &quot;,L_STR)<br>
&P_ARRAY(L_COUNT) = alltrim(substr(P_STR,1,L_PLACE))<br>
P_STR = substr(P_STR,L_PLACE)<br>
enddo<br>
else<br>
L_COUNT = 1<br>
&P_ARRAY(1) = P_STR<br>
endif<br>
return L_COUNT<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top