[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need help with ParamText routine



On page 229 of the ByteWork's "Programming the Toolbox in Pascal"
tutorial it states:

     "Setting bit 1 of the flag word tells the Control Manager to
     perform text substitution.  This lets you substitute text in a
     static text string, more or less like you did in an alert
     window."

I have been attempting to do this but have been unsuccessful in
everything I have tried so far.  I found the ParamText toolbox
routine in volume 1 of the Toolbox Reference Manual and I assume that
this is the routine that I need to use.  My static text gets drawn,
but there appears to be garbage where the substitute text should
appear.  In addition to the code shown below, I have tried calls such
as the following, but none work:

   ParamText(strPtr, nil, nil, nil);
   ParamText(@'Output', nil, nil, nil);

Here is a portion of my Pascal source (I am using ORCA/Pascal
version 1.4):

   var
      str: pString;
      strPtr: pStringPtr;

   begin {InitWindow}
   str := 'Input';
   strPtr := @str;
   ParamText(pointer(ord4(strPtr)), nil, nil, nil);
   wPtr := NewWindow2(nil, 0, @DrawContents, nil, $02,
               status, rWindParam1);
   end; {InitWindow}

And here is the Rez source for the template for the static text
control:

resource rControlTemplate (statInput) {
   statInput,                           /* control ID */
   {5,15,16,500},                       /* control rect */
   statTextControl {{
      $0002,                            /* flags */
      $1002,                            /* more flags */
      0,                                /* refcon */
      statInput+status                  /* Title Ref */
      }};
   };
resource rTextForLETextBox2 (statInput+status) {"Input File:  *0"};


Please note that the curly brackets probably will not survive the
translation from my EBCDIC IBM mainframe through the mostly ASCII
network.  Can you please shed some light on what I am doing wrong?
Or at least point me in the right direction.  Thanks.

====================================================================
J. Douglas Ashbrook                                   (301) 402-1248
INTERNET: JDA@CU.NIH.GOV                           BITNET: JDA@NIHCU
National Institutes of Health, Computer Center,   Bethesda, MD 20892