At 23:16 Uhr +0100 24.04.2002, p kent wrote: >Anyway, the _really_ important question :-) is: how do I give a dialog box >a platinum background (so that it looks like other 'modern' dialogs) ? I >thought that simply building a _color_ dialog would be enough, and it would >appear as the user specified in their Appearance control panel. >
I don't have the definite answer to your question, and I can't go into much detail, just a few remarks: MacPerl is not (yet) Appearance aware, but this doesn't necessarily mean that your dialog can't get this fancy gray scale look (provided your System/Dialog Manager is Appearance aware). You either create such a modern looking dialog by providing a 'dlgx' resource (which is nothing else than a flag where you have to set the appropriate bits) in addition to the usual DLOG/DITL resources, or by using the NewFeaturesDialog() toolbox function, which creates a dialog box without using 'DLOG' or 'dlgx' resources. However, you can't use NewFeaturesDialog() because it's not (yet) in Dialogs.pm (and would require AppearanceLib). Something that *might* work (I'm not sure, since I don't usually use MacPerl for GUI programming, but if you are the more adventurous type of programmer ... :-): Copy&Paste a 'dlgx' resource, e.g. from Shuck, either into MacPerl or your script's resource fork (???); the id must be the same as your dialog's id. These are the bits in the 'dlgx' resource (quoted from [1]): "enum { kDialogFlagsUseThemeBackground = (1 << 0), kDialogFlagsUseControlHierarchy = (1 << 1), kDialogFlagsHandleMovableModal = (1 << 2), kDialogFlagsUseThemeControls = (1 << 3) }; The kDialogFlagsUseThemeBackground bit tells the Dialog Manager to make sure that the background of the dialog is painted in the right color or pattern for the current theme. The kDialogFlagsUseControlHierarchy bit tells the Dialog Manager to create a root control for the window and establish a control embedding hierarchy. The kDialogFlagsHandleMovableModal bit tells the system that if this dialog is frontmost when ModalDialog is called, and its window type is movable modal, it should handle the dialog as described earlier in 'Movable Modal Dialogs and Alerts.' Don't forget to set the kDialogFlagsUseThemeControls bit, or the Dialog Manager will create old-fashioned System 7 controls on your nice grayscale dialog." It should be sufficient to set the kDialogFlagsUseThemeBackground and the kDialogFlagsUseThemeControls bits, i.e. your 'dlgx' resource should have a value of 9 (Shuck's is hex D). Setting the other bits may cause strange behavior. Before your start your experiments, you should at least read the Appearance article published in MacTech [1], or, to get the whole picture, download the Appearance SDK 1.0.4 [2] (btw, the article is part of the SDK, in nice PDF format). HTH. (And don't blame me if your Mac or MacPerl crashes ;-) Best regards, --Thomas [1] http://www.mactech.com/articles/mactech/Vol.13/13.05/AppearanceExtension/index.html [2] ftp://ftp.apple.com/developer/Development_Kits/