home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22112 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.9 KB

  1. Path: sparky!uunet!psinntp!iat.holonet.net!bmug!Philip_J._Grandinetti
  2. Message-ID: <1993Jan24.153842.213406@bmug.org>
  3. Newsgroups: comp.sys.mac.programmer
  4. Distribution: world
  5. From: Philip_J._Grandinetti@bmug.org
  6. Organization: BMUG, Inc.
  7. Date: Sun, 24 Jan 1993 15:38:42 PST
  8. Subject: Re: Geneva 9 Radio Buttons, Checkboxes, etc...
  9. Lines: 43
  10.  
  11. It's fairly straightforward to get your radio buttons and checkboxes in geneva
  12. 9. 
  13.  
  14. First step:  Use ResEdit to create a new control resource and set the ProcID
  15. to either 9 or 10 for checkbox or radio button respectively.  Define all the
  16. other parameters (e.g. name, sizes, etc).  Then use Resedit DITL editor to add
  17. the new control to your dialog (don't forget to specify the Resource ID).
  18.  
  19. Second step: In your source code change the font for your dialog box to geneva.
  20. I do this when I set up my dialogs, and use a routine I got from the book
  21. "Extending the
  22. Macintosh Toolbox" by May and Whittle called SetDFont() that I modified
  23. slightly to fix a bug in it.  
  24.  
  25. For example,
  26. myDialog = GetNewDialog(myDialogID, 0L, (WindowPtr) -1L);
  27. SetDFont(myDialog,geneva,fontSize,fontStyle,copyMode);
  28.  
  29. I probably shouldn't reproduce it here for legal reasons, but my bug fix is to
  30. include the lines
  31.  
  32.     FontInfo finfo;
  33.  
  34.     TextFont(fontNumber);
  35.     TextFace(fontStyle);
  36.     TextMode(copyMode);
  37.     TextSize(fontSize);
  38.     GetFontInfo(&finfo);
  39.  
  40.     (*((DialogPeek)theDialog)->textH)->fontAscent = finfo.ascent;
  41.     (*((DialogPeek)theDialog)->textH)->lineHeight = finfo.ascent + finfo.descent
  42. + finfo.leading;
  43.  
  44. and to move the variable fontName to the subroutine arguments, replacing fontName.  I recommend the book as a good source for things like this, but I have had quite a few problems implementing some of the routines because
  45. of minor bugs.
  46.  
  47. Good Luck,
  48.  
  49. Philip 
  50.  
  51. **** From Planet BMUG, the FirstClass BBS of BMUG.  The message contained in
  52. **** this posting does not in any way reflect BMUG's official views.
  53.  
  54.