home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20647 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.7 KB  |  55 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!gatech!paladin.american.edu!howland.reston.ans.net!usc!cs.utexas.edu!bcm!aio!mark@cheers.jsc.nasa.gov
  3. From: mark@cheers.jsc.nasa.gov (Mark Manning)
  4. Subject: A Difference of Pointers
  5. Message-ID: <1993Jan5.005151.4558@aio.jsc.nasa.gov>
  6. Sender: news@aio.jsc.nasa.gov (USENET News System)
  7. Organization: NASA
  8. Date: Tue, 5 Jan 1993 00:51:51 GMT
  9. Lines: 44
  10.  
  11. Hello everyone!
  12.  
  13.    Thanks ahead of time for everyone who has helped me in the past! :)
  14.  
  15.    And now for the present we have....
  16.  
  17.  
  18.    I am using MPW Pascal.  In my travels of programming the Mac, I
  19. have repeatedly come up against the need to convert one type of
  20. handle to another.  What I'd like to ask (in this area) is:
  21.  
  22.    Why does
  23.  
  24.         NewHandle := @OldHandle;
  25.  
  26.    work some of the time and
  27.  
  28.         NewHandle := Pointer( ord( OldHandle ) );
  29.  
  30.    work at other times?
  31.  
  32.    I would have thought that only one or the other would always work,
  33. but this doesn't seem to be the way MPW works.  For example, in a
  34. dialog manager set of routines I did the following:
  35.  
  36.    SetPort( theDialog );
  37.    GetDItem (theDialog, theItem, theType, theHandle, theRect);
  38.    theControl := @theHandle;
  39.    theValue := GetCtlValue( theControl );
  40.  
  41. while in another procedure I had to do the following to get the
  42. same information out of the dialog:
  43.  
  44.    SetPort( theDialog );
  45.    GetDItem (theDialog, theItem, theType, theHandle, theRect);
  46.    theControl := Pointer( ord(theHandle) );
  47.    theValue := GetCtlValue( theControl );
  48.  
  49.    So I'm stumped.  I don't know why one works one time and the other
  50. works the other time.  I just use them that way.  But if someone could
  51. explain this to me I'd appreciate it. :)
  52.  
  53.    Thanks again!  :)
  54.  
  55.