Apple II Technical Notes _____________________________________________________________________________ Developer Technical Support Apple IIGS #3: Window Information Bar Use Revised by: Dave Lyons January 1991 Written by: Dan Oliver October 1986 This Technical Note details the use of a window's information bar, including a code sample which places a menu in an information bar. Changes since November 1988: Added a note about the current Resource Application when inside an InfoDefProc procedure, and information about information bars and NewWindow2. _____________________________________________________________________________ Apple IIGS window information bars are not as straightforward as other window features, and one reason for this is the small amount of space originally allocated for their processing. If you feel your application can benefit from the use of information bars, you can implement them, and this Technical Note explains how to do it and includes some suggestions for their use. The code samples below demonstrate how to place a menu bar in an information bar, but your use of information bars is not limited to those described here. Information Bar Initialization You can create an information bar in a window when you create the window by setting the following fields in the parameter list you pass to NewWindow: wFrame Set bit 4. wInfoHeight Set to the height of the information bar (should not exceed window height). wInfoDefProc Set to the address of the information bar definition procedure (see below). If you create a window as visible, the Window Manager will call your information bar definition procedure (InfoDefProc) before returning from NewWindow. If you have to create the contents of the information bar after the window, you will have a problem since the Window Manager will expect your InfoDefProc to draw things which do not yet exist. You can solve this problem by creating the window as invisible, creating the contents of the information bar, then showing the window. Another solution would be to detect, in the InfoDefProc, that the contents of the information bar do not yet exist. NewWindow2, however, does not let you override the information bar drawing procedure in the template. If you pass a window template in a resource, creating the window as visible crashes (since the address of your information bar drawing procedure cannot possibly be in the window template resource). Instead, create the window as invisible and call SetInfoDraw to set the address of the information bar drawing procedure before calling ShowWindow. Below is an example of initializing a window's information bar to contain a menu bar. The three key fields of the parameter list which you pass to NewWindow are as follows: wFrame Set bit 4 = 1 and bit 5 = 0 for an invisible window; the other bits do not affect the information bar, so you can set them as you wish. wInfoHeight Assuming you are using a system menu bar and initializing it before the window, set to the height FixMenuBar returned when you created the system menu bar. If you would rather use an absolute value, which we do not advise, you could use 14 which should be about right for the current system font. wInfoDefProc Set to the address of the InfoDefProc, in this case draw_info. After you create the window, but before you show it, you can create the menu bar to place in the information bar. The code to create the menu bar might look like the following: window Direct page location that contains pointer to window's port. ; ; --- Create a menu bar -------------------------------------------------------------------- ; pha Space for result. pha pea $FFFF Set "use current port" flag. pea $FFFF _NewMenuBar Create a menu bar. pla Get returned menu bar handle. sta