home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20502 < prev    next >
Encoding:
Text File  |  1993-01-01  |  7.9 KB  |  165 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!well!oster
  3. From: oster@well.sf.ca.us (David Phillip Oster)
  4. Subject: Re: How to write a balloons ?
  5. Message-ID: <C05s9o.CB0@well.sf.ca.us>
  6. Sender: news@well.sf.ca.us
  7. Organization: Whole Earth 'Lectronic Link
  8. References: <1992Dec31.163417.7035@fcom.cc.utah.edu>
  9. Date: Fri, 1 Jan 1993 04:53:48 GMT
  10. Lines: 153
  11.  
  12. In article <1992Dec31.163417.7035@fcom.cc.utah.edu> Dmitry Boldyrev <dmitry@chemistry.chem.utah.edu> writes:
  13. >Does anyone know how to write a balloons ?
  14. In your .r file add the following:
  15.  
  16. #include "BalloonTypes.r"
  17.  
  18. then you give your dialogs a name, even though with the standard dialog
  19. window style the name will not be drawn.
  20.  
  21. The following resource connects dialog 16128 to hdlg 16128
  22.  
  23. /* The 'hwin' resource connects the DLOG to the hdlg (by the window name)
  24.  */
  25. resource 'hwin' (16128, "", purgeable) {
  26.     HelpMgrVersion,
  27.     hmDefaultOptions,
  28.     {
  29.     16128, 'hdlg',
  30.     18,
  31.     "Your Dialog Name Here"
  32.     }
  33. };
  34.  
  35. hdlg 16128 looks like this:
  36.  
  37.  
  38. /* The 'hdlg' resource connects dialog items to STR# items.
  39.  */
  40. resource 'hdlg' (16128, "", purgeable) {
  41.     HelpMgrVersion,
  42.     0,    /* start with first item */
  43.     hmDefaultOptions,
  44.     0,    /* balloon def id */
  45.     0,    /* var code, hang right */
  46.     HMSkipItem {},
  47.     {    /* buttons */
  48.         /* [1] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 1, 0,0, 0,0, 0,0 },
  49.         /* [2] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 2, 0,0, 0,0, 0,0 },
  50.         /* [3] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 3, 16131,1, 0,0, 0,0 },
  51.         /* [4] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 4, 0,0, 0,0, 0,0 },
  52.         /* [5] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 5, 0,0, 0,0, 0,0 },
  53.         /* [6] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 6, 0,0, 0,0, 0,0 },
  54.         /* [7] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 7, 16131,2, 0,0, 0,0 },
  55.         /* [8] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 8, 16131,3, 0,0, 0,0 },
  56.         /* [9] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128, 9, 16131,4, 0,0, 0,0 },
  57.         /* checkbox */ 
  58.         /* [10] */    HMSkipItem {},
  59.         /* menus */
  60.         /* [11] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,11, 16128,11, 16128,11, 16128,11 },
  61.         /* [12] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,12, 16128,12, 16128,12, 16128,12 },
  62.         /* [13] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,13, 16131, 7, 16128,13, 16128,13 },
  63.         /* [14] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,14, 16131, 8, 16128,14, 16128,14 },
  64.         /* [15] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,15, 16128,15, 16128,15, 16128,15 },
  65.         /* [16] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,16, 16131, 9, 16128,16, 16128,16 },
  66.         /* [17] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,17, 16128,17, 16128,17, 16128,17 },
  67.         /* and scrollbar */
  68.         /* [18] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,18, 16128,18, 16128,18, 16128,18 },
  69.         HMSkipItem {},
  70.         HMSkipItem {},
  71.         HMSkipItem {},
  72.         HMSkipItem {},
  73.         HMSkipItem {},
  74.         HMSkipItem {},
  75.         HMSkipItem {},
  76.         HMSkipItem {},
  77.         HMSkipItem {},
  78.         /* [28] */ HMSkipItem {},
  79.         HMSkipItem {},
  80.         HMSkipItem {},
  81.         HMSkipItem {},
  82.         HMSkipItem {},
  83.         HMSkipItem {},
  84.         HMSkipItem {},
  85.         HMSkipItem {},
  86.         HMSkipItem {},
  87.         HMSkipItem {},
  88.         /* [38] */ HMSkipItem {},
  89.         /* light and dark PICTs */
  90.         /* [39] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,19, 0,0, 0,0, 16128,19 },
  91.         /* [40] */    HMStringResItem {{0,0}, {0,0,0,0}, 16128,20, 0,0, 0,0, 16128,20 },
  92.         HMSkipItem {},
  93.         HMSkipItem {},
  94.         /* [43] */    HMStringResItem {{10, 185}, {0,0,0,0}, 16128,21, 0,0, 0,0, 16128,21 }
  95.     }
  96. };
  97.  
  98. As you can see, most items just reference the corresponding string in a STR#,
  99. 16128. Here is the string data: (Please excuse the spanish, the nonascii
  100. characters, and the long lines. It is part of a shipping product.)
  101.  
  102. /* The help items referenced in the hdlg resource. Items in this STR# happen to (mostly) coincide
  103.     with items in the original DITL.
  104.  */
  105. resource 'STR#' (16129) {{
  106. /*{289}*/        /* [1] */    "Para escanear una imagen como ventana " PRODUCT ", pulse aqu",
  107. /*{290}*/        /* [2] */    "Para dejar este plug-in sin rastreo, haga clic aqu.",
  108. /*{291}*/        /* [3] */    "Para hacer una exploracin rpida que aparece en el cuadro de RpreviaS haga clic aqu. ",
  109. /*{292}*/        /* [4] */    "Para guardar los ajustes en curso en un archivo de ajustes, haga clic aqu.",
  110. /*{293}*/        /* [5] */    "Los globos de ayuda estn conectados. Para encender TayudaU, haga clic aqu. (Para desconectarla, utilice el men ayuda.)",
  111. /*{294}*/        /* [6] */    "Para leer un archivo de ajustes existente, haga clic aqu.",
  112. /*{295}*/        /* [7] */    "Haga clic aqu para cancelar cualquier acercamiento (zooming) de la imagen previsualizada.",
  113. /*{296}*/        /* [8] */    "Pluse esto para acercar la imagen previsualizada. El zoom solo afecta a la imagen previsualizada no a la obtenida por " PRODUCT ".",
  114. /*{297}*/        /* [9] */    "Pluse esto para alejar la imagen previsualizada. El zoom solo afecta a la imagen previsualizada no a la obtenida por " PRODUCT ".",
  115. /*{298}*/        /* [10] */    "Haga clic aqu para seleccionar Alimentacin Automtica de Documento. Si este dispositivo est conectado, al pulsar el botn de Escanear, el escaner se alimentar desde la bandeja de documentos superior.",
  116. /*{299}*/        /* [11] */    "Utilice este men que aparece para fijar el modo del escaner. (Color, Escala gris, Blanco y negro etc.)",
  117. /*{300}*/        /* [12] */    "Utilice este men que aparece para fijar la resolucin del escaner en pixeles por pulgadas.",
  118. /*{301}*/        /* [13] */    "Utilice este men que aparece para fijar el color por omitir. Exploraciones en blanco y negro normalmente suman todos los colores, utilice esto para ignorar un color, por ejemplo lpiz azul.",
  119. /*{302}*/        /* [14] */    "Utilice este men que aparece para fijar la curva del color. Esto permite que el escaner se ajuste para el dispositivo de salida preferido.",
  120. /*{303}*/        /* [15] */    "Utilice este men que aparece para fijar el gamma. Esto permite que el escaner se ajuste para el tipo de original que se est explorando. ",
  121. /*{304}*/        /* [16] */    "Utilice este men que aparece para fijar la nitidez (agudizar). Esto permite que el escaner se ajuste para el tipo de original que se est explorando.",
  122. /*{305}*/        /* [17] */    "Utilice este men que aparece para fijar las unidades que se utilizan para informar del tamao de la exploracin.",
  123. /*{306}*/        /* [18] */    "Utilice esta barra desplazadora para fijar el brillo. Esto permite que el escaner se ajuste para el tipo de original que se est explorando.",
  124. /*{307}*/        /* [19] */    "Haga clic aqu para fijar el brillo a mxima oscuridad.",
  125. /*{308}*/        /* [20] */    "Haga clic aqu para fijar el brillo a mxima claridad.",
  126. /*{309}*/        /* [21] */    "Cuando se pulsa el botn de TPreviaU, una exploracin concisa de baja resolucin aparece aqu, de tal manera que se puede usar el ratn para seleccionar la parte de la imagen que se explorar para " PRODUCT ".",
  127.     /* [22] */  "Pluse esto para seleccionar la unidad de transparencias. Si ya esta seleccionada, cuando pulse el boton de Scan, el scanner ilumunar el original utilizando las lamparasa de la unidad de transparencias"
  128. }};
  129. Menus are analagous. A sample menu, with in-line strings this time:
  130. (the menu just says:
  131. pixels
  132. inches
  133. centimeters)
  134. resource 'hmnu' (16134, purgeable){
  135.     HelpMgrVersion, hmDefaultOptions, 0, 0,
  136.     HMSkipItem { },    /* missing item? */
  137.     {
  138.         HMSkipItem { },    /* title */
  139.         HMStringItem {
  140.             "Shows the size of the selected scan area in pixels.",
  141.             "",    /* can't be dimmed */
  142.             "Shows the size of the selected scan area in pixels.",
  143.             "Shows the size of the selected scan area in pixels."
  144.         },
  145.         HMStringItem {
  146.             "Shows the size of the selected scan area in inches.",
  147.             "",    /* can't be dimmed */
  148.             "Shows the size of the selected scan area in inches.",
  149.             "Shows the size of the selected scan area in inches."
  150.         },
  151.         HMStringItem {
  152.             "Shows the size of the selected scan area in centimeters.",
  153.             "",    /* can't be dimmed */
  154.             "Shows the size of the selected scan area in centimeters.",
  155.             "Shows the size of the selected scan area in centimeters."
  156.         }
  157.     }
  158. };
  159.  
  160. I recommend using a STR# instead of a StirngItem to reduce the repetion factor.
  161. Check the manual for the meanings of the successive items:
  162. bright, dim, checked, marked  (I think, but check.)
  163.  
  164. That will get you started.
  165.